gov.nist.microanalysis.Utility
Class Transform3D

java.lang.Object
  extended by gov.nist.microanalysis.Utility.Transform3D

public class Transform3D
extends java.lang.Object

A set of static methods for rotating and translating 3D vectors and points by Euler angles.

The rotation matrix is...

[ cos(phi)*cos(th)*cos(psi)-sin(phi)*sin(psi) -sin(phi)*cos(th)*cos(psi)-cos(phi)*sin(psi) sin(th)*cos(psi) ]
[ sin(phi)*cos(psi)+cos(phi)*cos(th)*sin(psi) -sin(phi)*cos(th)*sin(psi)+cos(phi)*cos(psi) sin(th)*sin(psi) ]
[ -cos(phi)*sin(th) sin(th)*sin(phi) cos(th) ]

Copyright: Pursuant to title 17 Section 105 of the United States Code this software is not subject to copyright protection and is in the public domain

Company: National Institute of Standards and Technology

Version:
1.0
Author:
Nicholas W. M. Ritchie

Constructor Summary
Transform3D()
           
 
Method Summary
static double[] rotate(double[] point, double[] pivot, double phi, double theta, double psi)
          rotate - Rotate the specified point about the center point by the Euler angles specified.
static double[] rotate(double[] vector, double phi, double th, double psi)
          rotate - Rotate the specified directional vector by the Euler angles phi, th, psi.
static double[] translate(double[] point, double[] distance, boolean negate)
          translate - Translate the specified point by the specified distance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transform3D

public Transform3D()
Method Detail

rotate

public static double[] rotate(double[] vector,
                              double phi,
                              double th,
                              double psi)
rotate - Rotate the specified directional vector by the Euler angles phi, th, psi. Rotate the object by phi about the z-axis followed by theta round the y-axis followed by psi around the z-axis.

Parameters:
vector - double[]
phi - double
th - double
psi - double
Returns:
double[]

rotate

public static double[] rotate(double[] point,
                              double[] pivot,
                              double phi,
                              double theta,
                              double psi)
rotate - Rotate the specified point about the center point by the Euler angles specified. Rotate the object around the specified point by phi about the z-axis followed by theta round the y-axis followed by psi around the z-axis.

Parameters:
point - double[] - The point to rotate
pivot - double[] - The pivot point
phi - double - Initial rotation about z
theta - double - Second rotation about y
psi - double - Final rotation about z
Returns:
double[] - The result

translate

public static double[] translate(double[] point,
                                 double[] distance,
                                 boolean negate)
translate - Translate the specified point by the specified distance.

Parameters:
point - double[] - The original point
distance - double[] - The offset
negate - - true to translate -distance or false to translate +distance
Returns:
double[] - A new point translated by the specified amount.