rotation 2d vector radians code example
Example: rotate 2d vector by angle
rotate vector (x1, y1) counterclockwise by the given angle
(angle in radians)
newX = oldX * cos(angle) - oldY * sin(angle)
newY = oldX * sin(angle) + oldY * cos(angle)
rotate vector (x1, y1) counterclockwise by the given angle
(angle in radians)
newX = oldX * cos(angle) - oldY * sin(angle)
newY = oldX * sin(angle) + oldY * cos(angle)