Question

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...)

Was it helpful?

Solution

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

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top