org.opensourcephysics.sip.ch17
Class Affine3DMatrix

java.lang.Object
  extended by org.opensourcephysics.sip.ch17.Affine3DMatrix
All Implemented Interfaces:
java.lang.Cloneable, Transformation

public class Affine3DMatrix
extends java.lang.Object
implements Transformation

Affine3DMatrix implements 3D affine transformations using a matrix representation.


Constructor Summary
Affine3DMatrix(double[][] matrix)
          Constructs a 3D affine transformation using the given matrix.
 
Method Summary
 java.lang.Object clone()
          Provides a copy of this transformation.
 double[] direct(double[] point)
          Transforms the given point.
 double[] inverse(double[] point)
          Transforms the given point using the inverse transformation (if it exists).
static Affine3DMatrix Rotation(double theta, double[] axis)
          Creates an AffineMatrix representing a rotation about the origin by some angle around the given axis.
static Affine3DMatrix Translation(double dx, double dy, double dz)
          Creates an AffineMatrix representing a translation.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Affine3DMatrix

public Affine3DMatrix(double[][] matrix)
Constructs a 3D affine transformation using the given matrix. Affine transformations can be applied to 3D or homogeneous 3D coordinates. A 3 by 3 matrix sets the rotation and shear portion of the transformation. A 4 by 4 matrix sets rotation, shear, and translation. A null matrix sets the transformation to the identity transformation.

Parameters:
mat - double[][]
Method Detail

Rotation

public static Affine3DMatrix Rotation(double theta,
                                      double[] axis)
Creates an AffineMatrix representing a rotation about the origin by some angle around the given axis.

Parameters:
theta - double
axis - double[]
Returns:
AffineMatrix

Translation

public static Affine3DMatrix Translation(double dx,
                                         double dy,
                                         double dz)
Creates an AffineMatrix representing a translation.

Parameters:
theta - double
axis - double[]
Returns:
AffineMatrix

clone

public java.lang.Object clone()
Provides a copy of this transformation.

Specified by:
clone in interface Transformation
Overrides:
clone in class java.lang.Object

direct

public double[] direct(double[] point)
Transforms the given point.

Specified by:
direct in interface Transformation
Parameters:
point - the coordinates to be transformed
Returns:
double[] the transformed vector (i.e. point)

inverse

public double[] inverse(double[] point)
                 throws java.lang.UnsupportedOperationException
Transforms the given point using the inverse transformation (if it exists). If the transformation is not invertible, then a call to this method must throw a UnsupportedOperationException exception.

Specified by:
inverse in interface Transformation
Parameters:
point - the coordinates to be transformed
Returns:
double[] the transformed vector (i.e. point)
Throws:
java.lang.UnsupportedOperationException - If the transformation is not invertible