2D point and vector rotation formulas

x′ = x cos θ − y sin θ y′ = x sin θ + y cos θ x′ = cx + (x − cx) cos θ − (y − cy) sin θ y′ = cy + (x − cx) sin θ + (y − cy) cos θ
(x, y)
original point or vector endpoint
(x′, y′)
rotated coordinates
θ
effective signed rotation angle
(cx, cy)
pivot; use (0, 0) for the origin