# Cartesian Coordinate Rotation (3D Rotation (Euler)) (G Dataflow)

Version:

Rotates a three-dimensional Cartesian coordinate system or a coordinate in the counterclockwise direction using the Euler angles method.

## x

X-coordinate.

This input accepts the following data types:

• Double-precision, floating-point number
• 1D array of double-precision, floating-point numbers

## y

Y-coordinate.

This input accepts the following data types:

• Double-precision, floating-point number
• 1D array of double-precision, floating-point numbers

## z

Z-coordinate.

This input accepts the following data types:

• Double-precision, floating-point number
• 1D array of double-precision, floating-point numbers

## Euler angle

This input accepts both proper and Tait-Bryan angle types.

Default: 0

Default: 0

Default: 0

## rotation order

Order of the axes to rotate the coordinates around.

Name Value Description
X-Y-Z 0 The first, second, and third rotations are about the x-, y-, and z-axes, respectively.
X-Z-Y 1 The first, second, and third rotations are about the x-, z-, and y-axes, respectively.
Y-X-Z 2 The first, second, and third rotations are about the y-, x-, and z-axes, respectively.
Y-Z-X 3 The first, second, and third rotations are about the y-, z-, and x-axes, respectively.
Z-X-Y 4 The first, second, and third rotations are about the z-, x-, and y-axes, respectively.
Z-Y-X 5 The first, second, and third rotations are about the z-, y-, and x-axes, respectively.
X-Y-X 6 The first, second, and third rotations are about the x-, y-, and x-axes, respectively.
X-Z-X 7 The first, second, and third rotations are about the x-, z-, and x-axes, respectively.
Y-X-Y 8 The first, second, and third rotations are about the y-, x-, and y-axes, respectively.
Y-Z-Y 9 The first, second, and third rotations are about the y-, z-, and y-axes, respectively.
Z-X-Z 10 The first, second, and third rotations are about the z-, x-, and z-axes, respectively.
Z-Y-Z 11 The first, second, and third rotations are about the z-, y-, and z-axes, respectively.

Default: Z-X-Z

## rotation type

Type of rotation to perform.

Name Value Description
Passive and Intrinsic 0 The rotation occurs about the axes of a rotating coordinate system, which is initially aligned with the fixed one, and modifies its orientation after each elemental rotation. The coordinate system rotates, while the coordinate is fixed.
Passive and Extrinsic 1 The rotation occurs about the axes of a fixed coordinate system. The coordinate system rotates, while the coordinate is fixed.
Active 2 The rotation occurs about the axes of the same coordinate system. The coordinate system is fixed, while the coordinate rotates.

Default: Passive and Intrinsic

## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

## rotated x

Rotated x-coordinate.

This output can return the following data types:

• Double-precision, floating-point number
• 1D array of double-precision, floating-point numbers

## rotated y

Rotated y-coordinate.

This output can return the following data types:

• Double-precision, floating-point number
• 1D array of double-precision, floating-point numbers

## rotated z

Rotated z-coordinate.

This output can return the following data types:

• Double-precision, floating-point number
• 1D array of double-precision, floating-point numbers

## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## Using the Euler Angles Method to Rotate Three-Dimensional Cartesian Coordinates

The following figure demonstrates how this node rotates three-dimensional Cartesian coordinates using the Euler angles method when rotation order is Z-X-Z and rotation type is Passive and Intrinsic.

The following steps describe the rotation:

1. Rotate the X-, Y-, and Z-axes about the Z-axis by ϕ (-π < ϕπ), resulting in the X'-, Y'-, and Z-axes.
2. Rotate the X'-, Y'-, and Z-axes about the X'-axis by θ (-πθπ), resulting in the X'-, Y''-, and Z'-axes.
3. Rotate the X'-, Y''-, and Z'-axes about the Z'-axis by ψ (-π < ψπ), resulting in the X''-, Y'''-, and Z'-axes.

## Algorithm for Rotating Three-Dimensional Cartesian Coordinates Using the Euler Angles Method

The following equations describe how this node rotates three-dimensional Cartesian coordinates using the Euler angles method:

Let Rx(α), Ry(α), and Rz(α) be the rotation matrices of rotating the coordinate system by α angles about the x-, y-, and z-axes, respectively. Rx(α), Ry(α), and Rz(α) are defined as follows:

${R}_{x}\left(\alpha \right)=\left[\begin{array}{ccc}1& 0& 0\\ 0& \mathrm{cos}\alpha & \mathrm{sin}\alpha \\ 0& -\mathrm{sin}\alpha & \mathrm{cos}\alpha \end{array}\right]$
${R}_{y}\left(\alpha \right)=\left[\begin{array}{ccc}\mathrm{cos}\alpha & 0& -\mathrm{sin}\alpha \\ 0& 1& 0\\ \mathrm{sin}\alpha & 0& \mathrm{cos}\alpha \end{array}\right]$
${R}_{z}\left(\alpha \right)=\left[\begin{array}{ccc}\mathrm{cos}\alpha & \mathrm{sin}\alpha & 0\\ -\mathrm{sin}\alpha & \mathrm{cos}\alpha & 0\\ 0& 0& 1\end{array}\right]$

This node calculates the rotated coordinates using the following equation:

$\left[\begin{array}{c}x\prime \\ y\prime \\ z\prime \end{array}\right]=R\left[\begin{array}{c}x\\ y\\ z\end{array}\right]$

where

• x, y, and z are the x-, y-, and z-coordinates before the rotation
• x', y', and z' are the x-, y-, and z-coordinates after the rotation
• $R=\left\{\begin{array}{cc}{R}_{C}\left(\psi \right){R}_{B}\left(\theta \right){R}_{A}\left(\varphi \right)& \mathrm{if}\text{\hspace{0.17em}}\mathrm{rotation type}\text{\hspace{0.17em}}\mathrm{is}\text{\hspace{0.17em}}\mathrm{Passive and Intrinsic}\\ {R}_{A}\left(\varphi \right){R}_{B}\left(\theta \right){R}_{C}\left(\psi \right)& \mathrm{if}\text{\hspace{0.17em}}\mathrm{rotation type}\text{\hspace{0.17em}}\mathrm{is}\text{\hspace{0.17em}}\mathrm{Passive and Extrinsic}\\ {R}_{C}\left(-\psi \right){R}_{B}\left(-\theta \right){R}_{A}\left(-\varphi \right)& \mathrm{if}\text{\hspace{0.17em}}\mathrm{rotation type}\text{\hspace{0.17em}}\mathrm{is}\text{\hspace{0.17em}}\mathrm{Active}\end{array}$

where

• RA, RB, and RC are the rotation matrices of the first, second, and third rotations, respectively. For example, if rotation order is Z-X-Z, RA, RB, and RC correspond to Rz, Rx, and Rz, respectively.
• ϕ (-π < ϕπ), θ (0 ≤ θπ), and ψ (-π < ψπ) are Euler angles.

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices