Author Topic: a rotation matrix from one direction to another  (Read 1295 times)

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
a rotation matrix from one direction to another
« 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Re: a rotation matrix from one direction to another
« Reply #1 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...

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: a rotation matrix from one direction to another
« Reply #2 on: January 02, 2010, 05:39:13 pm »
yes it works, thanks :)