maspack.matrix
Class AffineTransform2d

java.lang.Object
  extended bymaspack.matrix.MatrixObject
      extended bymaspack.matrix.AffineTransform2dObject
          extended bymaspack.matrix.AffineTransform2d

public class AffineTransform2d
extends AffineTransform2dObject

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

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


Field Summary
 Matrix2d A
          Matrix component.
 Vector2d p
          Vector component.
 
Constructor Summary
AffineTransform2d()
          Creates an AffineTransform2d and initializes it to the identity.
AffineTransform2d(Vector2d p, Matrix2d A)
          Creates an AffineTransform2d and initializes its components to the specified values.
 
Method Summary
 boolean invert()
          Inverts this transform in place.
 boolean invert(AffineTransform2dObject X)
          Inverts transform X and places the result in this transform.
 void mul(AffineTransform2dObject X)
          Multiplies this transformation transformation X and places the result in this transformation.
 void mul(AffineTransform2dObject X1, AffineTransform2dObject X2)
          Multiplies transformation X1 by transformation X2 and places the result in this transformation.
 boolean mulInverse(AffineTransform2dObject X)
          Multiplies this transformation by the inverse of transformation X and places the result in this transformation.
 boolean mulInverseBoth(AffineTransform2dObject X1, AffineTransform2dObject X2)
          Multiplies the inverse of transformation X1 by the inverse of transformation X2 and places the result in this transformation.
 boolean mulInverseLeft(AffineTransform2dObject X1, AffineTransform2dObject X2)
          Multiplies the inverse of transformation X1 by transformation X2 and places the result in this transformation.
 boolean mulInverseRight(AffineTransform2dObject X1, AffineTransform2dObject X2)
          Multiplies transformation X1 by the inverse of transformation X2 and places the result in this transformation.
 void set(RigidTransform2d X)
          Sets this affine transform to the rigid body transform described by X.
 
Methods inherited from class maspack.matrix.AffineTransform2dObject
colSize, epsilonEquals, equals, get, get, getColumn, getRow, mul, mul, mulInverse, mulInverse, rowSize, set, set, setColumn, setIdentity, setRow
 
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 Matrix2d A
Matrix component.


p

public final Vector2d p
Vector component.

Constructor Detail

AffineTransform2d

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


AffineTransform2d

public AffineTransform2d(Vector2d p,
                         Matrix2d A)
Creates an AffineTransform2d 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(AffineTransform2dObject X)
Multiplies this transformation transformation X and places the result in this transformation.

Parameters:
X - right-hand transformation

mul

public void mul(AffineTransform2dObject X1,
                AffineTransform2dObject 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(AffineTransform2dObject 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(AffineTransform2dObject X1,
                               AffineTransform2dObject 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(AffineTransform2dObject X1,
                              AffineTransform2dObject 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(AffineTransform2dObject X1,
                              AffineTransform2dObject 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 AffineTransform2dObject
Returns:
false if this transform is singular

invert

public boolean invert(AffineTransform2dObject 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(RigidTransform2d X)
Sets this affine transform to the rigid body transform described by X.

Overrides:
set in class AffineTransform2dObject
Parameters:
X - rigid body transform to copy