سؤال

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

هل كانت مفيدة؟

المحلول

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

نصائح أخرى

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top