public class AffineTransformer extends GeometryTransformer
[ p' ] [ p ] [ F pf ] [ ] = X [ ], X = [ ] [ 1 ] [ 1 ] [ 0 1 ]where F is a general 3 X 3 matrix and pf is an offset vector.
GeometryTransformer.Constrainer, GeometryTransformer.UndoState, GeometryTransformer.UniformScalingConstrainer
Constructor and Description |
---|
AffineTransformer(AffineTransform3d X)
Creates a new AffineTransformer from a specified affine transform.
|
Modifier and Type | Method and Description |
---|---|
void |
computeLocalTransforms(Matrix3d PL,
Vector3d Ndiag,
RigidTransform3d T)
Computes the matrices
PL and N that transform
points xl local to a coordinate frame T after
that frame is itself transformed. |
void |
computeTransform(AffineTransform3d XR,
AffineTransform3d X)
Transforms an affine transform
X and returns the result in
XR . |
void |
computeTransform(Matrix3d MR,
Matrix3d M,
Vector3d r)
Transforms a general 3 X 3 matrix
M and returns the result
in MR . |
void |
computeTransform(Plane pr,
Plane p,
Vector3d r)
Transforms a plane
p and returns the result in pr . |
void |
computeTransform(RotationMatrix3d RR,
Vector3d Ndiag,
RotationMatrix3d R,
Vector3d r)
Transforms a rotation matrix
R and returns the result in
RR . |
void |
computeTransformNormal(Vector3d nr,
Vector3d n,
Vector3d r)
Transforms a normal vector
n , and returns the result in
nr . |
void |
computeTransformPnt(Point3d pr,
Point3d p)
Transforms a point
p and returns the result in
pr . |
void |
computeTransformVec(Vector3d vr,
Vector3d v,
Vector3d r)
Transforms a vector
v , and returns the result in
vr . |
AffineTransformer |
getInverse()
Returns a transformer that implements the inverse operation of this
transformer.
|
boolean |
isAffine()
Returns
true , since this transformer does implement a
linear affine transform. |
boolean |
isInvertible()
Returns
true , since this transformer is invertible. |
boolean |
isReflecting()
Returns
true if this transformer is reflecting. |
boolean |
isRigid()
Returns
false , since this transformer does not implement a
linear rigid transform. |
computeLinearizedTransform, computeLocalAffineTransform, computeTransform, create, getUndoDataSize, isRestoring, isSaving, popRestoreData, restoreObject, saveObject, setUndoState, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transformNormal, transformNormal, transformPnt, transformPnt, transformVec, transformVec, transformWorld, transformWorld
public AffineTransformer(AffineTransform3d X)
X
- affine transform defining the transformationpublic boolean isRigid()
false
, since this transformer does not implement a
linear rigid transform.isRigid
in class GeometryTransformer
public boolean isAffine()
true
, since this transformer does implement a
linear affine transform.isAffine
in class GeometryTransformer
public boolean isReflecting()
true
if this transformer is reflecting.isReflecting
in class GeometryTransformer
public boolean isInvertible()
true
, since this transformer is invertible.isInvertible
in class GeometryTransformer
public AffineTransformer getInverse()
getInverse
in class GeometryTransformer
public void computeTransformPnt(Point3d pr, Point3d p)
p
and returns the result in
pr
. The transform is computed according to
pr = F p + pfThis method provides the low level implementation for point transformations and does not do any saving or restoring of data.
computeTransformPnt
in class GeometryTransformer
pr
- transformed pointp
- point to be transformedpublic void computeTransformVec(Vector3d vr, Vector3d v, Vector3d r)
v
, and returns the result in
vr
.
The reference position r
is ignored since affine transforms
are position invariant.
The transform is computed according to
vr = F vThis method provides the low level implementation for vector transformations and does not do any saving or restoring of data.
computeTransformVec
in class GeometryTransformer
vr
- transformed vectorv
- vector to be transformedr
- reference position of the vector (ignored)public void computeLocalTransforms(Matrix3d PL, Vector3d Ndiag, RigidTransform3d T)
PL
and N
that transform
points xl
local to a coordinate frame T
after
that frame is itself transformed. The updated local coordinates are
given by
xl' = N PL xlwhere
PL
is symmetric positive definite and
N
is a diagonal matrix that is either the identity,
or a reflection that flips a single axis. See the documentation
for GeometryTransformer.computeLocalTransforms(maspack.matrix.Matrix3d, maspack.matrix.Vector3d, maspack.matrix.RigidTransform3d)
.
The quantities F
and f(p)
described there correspond to F
and
pf
for this transformer.computeLocalTransforms
in class GeometryTransformer
PL
- primary transformation matrixNdiag
- if non-null, returns the diagonal components of NT
- rigid transform for which the local transforms are computedpublic void computeTransformNormal(Vector3d nr, Vector3d n, Vector3d r)
n
, and returns the result in
nr
.
The reference position r
is ignored since affine transforms
are position invariant.
The transform is computed according to
-1 T nr = F nThe result is not normalized since the unnormalized form could be useful in some contexts. This method provides the low level implementation for normal transformations and does not do any saving or restoring of data.
computeTransformNormal
in class GeometryTransformer
nr
- transformed normaln
- normal to be transformedr
- reference position of the normal (ignored)public void computeTransform(AffineTransform3d XR, AffineTransform3d X)
X
and returns the result in
XR
. If
[ A p ] X = [ ] [ 0 1 ]the transform is computed according to
[ F A F p + pf ] XR = [ ] [ 0 1 ]This method provides the low level implementation for the transformation of affine transforms and does not do any saving or restoring of data.
computeTransform
in class GeometryTransformer
XR
- transformed transformX
- transform to be transformedpublic void computeTransform(RotationMatrix3d RR, Vector3d Ndiag, RotationMatrix3d R, Vector3d r)
R
and returns the result in
RR
. The reference position r
is ignored since
affine transforms are position invariant. This transform takes the form
RR = Q R Nwhere
Q
is the orthogonal matrix from the left polar
decomposition F = P Q
, and N
is matrix that
flips an axis to ensure that Q R N
remains right-handed.
For additional details, see the documentation for transform(RR,R,r)
.
This method provides the low level implementation for the transformation
of rotation matrices and does not do any saving or restoring of data.computeTransform
in class GeometryTransformer
RR
- transformed rotationR
- rotation to be transformedr
- reference position of the rotation (ignored)Ndiag
- if non-null, returns the diagonal elements of the
matrix N
public void computeTransform(Matrix3d MR, Matrix3d M, Vector3d r)
M
and returns the result
in MR
.
The reference position r
is ignored since affine transforms
are position invariant.
The transform is computed according to
MR = F MThis method provides the low level implementation for the transformation of 3 X 3 matrices and does not do any saving or restoring of data.
computeTransform
in class GeometryTransformer
MR
- transformed matrixM
- matrix to be transformedr
- reference position of the matrix (ignored)public void computeTransform(Plane pr, Plane p, Vector3d r)
p
and returns the result in pr
.
The reference position r
is ignored since affine transforms
are position invariant.
Assume that p
is defined by a normal n
and offset o
such that all planar points x
satisfy
n^T x = oThen the transformed normal
nr
and offset or
are computed according to
nr = inv(F)^T n or = o + nr^T pf mag = ||nr|| nr = nr/mag, or = or/magThis method provides the low level implementation for the transformation of planes and does not do any saving or restoring of data.
computeTransform
in class GeometryTransformer
pr
- transformed planep
- plane to be transformedr
- reference position of the plane (ignored)