0

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

Kromster
  • 7,181
  • 7
  • 63
  • 111
user51929
  • 185
  • 1
  • 15

2 Answers2

2

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

ratchet freak
  • 47,288
  • 5
  • 68
  • 106
0

Use the Eigen linear algebra library, specifically Eigen::AxisAngle.

Danvil
  • 22,240
  • 19
  • 65
  • 88