Рет қаралды 467
Rotating 2D points can be a difficult concept to understand, but it's essential for a variety of tasks in computer graphics and other fields. In this video, we'll use visuals to help you understand the process of rotating 2D points. We'll also provide some examples to help you solidify your understanding.
Rotating a point around the origin.
P = (x, y)
x' = x * cos θ - y * sin θ
y' = x * sin θ + y * cos θ
P' = (x', y') # rotated point
Rotating a point around another point.
P = (x1,y1) C = (x2,y2)
x' = (x1-x2) * cos θ - (y1-y2) * sin θ + x2
y' = (x1-x2) * sin θ + (y1-y2) * cos θ + y2
P' = (x', y') # rotated point