com.partnersoft.geometry.xyz
Class XyzAffineTransform

java.lang.Object
  extended by com.partnersoft.geometry.xyz.AbstractXyzTransform
      extended by com.partnersoft.geometry.xyz.XyzAffineTransform
All Implemented Interfaces:
Immutable, XyzTransform

public class XyzAffineTransform
extends AbstractXyzTransform
implements Immutable

A vector matrix affine transform.

See the wikipedia page on Affine Transformation for a full discussion.

Putting matrices aside, here is the math:

 x1 = x0*m00 + y0*m01 + z0*m02 + m03
 y1 = x0*m10 + y0*m11 + z0*m12 + m13
 z1 = x0*m20 + y0*m21 + z0*m22 + m23
 

Copyright 2007 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis, Rich Stepanski, Richard Fay

Constructor Summary
XyzAffineTransform(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23)
          Tedious full constructor.
XyzAffineTransform(XyAffineTransform xyAffineTransform)
           
 
Method Summary
static XyzAffineTransform forIdentity()
          Returns the identity transform.
static XyzAffineTransform forRotationAroundXAxis(XyRotation rotation)
          Returns a transformation matrix that will rotate by the given amount.
static XyzAffineTransform forRotationAroundYAxis(XyRotation rotation)
          Returns a transformation matrix that will rotate by the given amount.
static XyzAffineTransform forRotationAroundZAxis(XyRotation rotation)
          Returns a transformation matrix that will rotate by the given amount.
static XyzAffineTransform forScaling(double scale)
          Returns a transformation matrix that will scale by the given amount in both dimensions.
static XyzAffineTransform forScaling(double m00, double m11, double scaleZ)
          Returns a transformation matrix that will scale by the given amount for each dimension.
static XyzAffineTransform forTranslation(double deltaX, double deltaY, double deltaZ)
          Returns a transformation matrix that will translate by the given amount.
 double getDeterminant()
           
 double getScaleX()
          The x coordinate scaling element (m00) of the transformation matrix.
 double getScaleY()
          The y coordinate scaling element (m11) of the transformation matrix.
 double getScaleZ()
          The z coordinate scaling element (m22) of the transformation matrix.
 double getTranslateX()
          The x coordinate translation element (m03) of the transformation matrix.
 double getTranslateY()
          The y coordinate translation element (m13) of the transformation matrix.
 double getTranslateZ()
          The z coordinate translation element (m23) of the transformation matrix.
 boolean isIdentity()
          True if this is an identity transform.
 XyzAffineTransform multipliedBy(XyzAffineTransform nother)
          Does a matrix multiplication and returns the result.
 XyzAffineTransform rotatedAroundXAxisBy(XyRotation rotation)
          Rotates the transformation matrix by the given amount and returns the result.
 XyzAffineTransform rotatedAroundYAxisBy(XyRotation rotation)
          Rotates the transformation matrix by the given amount and returns the result.
 XyzAffineTransform rotatedAroundZAxisBy(XyRotation rotation)
          Rotates the transformation matrix by the given amount and returns the result.
 XyzAffineTransform scaledBy(double scale)
          Scales the transformation matrix by the given amount and returns the result.
 XyzAffineTransform scaledBy(double scaleX, double scaleY, double scaleZ)
          Scales the transformation matrix by the given amount and returns the result.
protected  XyzPoint transformImp(XyzPoint point)
          Subclasses must implement this to do the actual work of transformation.
 XyzAffineTransform translatedBy(double deltaX, double deltaY, double deltaZ)
          Translates the transformation matrix by the given amount and returns the result.
 
Methods inherited from class com.partnersoft.geometry.xyz.AbstractXyzTransform
transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XyzAffineTransform

public XyzAffineTransform(double m00,
                          double m01,
                          double m02,
                          double m03,
                          double m10,
                          double m11,
                          double m12,
                          double m13,
                          double m20,
                          double m21,
                          double m22,
                          double m23)
Tedious full constructor. Be careful of your parameter order; it is m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23.


XyzAffineTransform

public XyzAffineTransform(XyAffineTransform xyAffineTransform)
Method Detail

forIdentity

public static XyzAffineTransform forIdentity()
Returns the identity transform.


forRotationAroundXAxis

public static XyzAffineTransform forRotationAroundXAxis(XyRotation rotation)
Returns a transformation matrix that will rotate by the given amount.


forRotationAroundYAxis

public static XyzAffineTransform forRotationAroundYAxis(XyRotation rotation)
Returns a transformation matrix that will rotate by the given amount.


forRotationAroundZAxis

public static XyzAffineTransform forRotationAroundZAxis(XyRotation rotation)
Returns a transformation matrix that will rotate by the given amount.


forTranslation

public static XyzAffineTransform forTranslation(double deltaX,
                                                double deltaY,
                                                double deltaZ)
Returns a transformation matrix that will translate by the given amount.


forScaling

public static XyzAffineTransform forScaling(double scale)
Returns a transformation matrix that will scale by the given amount in both dimensions.


forScaling

public static XyzAffineTransform forScaling(double m00,
                                            double m11,
                                            double scaleZ)
Returns a transformation matrix that will scale by the given amount for each dimension.


getDeterminant

public double getDeterminant()

rotatedAroundXAxisBy

public XyzAffineTransform rotatedAroundXAxisBy(XyRotation rotation)
Rotates the transformation matrix by the given amount and returns the result.


rotatedAroundYAxisBy

public XyzAffineTransform rotatedAroundYAxisBy(XyRotation rotation)
Rotates the transformation matrix by the given amount and returns the result.


rotatedAroundZAxisBy

public XyzAffineTransform rotatedAroundZAxisBy(XyRotation rotation)
Rotates the transformation matrix by the given amount and returns the result.


translatedBy

public XyzAffineTransform translatedBy(double deltaX,
                                       double deltaY,
                                       double deltaZ)
Translates the transformation matrix by the given amount and returns the result.


scaledBy

public XyzAffineTransform scaledBy(double scaleX,
                                   double scaleY,
                                   double scaleZ)
Scales the transformation matrix by the given amount and returns the result.


scaledBy

public XyzAffineTransform scaledBy(double scale)
Scales the transformation matrix by the given amount and returns the result.


multipliedBy

public XyzAffineTransform multipliedBy(XyzAffineTransform nother)
Does a matrix multiplication and returns the result.


transformImp

protected XyzPoint transformImp(XyzPoint point)
Description copied from class: AbstractXyzTransform
Subclasses must implement this to do the actual work of transformation. It behaves the same way as #transform(XyPoint), except that you do NOT have to check for identity - that will be done automatically.

Specified by:
transformImp in class AbstractXyzTransform

isIdentity

public boolean isIdentity()
True if this is an identity transform. The identity returns its input unchanged.

Specified by:
isIdentity in interface XyzTransform

getScaleX

public double getScaleX()
The x coordinate scaling element (m00) of the transformation matrix.


getScaleY

public double getScaleY()
The y coordinate scaling element (m11) of the transformation matrix.


getScaleZ

public double getScaleZ()
The z coordinate scaling element (m22) of the transformation matrix.


getTranslateX

public double getTranslateX()
The x coordinate translation element (m03) of the transformation matrix.


getTranslateY

public double getTranslateY()
The y coordinate translation element (m13) of the transformation matrix.


getTranslateZ

public double getTranslateZ()
The z coordinate translation element (m23) of the transformation matrix.