Rotation around changing arbitrary points
hey all,
i am trying to rotate objects not just around their center but around arbitrary points which i got to work as far as i don't rotate my object before selecting another arbitrary point.
this is what i do at the moment:
// MyViewMatrix is: double MyViewMatrix[16];
// rotPoint is my arbitrary point: double rotPoint[3];
// translate from arbitrary point to origin
translate(MyViewMatrix, -rotPoint);
// rotate around X
rotateX(MyViewMatrix, FURADIANT(rx));
// rotate around Y
rotateY(MyViewMatrix, FURADIANT(ry));
// rotate around Z
rotateZ(MyViewMatrix, FURADIANT(rz));
// retranslate back to my arbitrary point
translate(MyViewMatrix, rotPoint);
it works when MyViewMatrix wasn't manipulated through a rotation around another point (e.g. center) before i choose a new arbitrary point. how am i able to consider the rotations i already did? i know that roations aren't commutative so the order matters...
i hope anyone can help me! :) thx in advance.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement