Translate and rotate frame

Translate and rotate frame

Translates and rotates a coordinate frame or a point to a new location and orientation.

The tool is given a frame and a translation vector in that frame. The input frame is usually in the world coordinate system, so let's briefly assume it is so. The tool first transforms the translation vector to the world coordinate system, producing a translated coordinate frame whose origin in the world coordinate system moves and rotates according to the input frame. It then rotates the axes of the result according to rotationAngle.

If the input is a point instead of a full coordinate frame, its coordinate axes are assumed to be aligned to the world coordinate system.

Inputs

frame
A coordinate frame to transform. This input also accepts a 2D point (1-by-2 matrix) as input. A point is treated as a coordinate frame whose x and y axes are aligned to those of the world coordinate system.
rotationAngle
Clockwise rotation angle around z axis, in degrees.
translation
Two-dimensional translation vector, in the coordinate system of the input frame. A 1-by-2 matrix.

Outputs

frame
The transformed coordinate frame. The origin of the frame is moved according to the translation vector. The base vectors are rotated according to rotationAngle.