[Bf-committers] Math gurus; euler question!

Ton Roosendaal ton at blender.org
Sun Jun 5 12:06:46 CEST 2005


Hi,

An old annoyance in Blender, and again in bug tracker, is related to  
inserting rotation keys for objects. Objects store euler angles, but  
the transform code internally uses quaternions/matrices. This means  
that the endresult euler coming from transform (extracted from a  
matrix) can differ a lot from the old euler value, causing weird  
flipping animations when you insert that.

With my simple knowledge, I made this function long ago, in  
src/editobject.c

void compatible_eul(float *eul, float *oldrot)

	oldrot = the original rotation of the object (or key) before transform
	eul = the euler result during a transform

The code tries to correct the "eul" value to be as close to the  
original as possible. This happens not very scientific... you can see  
in the code a 'return' added, that's a part of the code that didn't  
work.

As illustration;
1) In top view, rotate the standard cube 90 degrees clockwise.
2) Open Nkey panel
3) In right-view, rotate. At 90 degrees you can see a flip in euler  
values

Question; does a textbook/standard trick exist to solve this? Without  
changing the entire transform, but just with this as input;

- old euler value
- 3x3 new rotation matrix, or euler extracted from it.

I can also be based on a recode of the arithb.c Mat3ToEul(), for  
example by giving this a third argument "reference euler" or so.

-Ton-

------------------------------------------------------------------------ 
--
Ton Roosendaal  Blender Foundation ton at blender.org  
http://www.blender.org



More information about the Bf-committers mailing list