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:
Code: [Select]
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 :)