|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.matrix.MatrixBase
maspack.matrix.DenseMatrixBase
maspack.matrix.AffineTransform3dBase
maspack.matrix.AffineTransform3d
public class AffineTransform3d
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
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface maspack.matrix.Matrix |
---|
Matrix.Partition, Matrix.WriteFormat |
Field Summary | |
---|---|
Matrix3d |
A
Matrix component. |
static AffineTransform3d |
IDENTITY
Global identity transform. |
static int |
MATRIX_3X4_STRING
Specifies a string representation of this transformation as a 3 x 4 matrix (i.e., with the 4th row ommitted). |
static int |
MATRIX_4X4_STRING
Specifies a string representation of this transformation as a 4 x 4 matrix. |
Vector3d |
p
Vector component. |
Fields inherited from interface maspack.matrix.Matrix |
---|
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC |
Constructor Summary | |
---|---|
AffineTransform3d()
Creates an AffineTransform3d and initializes it to the identity. |
|
AffineTransform3d(AffineTransform3dBase X)
|
|
AffineTransform3d(double m00,
double m01,
double m02,
double px,
double m10,
double m11,
double m12,
double py,
double m20,
double m21,
double m22,
double pz)
|
|
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. |
AffineTransform3d |
clone()
|
static AffineTransform3d |
createScaling(double s)
Creates an AffineTransform3d which performs uniform scaling along all axes. |
static AffineTransform3d |
createScaling(double sx,
double sy,
double sz)
Creates an AffineTransform3d which performs scaling along the x, y, and z axes. |
void |
factorA(RotationMatrix3d R,
Vector3d scale,
Vector3d shear)
Factors the A matrix of this transformation into rotation, scale, and shear components, so that |
void |
fit(java.util.ArrayList<Point3d> p,
java.util.ArrayList<Point3d> q)
Sets this affine transform to one that provides the best fit of q to p in the least-squares sense: p ~ X q |
Vector3d |
fitOrthogonal(java.util.ArrayList<Point3d> p,
java.util.ArrayList<Point3d> q)
Sets this affine transform to one that provides the best fit of q to p in the least-squares sense: p ~ X q, where X has orthogonal columns, corresponding to a rigid transform with three scale factors (one for each dimension) |
Vector3d |
fitOrthogonal(java.util.ArrayList<Point3d> p,
java.util.ArrayList<Point3d> q,
double threshold)
Sets this affine transform to one that provides the best fit of q to p in the least-squares sense: p ~ X q, where X has orthogonal columns, corresponding to a rigid transform with three scale factors (one for each dimension). |
void |
fitRigid(java.util.ArrayList<Point3d> p,
java.util.ArrayList<Point3d> q,
boolean scale)
Sets this affine transform to one that provides the best fit of q to p in the least-squares sense: p ~ X q, where X is a rigid transformation with a single scale factor |
boolean |
invert()
Inverts this transform in place. |
boolean |
invert(AffineTransform3dBase X)
Inverts transform X and places the result in this transform. |
void |
mul(AffineTransform3dBase X)
Multiplies this transformation transformation X and places the result in this transformation. |
void |
mul(AffineTransform3dBase X1,
AffineTransform3dBase X2)
Multiplies transformation X1 by transformation X2 and places the result in this transformation. |
boolean |
mulInverse(AffineTransform3dBase X)
Multiplies this transformation by the inverse of transformation X and places the result in this transformation. |
boolean |
mulInverseBoth(AffineTransform3dBase X1,
AffineTransform3dBase X2)
Multiplies the inverse of transformation X1 by the inverse of transformation X2 and places the result in this transformation. |
boolean |
mulInverseLeft(AffineTransform3dBase X1,
AffineTransform3dBase X2)
Multiplies the inverse of transformation X1 by transformation X2 and places the result in this transformation. |
boolean |
mulInverseRight(AffineTransform3dBase X1,
AffineTransform3dBase 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. |
void |
setA(RotationMatrix3d R,
Vector3d scale,
Vector3d shear)
Sets the A matrix of this transformation from rotation, scale, and shear components, so that |
java.lang.String |
toString()
Returns a string representation of this transformation as a 4 x 4 matrix. |
java.lang.String |
toString(NumberFormat numberFmt,
int outputCode)
Returns a specified string representation of this transformation, with each number formatted according to the a supplied numeric format. |
java.lang.String |
toString(java.lang.String numberFmtStr)
Returns a string representation of this transformation as a 4 x 4 matrix, with each number formatted according to a supplied numeric format. |
java.lang.String |
toString(java.lang.String numberFmtStr,
int outputCode)
Returns a specified string representation of this transformation, with each number formatted according to the a supplied numeric format. |
Methods inherited from class maspack.matrix.AffineTransform3dBase |
---|
colSize, epsilonEquals, equals, get, get, getColumn, getColumn, getMatrix, getMatrixComponents, getOffset, getRow, getRow, isIdentity, leftRigidFactor, mul, mul, mulInverse, mulInverse, rowSize, set, set, set, setColumn, setIdentity, setRotation, setRotation, setRotation, setRow, setTranslation |
Methods inherited from class maspack.matrix.DenseMatrixBase |
---|
add, checkConsistency, set, set, set, set, setCCSValues, setColumn, setCRSValues, setRow, setSubMatrix |
Methods inherited from class maspack.matrix.MatrixBase |
---|
containsNaN, determinant, epsilonEquals, equals, frobeniusNorm, get, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getDefaultFormat, getRow, getSize, getSubMatrix, hasNaN, idString, infinityNorm, isFixedSize, isSymmetric, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, scan, setCRSValues, setDefaultFormat, setSize, toString, trace, write, write, write, write, write, writeToFile |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface maspack.matrix.Matrix |
---|
determinant, epsilonEquals, equals, frobeniusNorm, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getRow, getSize, getSubMatrix, infinityNorm, isFixedSize, isSymmetric, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, scan, setSize, toString, trace, write, write, write |
Field Detail |
---|
public static final AffineTransform3d IDENTITY
public static final int MATRIX_3X4_STRING
public static final int MATRIX_4X4_STRING
public final Matrix3d A
public final Vector3d p
Constructor Detail |
---|
public AffineTransform3d()
public AffineTransform3d(Matrix3d A, Vector3d p)
A
- value for the A matrixp
- value for the p vectorpublic AffineTransform3d(AffineTransform3dBase X)
public AffineTransform3d(double m00, double m01, double m02, double px, double m10, double m11, double m12, double py, double m20, double m21, double m22, double pz)
Method Detail |
---|
public void mul(AffineTransform3dBase X)
X
- right-hand transformationpublic void mul(AffineTransform3dBase X1, AffineTransform3dBase X2)
X1
- left-hand transformationX2
- right-hand transformationpublic boolean mulInverse(AffineTransform3dBase X)
X
- right-hand transformation
public boolean mulInverseRight(AffineTransform3dBase X1, AffineTransform3dBase X2)
X1
- left-hand transformationX2
- right-hand transformation
public boolean mulInverseLeft(AffineTransform3dBase X1, AffineTransform3dBase X2)
X1
- left-hand transformationX2
- right-hand transformation
public boolean mulInverseBoth(AffineTransform3dBase X1, AffineTransform3dBase X2)
X1
- left-hand transformationX2
- right-hand transformation
public boolean invert()
invert
in class AffineTransform3dBase
public boolean invert(AffineTransform3dBase X)
X
- transform to invert
public void set(RigidTransform3d X)
X
- rigid body transform to copypublic void applyScaling(double sx, double sy, double sz)
sx
- x scale factorsy
- y scale factorsz
- z scale factorpublic void factorA(RotationMatrix3d R, Vector3d scale, Vector3d shear)
A = R S Xwhere R is a right-handed rotation matrix, S is a diagonal scaling matrix, and X is a shear matrix of the form
[ 1 xy xz ] X = [ 0 1 yz ] [ 0 0 1 ]
R
- if non-null, returns the rotation matrixscale
- if non-null, returns the diagonal components of Sshear
- if non-null, returns the components xy, xz, yz of Xpublic void setA(RotationMatrix3d R, Vector3d scale, Vector3d shear)
A = R S Xwhere R is a right-handed rotation matrix, S is a diagonal scaling matrix, and X is a shear matrix of the form
[ 1 xy xz ] X = [ 0 1 yz ] [ 0 0 1 ]
R
- the rotation matrixscale
- diagonal components of Sshear
- components xy, xz, yz of Xpublic static AffineTransform3d createScaling(double sx, double sy, double sz)
sx
- x scale factorsy
- y scale factorsz
- z scale factorpublic static AffineTransform3d createScaling(double s)
s
- scale factorpublic AffineTransform3d clone()
clone
in interface Clonable
clone
in class AffineTransform3dBase
public void fit(java.util.ArrayList<Point3d> p, java.util.ArrayList<Point3d> q) throws ImproperSizeException
p
- set of target 3d pointsq
- set of input 3d points
ImproperSizeException
public void fitRigid(java.util.ArrayList<Point3d> p, java.util.ArrayList<Point3d> q, boolean scale) throws ImproperSizeException
p
- set of target 3d pointsq
- set of input 3d pointsscale
- allow scaling
ImproperSizeException
public Vector3d fitOrthogonal(java.util.ArrayList<Point3d> p, java.util.ArrayList<Point3d> q, double threshold)
p
- set of target 3d pointsq
- set of input 3d pointsthreshold
- algorithm stops when ||s_{i} - s_{i-1}||/||s_{i-1}|| < threshold
public Vector3d fitOrthogonal(java.util.ArrayList<Point3d> p, java.util.ArrayList<Point3d> q) throws ImproperSizeException
p
- set of target 3d pointsq
- set of input 3d points
ImproperSizeException
public java.lang.String toString()
toString
in class MatrixBase
MatrixBase.toString(String)
public java.lang.String toString(java.lang.String numberFmtStr)
toString
in class MatrixBase
numberFmtStr
- numeric format string (see NumberFormat
)
public java.lang.String toString(java.lang.String numberFmtStr, int outputCode)
numberFmtStr
- numeric format string (see NumberFormat
)outputCode
- desired representation, which should be either
MATRIX_4X4_STRING
, or
MATRIX_3X4_STRING
public java.lang.String toString(NumberFormat numberFmt, int outputCode)
numberFmt
- numeric formatoutputCode
- desired representation, which should be either
MATRIX_4X4_STRING
, or
MATRIX_3X4_STRING
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |