Some Math questions

Hello everybody,



I know these are basic Math questions but my 3D Math Knowledge is far far away… :wink:

I’m currently looking into tutorial on the web,

but a little help to complete this would be welcome.

So, here are my questions :


  1. I read that a quaternion is very handy in 3D since it could contain a direction vector.

    as in JME a node got a local rotation which is a quaternion, does a node have a direction vector ?

    if yes, how could we retrieve it ?


  2. It seems that to have an angle between two vectors a cross (or dot ?) product will give me the information, is there an easy way to obtain this result with the jme api ?


  3. is there a way to rotate a mesh without a node or must we attach the mesh to node and rotate the node ?



    Thanks in advance for the answers,



    Bye,



    Adenthar.

Ok… return home and read the jme javadoc, so i’ve found the answer for question 2 and 3 ://



can’t find the answer for Question 1 yet…



bye,



Adenthar

well, im not sure this is a direction, but:



Matrix3f m = spatial.getLocalTranslation().toRotationalMatrix();
float x = m.get(0, 0);
float y = m.get(1, 1);
float z = m.get(2, 2);
Vector3f direction = new Vector3f(x, y, z);



I *think* that is the direction of the spatial....

Edit: ITS ALL WRONG

DP
  1. Vector3f direction = quaternion.getRotationColumn(2, direction);

Thanks a lot :smiley: !



bye,



Adenthar.