Skip to main content
U.S. flag

An official website of the United States government

Here’s how you know

Official government website icon

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

icon-https

Secure .gov websites use HTTPS
A lock ( Lock Locked padlock icon )or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

NIH: National Institute of Diabetes and Digestive and Kidney Diseases NIH: National Institute of Diabetes and Digestive and Kidney Diseases

  next up previous contents index  Xplor-NIH home Documentation

Next: Symbols Up: X-PLOR Language Previous: Three-dimensional Vectors


3$\times $3 Matrices

The matrix construct allows one to specify a 3$\times $3 real matrix. There are several modes available to specify rotation matrices. An arbitrary 3$\times $3 matrix can be specified by using the MATRix construct. Note: all rotations are counterclockwise.
$<$matrix$>$:==
AXIS $<$vector$>$ $<$real$>$
specifies input through the axis vector and the rotation angle $\kappa$.
EULEr $<$vector$>$
specifies input through the Eulerian angles $\theta_1$,$\theta_2$,$\theta_3$. $\theta_1$ is the rotation around the z axis, $\theta_2$ around the new x axis, and $\theta_3$ around the new z axis.
LATTman $<$vector$>$
specifies input through Lattman's angles ( $\theta_+=\theta_1+\theta_3$, $\theta_2$, $\theta_-=\theta_1- \theta_3$).
MATRix $<$vector$>$ $<$vector$>$ $<$vector$>$
specifies direct input of the matrix by three 3d-vectors.
QUATernions
$<$real$>$ $<$real$>$ $<$real$>$ $<$real$>$ specifies quaternions $q_0$, $q_1$, $q_2$, $q_3$, which are defined as
$\displaystyle q_0$ $\textstyle =$ $\displaystyle cos({\theta_2 \over 2})cos({{\theta_1+\theta_3} \over 2})$  
$\displaystyle q_1$ $\textstyle =$ $\displaystyle sin({\theta_2 \over 2})cos({{\theta_1-\theta_3} \over 2})$  
$\displaystyle q_2$ $\textstyle =$ $\displaystyle sin({\theta_2 \over 2})sin({{\theta_1-\theta_3} \over 2})$  
$\displaystyle q_3$ $\textstyle =$ $\displaystyle cos({\theta_2 \over 2})sin({{\theta_1+\theta_3} \over 2})$ (2.1)

with the constraint
\begin{displaymath}
q^2_{0}+q^2_{1}+q^2_{2}+q^2_{3}=1
\end{displaymath} (2.2)

SPHErical $<$vector$>$
specifies input through spherical polar angles $\psi$, $\phi$, $\kappa$. $\psi$ and $\phi$ specify the rotation axis. $\psi$ is the inclination versus the y-axis; $\phi$ is the azimuthal angle, i.e., the angle between the x-axis and the projection of the axis into the x,z plane; and $\kappa$ is the rotation around the rotation axis.

In the following example, a rotation matrix is specified by a rotation axis (2,3,4) and a rotation angle (40$^{\circ}$) around the axis (counterclockwise rotation):

AXIS=( 2, 3, 4 )  40.

In the next example, a matrix is specified by direct input:

MATRix=( 1. 3. 5. )
       ( 4. 2. 1. )
       ( 2. 1. 8. )

The last example shows how to specify a rotation matrix by using the Eulerian angles $\theta_1$,$\theta_2$,$\theta_3$:

EULEr=( 30. 40. 120. )


next up previous contents index
Next: Symbols Up: X-PLOR Language Previous: Three-dimensional Vectors   Contents   Index
Xplor-NIH 2025-03-21
  • Privacy Policy
  • Freedom of Information Act
  • Accessibility
  • Disclaimers
  • Copyright
  • Vulnerability Disclosure Policy
  • U.S. Department of Health and Human Services
  • National Institutes of Health