How do you rotate a point?
About the origin by angle θ: x′ = x·cosθ − y·sinθ and y′ = x·sinθ + y·cosθ. These are the rows of the 2-D rotation matrix.
// maths › Graphics & Technology
Rotate a point (x, y) about the origin by an angle using x′ = x·cosθ − y·sinθ, y′ = x·sinθ + y·cosθ, with the angle in degrees or radians.
x′ = x·cosθ − y·sinθ; y′ = x·sinθ + y·cosθ
About the origin by angle θ: x′ = x·cosθ − y·sinθ and y′ = x·sinθ + y·cosθ. These are the rows of the 2-D rotation matrix.
Whenever a screen reorients, a game sprite spins, or a graphic turns — the device computes new coordinates with exactly these formulas.
Rotating (3, 0) by 90°: x′ = 3·cos90° − 0 = 0, y′ = 3·sin90° + 0 = 3, giving (0, 3) — a quarter turn anticlockwise.
Positive angles rotate anticlockwise (the maths convention); negative angles rotate clockwise.
Either — the toggle converts the angle; 90° is π/2 ≈ 1.5708 rad, and the result is the same.