Horde3D

Next-Generation Graphics Engine
It is currently 20.04.2025, 22:05

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: 13.01.2009, 19:48 
Offline

Joined: 01.11.2008, 11:51
Posts: 12
Location: Croatia
Hi.
I use the getNodeTransformMatrices function, create a Matrix4f from the pointer it "returns". After that i decompose the matrix to get the euler rotations but they are different from what i get with the getNodeTransform (or the object's .xml file). Guess i'm doing something wrong but i cannot figure what.
The code (a little simplified but it sums the problem):

const float *local;
const float **loc = &local;
Horde3D::getNodeTransformMatrices(node,loc,NULL);
Matrix4f Matr(local);
Vec3f trans,rot,scale;
Matr.decompose(trans,rot,scale);


Thanx!


Top
 Profile  
Reply with quote  
PostPosted: 13.01.2009, 20:13 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
Quote:
getNodeTransformMatrices
DLL bool getNodeTransformMatrices( NodeHandle node,
const float ** relMat,
const float ** absMat )

Returns the transformation matrices of a node.

This function stores a pointer to the relative and absolute transformation matrices of the specified node in the specified pointer varaibles.

Parameters
node handle to the scene node to be accessed
relMat pointer to a variable where the address of the relative transformation matrix will be stored (can be NULL if matrix is not required)
absMat pointer to a variable where the address of the absolute transformation matrix will be stored (can be NULL if matrix is not required)

Returns
true in case of success otherwise false

or,
getNodeTransform(NODE, RELATIVE MATRIX, ABSOLUTE MATRIX);

You're operating on the relative transform matrix and not the absolute matrix. If that's what you want then use setNodeTransformMatrix.


Top
 Profile  
Reply with quote  
PostPosted: 13.01.2009, 20:27 
Offline

Joined: 01.11.2008, 11:51
Posts: 12
Location: Croatia
getNodeTransform does't work with matrices, it stores the data in variables provided in the argument (according to the API 1.0.0 Beta 2). And the transformations are in local space. So i my case i just try to extract the rotation angles (in local space) from the matrix given by getNodeTransformMatrices function.


Top
 Profile  
Reply with quote  
PostPosted: 13.01.2009, 21:16 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
You know that decompose is giving you the angles in radians while getNodeTransform and the XML file attributes are in degrees?

@AcidFaucet:
Quote:
You're operating on the relative transform matrix and not the absolute matrix. If that's what you want then use setNodeTransformMatrix.

Not sure what you mean with that, setNodeTransformMatrix is also setting the relative matrix.


Top
 Profile  
Reply with quote  
PostPosted: 13.01.2009, 21:59 
Offline

Joined: 01.11.2008, 11:51
Posts: 12
Location: Croatia
Volker wrote:
You know that decompose is giving you the angles in radians while getNodeTransform and the XML file attributes are in degrees?


Damn... :oops:
Everything in Horde3D is in degrees so i asumed that the utMath also follows the same rule because comes packed with it. Obviously wrong.
Thanx, you saved me a lot of trouble


Top
 Profile  
Reply with quote  
PostPosted: 13.01.2009, 22:05 
Offline
Tool Developer

Joined: 13.11.2007, 11:07
Posts: 1150
Location: Germany
You're welcome,... but keep in mind that handling transformations with euler angles may cause problems with singularities. Don't know what you want to do with the parameters, but you may consider using the transformation matrices itself.


Top
 Profile  
Reply with quote  
PostPosted: 13.01.2009, 22:45 
Offline

Joined: 01.11.2008, 11:51
Posts: 12
Location: Croatia
Yes, i know. I just need degrees in a short step (a conversion) so it should not cause problems... thanx for the warning anyway


Top
 Profile  
Reply with quote  
PostPosted: 13.01.2009, 23:48 
Offline

Joined: 19.11.2007, 19:35
Posts: 218
Quote:
AcidFaucet:

Quote:
You're operating on the relative transform matrix and not the absolute matrix. If that's what you want then use setNodeTransformMatrix.

Not sure what you mean with that, setNodeTransformMatrix is also setting the relative matrix.



I'm confusing my APIs.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 45 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group