maspack.matrix
Class AffineTransform3d

java.lang.Object
  extended bymaspack.matrix.MatrixObject
      extended bymaspack.matrix.AffineTransform3dObject
          extended bymaspack.matrix.AffineTransform3d
All Implemented Interfaces:
java.io.Serializable

public class AffineTransform3d
extends AffineTransform3dObject

A 4 x 4 matrix which implements general 3D affine transformations. The matrix has the specific form

     [  A   p  ]
 M = [         ]
     [  0   1  ]
 
where A is a 3 x 3 matrix and p is a 3-vector. In homogeneous coordinates, this implements an affine transform of the form
A v + b

In this class, the fields A and p are exposed, and users can manipulate them as desired. This allows us to minimize the number of methds in the AffineTransform3d class itself.

See Also:
Serialized Form

Field Summary
 Matrix3d A
          Matrix component.
 Vector3d p
          Vector component.
 
Constructor Summary
AffineTransform3d()
          Creates an AffineTransform3d and initializes it to the identity.
AffineTransform3d(Matrix3d A, Vector3d p)
          Creates an AffineTransform3d and initializes its components to the specified values.
 
Method Summary
 void applyScaling(double sx, double sy, double sz)
          Scales the columns of A by the specified amounts.
 boolean invert()
          Inverts this transform in place.
 boolean invert(AffineTransform3dObject X)
          Inverts transform X and places the result in this transform.
 void mul(AffineTransform3dObject X)
          Multiplies this transformation transformation X and places the result in this transformation.
 void mul(AffineTransform3dObject X1, AffineTransform3dObject X2)
          Multiplies transformation X1 by transformation X2 and places the result in this transformation.
 boolean mulInverse(AffineTransform3dObject X)
          Multiplies this transformation by the inverse of transformation X and places the result in this transformation.
 boolean mulInverseBoth(AffineTransform3dObject X1, AffineTransform3dObject X2)
          Multiplies the inverse of transformation X1 by the inverse of transformation X2 and places the result in this transformation.
 boolean mulInverseLeft(AffineTransform3dObject X1, AffineTransform3dObject X2)
          Multiplies the inverse of transformation X1 by transformation X2 and places the result in this transformation.
 boolean mulInverseRight(AffineTransform3dObject X1, AffineTransform3dObject X2)
          Multiplies transformation X1 by the inverse of transformation X2 and places the result in this transformation.
 void set(RigidTransform3d X)
          Sets this affine transform to the rigid body transform described by X.
 
Methods inherited from class maspack.matrix.AffineTransform3dObject
colSize, epsilonEquals, equals, get, get, getColumn, getMatrix, getOffset, getRow, mul, mul, mulInverse, mulInverse, rowSize, set, set, setColumn, setIdentity, setRotation, setRotation, setRotation, setRow, setTranslation
 
Methods inherited from class maspack.matrix.MatrixObject
determinant, epsilonEquals, equals, equals, frobeniusNorm, get, getColumn, getRow, infinityNorm, isFixedSize, oneNorm, scan, set, set, setColumn, setRow, setSize, toString, toString, toString
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

A

public final Matrix3d A
Matrix component.


p

public final Vector3d p
Vector component.

Constructor Detail

AffineTransform3d

public AffineTransform3d()
Creates an AffineTransform3d and initializes it to the identity.


AffineTransform3d

public AffineTransform3d(Matrix3d A,
                         Vector3d p)
Creates an AffineTransform3d and initializes its components to the specified values.

Parameters:
A - value for the A matrix
p - value for the p vector
Method Detail

mul

public void mul(AffineTransform3dObject X)
Multiplies this transformation transformation X and places the result in this transformation.

Parameters:
X - right-hand transformation

mul

public void mul(AffineTransform3dObject X1,
                AffineTransform3dObject X2)
Multiplies transformation X1 by transformation X2 and places the result in this transformation.

Parameters:
X1 - left-hand transformation
X2 - right-hand transformation

mulInverse

public boolean mulInverse(AffineTransform3dObject X)
Multiplies this transformation by the inverse of transformation X and places the result in this transformation.

Parameters:
X - right-hand transformation
Returns:
false if X is singular

mulInverseRight

public boolean mulInverseRight(AffineTransform3dObject X1,
                               AffineTransform3dObject X2)
Multiplies transformation X1 by the inverse of transformation X2 and places the result in this transformation.

Parameters:
X1 - left-hand transformation
X2 - right-hand transformation
Returns:
false if X2 is singular

mulInverseLeft

public boolean mulInverseLeft(AffineTransform3dObject X1,
                              AffineTransform3dObject X2)
Multiplies the inverse of transformation X1 by transformation X2 and places the result in this transformation.

Parameters:
X1 - left-hand transformation
X2 - right-hand transformation
Returns:
false if X1 is singular

mulInverseBoth

public boolean mulInverseBoth(AffineTransform3dObject X1,
                              AffineTransform3dObject X2)
Multiplies the inverse of transformation X1 by the inverse of transformation X2 and places the result in this transformation.

Parameters:
X1 - left-hand transformation
X2 - right-hand transformation
Returns:
false if either X1 or X2 is singular

invert

public boolean invert()
Inverts this transform in place.

Overrides:
invert in class AffineTransform3dObject
Returns:
false if this transform is singular

invert

public boolean invert(AffineTransform3dObject X)
Inverts transform X and places the result in this transform.

Parameters:
X - transform to invert
Returns:
false if transform X is singular

set

public void set(RigidTransform3d X)
Sets this affine transform to the rigid body transform described by X.

Parameters:
X - rigid body transform to copy

applyScaling

public void applyScaling(double sx,
                         double sy,
                         double sz)
Scales the columns of A by the specified amounts. This is equivalent to post-multiplying A by a diagonal matrix. Note that the resulting scaling effect with be in addition to any previous scaling effect.

Parameters:
sx - x scale factor
sy - y scale factor
sz - z scale factor