Domanda

I need to write an openGL matrix that rotates a point (x,y,z,w) around a given vector (for example , (1,2,-2)) by a 45 degree angle, how would I do that using matrices multiplication over the identity matrix ? (rotations , scaling, translations...)

È stato utile?

Soluzione

this is called axis angle rotation, the easiest is using the quaternion route:

the equivalent quaternion is sin(angle/2)*x, sin(angle/2)*y, sin(angle/2)*z, cos(angle/2)

then you use the matrix in the wiki to obtain the rotation matrix

enter image description here

Altri suggerimenti

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top