[ODE] vector to matrix math

Aras Pranckevicius nearaz at gmail.com
Sun Aug 21 13:58:13 MST 2005


> I need to find out the 3x3 matrix that represents the orientation of a
> vector. This vector is the direction of a thrust vector from a thruster.
> The matrix is needed in order to correctly represent the exhaust flame
> graphically.

There's an infinite number of "correct" answers (because you can roll
the flame around this axis freely). Basically, you just plug the
vector as one of matrix axes (e.g. Z - that depends on which axes you
treat as up/side/front), and calculate the other two vectors in such a
way that all three axes would be perpendicular to each other.

ODE has a function (in odemath.h):
  void dPlaneSpace (const dVector3 n, dVector3 p, dVector3 q);

That given a vector n computes two vectors p and q that are
perpendicular to n and to each other. Then you just plug all three
into the matrix and there you go.

-- 
Aras 'NeARAZ' Pranckevicius
http://nesnausk.org/nearaz | http://nearaz.blogspot.com



More information about the ODE mailing list