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

Rotates a three-dimensional Cartesian coordinate in the counterclockwise direction using the direction 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

## rotation matrix

3-by-3 direction angle or direction cosine matrix.

If rotation matrix type is Direction Cosines, each element in the rotation matrix must be in the range of [-1, 1].

## rotation matrix type

Type of the rotation matrix.

Name Value Description
Direction Angles 0 The rotation matrix contains the direction angles, or the angles between the x-, y-, and z-axes, and the line segments from the origin to the input coordinates.
Direction Cosines 1 The rotation matrix contains the direction cosines, or the cosines of the direction angles.

Default: Direction Angles

## 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.

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

The following equation describes how this node rotates three-dimensional Cartesian coordinates using the direction method:

$\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 is the rotation matrix you specify in rotation matrix if rotation matrix type is Direction Cosines. If rotation matrix type is Direction Angles, $R=\left[\begin{array}{ccc}\mathrm{cos}{\alpha }_{1}& \mathrm{cos}{\beta }_{1}& \mathrm{cos}{\gamma }_{1}\\ \mathrm{cos}{\alpha }_{2}& \mathrm{cos}{\beta }_{2}& \mathrm{cos}{\gamma }_{2}\\ \mathrm{cos}{\alpha }_{3}& \mathrm{cos}{\beta }_{3}& \mathrm{cos}{\gamma }_{3}\end{array}\right]$

where

• α 1, β 1, and γ 1 are the direction angles of the x'-axis to the x-, y-, and z-axes
• α 2, β 2, and γ 2 are the direction angles of the y'-axis to the x-, y-, and z-axes
• α 3, β 3, and γ 3 are the direction angles of the z'-axis to the x-, y-, and z-axes

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application