www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: raft on January 02, 2010, 04:31:47 PM

Title: a rotation matrix from one direction to another
Post by: raft on January 02, 2010, 04:31:47 PM
hi,

how can i create a rotation matrix such that, when applied, it rotates a direction vector to another ?

formally:
SimpleVector from;
Simplevector to;

from.matMul(m);
from.equals(to); // -> should be true ignoring rounding errors
Title: Re: a rotation matrix from one direction to another
Post by: EgonOlsen on January 02, 2010, 05:24:56 PM
Getting the rotation matrix of the first vector, inverting it and multiplying the result with the rotation matrix of the second vector might work...
Title: Re: a rotation matrix from one direction to another
Post by: raft on January 02, 2010, 05:39:13 PM
yes it works, thanks :)