public class AffineTransform3d extends AffineTransform3dBase
[ 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.
Matrix.Partition, Matrix.WriteFormat
Modifier and Type | Field and Description |
---|---|
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.
|
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC
Constructor and Description |
---|
AffineTransform3d()
Creates an AffineTransform3d and initializes it to the identity.
|
AffineTransform3d(AffineTransform3dBase X) |
AffineTransform3d(double[] m)
Constructs using an array representing the 3x4 matrix [A|p] given in row-major format
|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
applyScaling(double sx,
double sy,
double sz)
Scales the columns of A by the specified amounts.
|
AffineTransform3d |
copy()
Creates and returns a copy of this transformer.
|
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
|
void |
setRandom()
Sets the elements of this matrix to uniformly distributed random values in
the range -0.5 (inclusive) to 0.5 (exclusive).
|
void |
setScaling(double sx,
double sy,
double sz)
Sets A to diagonal scaling matrix.
|
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.
|
addTranslation, addTranslation, clone, colSize, epsilonEquals, equals, get, get, getColumn, getColumn, getMatrix, getMatrixComponents, getOffset, getRow, getRow, inverseTransformCovec, inverseTransformPnt, inverseTransformVec, isAffine, isIdentity, isRigid, mul, mul, mul, mulInverse, mulInverse, mulInverse, mulInverseLeft, mulInverseRight, rowSize, set, set, set, setColumn, setIdentity, setRotation, setRotation, setRotation, setRow, setTranslation, setTranslation, transformCovec, transformPnt, transformVec
add, checkConsistency, set, set, set, set, setCCSValues, setColumn, setCRSValues, setRow, setSubMatrix
containsNaN, determinant, epsilonEquals, equals, frobeniusNorm, frobeniusNormSquared, get, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getDefaultFormat, getRow, getSize, getSubMatrix, hasNaN, idString, infinityNorm, isFixedSize, isSymmetric, isWritable, maxNorm, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, scan, scan, setCRSValues, setDefaultFormat, setSize, toString, trace, write, write, write, write, write, write, write, writeToFile
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
determinant, epsilonEquals, equals, frobeniusNorm, frobeniusNormSquared, getCCSIndices, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getCCSValues, getColumn, getCRSIndices, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getCRSValues, getRow, getSize, getSubMatrix, infinityNorm, isFixedSize, isSymmetric, maxNorm, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, scan, setSize, toString, trace, write, write, write
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
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)
public AffineTransform3d(double[] m)
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 transformationpublic boolean mulInverseRight(AffineTransform3dBase X1, AffineTransform3dBase X2)
X1
- left-hand transformationX2
- right-hand transformationpublic boolean mulInverseLeft(AffineTransform3dBase X1, AffineTransform3dBase X2)
X1
- left-hand transformationX2
- right-hand transformationpublic boolean mulInverseBoth(AffineTransform3dBase X1, AffineTransform3dBase X2)
X1
- left-hand transformationX2
- right-hand transformationpublic boolean invert()
invert
in class AffineTransform3dBase
public boolean invert(AffineTransform3dBase X)
X
- transform to invertpublic void set(RigidTransform3d X)
X
- rigid body transform to copypublic void setScaling(double sx, double sy, double sz)
sx
- x scale factorsy
- y scale factorsz
- z scale factorpublic 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 void setRandom()
DenseMatrixBase
setRandom
in class AffineTransform3dBase
public AffineTransform3d copy()
VectorTransformer3d
copy
in interface VectorTransformer3d
copy
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 pointsImproperSizeException
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 scalingImproperSizeException
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}|| <
thresholdpublic Vector3d fitOrthogonal(java.util.ArrayList<Point3d> p, java.util.ArrayList<Point3d> q) throws ImproperSizeException
p
- set of target 3d pointsq
- set of input 3d pointsImproperSizeException
public java.lang.String toString()
toString
in class MatrixBase
MatrixBase.toString(String)
public java.lang.String toString(java.lang.String numberFmtStr)
toString
in interface Matrix
toString
in interface VectorTransformer3d
toString
in class MatrixBase
numberFmtStr
- numeric format string (see NumberFormat
)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