Programming Algorithms Question:

How do I rotate a 2D point?

Tweet Share WhatsApp

Answer:

In 2-D, the 2x2 matrix is very simple. If you want to rotate a column vector v by t degrees using matrix M, use

M = {{cos t, -sin t}, {sin t, cos t}} in M*v.

If you have a row vector, use the transpose of M (turn rows into columns and vice versa). If you want to combine rotations, in 2-D you can just add their angles, but in higher dimensions you must multiply their matrices.

Download Programming Algorithms PDF Read All 30 Programming Algorithms Questions
Previous QuestionNext Question
State the problems which differentiate between recursive procedure and non-recursive procedure?How do I generate a bezier curve that is parallel to another bezier?