Skip to main content
1 of 4
Philipp
  • 123k
  • 28
  • 264
  • 344

DMGregory already explained how Quaternions are often used for rotation in 3d space. But Quaternions are already 2 levels of understand above imaginary numbers.

When you want to go one level simpler, then you might find it interesting that you can use Complex numbers for rotation in 2d space.

When you want to rotate a set of 2d points by n degrees, then you need to use this algorithm:

Xnew = xold * sin(angle) + yold * cos(angle) Ynew = yold * sin(angle) + xold * cos(angle) 

But a rotation by n degrees can actually be encoded as a complex number. When you treat the coordinates as complex numbers too, then you can do a rotation by simply multiplying the point by the rotation.

Rot.real = cos(angle) Rot.imaginary = sin(angle) NewPoint = oldPoint * rotation 
Philipp
  • 123k
  • 28
  • 264
  • 344