public class Affine3DHelpers extends Object
AffineTransform3D
. Note that most of these helpers assume additional
restrictions on the affine transform.Constructor and Description |
---|
Affine3DHelpers() |
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(AffineTransform3D t1,
AffineTransform3D t2)
Compare two transforms for equality.
|
static void |
extractApproximateRotationAffine(AffineTransform3D transform,
double[] q,
int coerceAffineDimension)
Extract a rotation from a general
AffineTransform3D . |
static void |
extractRotation(AffineTransform3D transform,
double[] q)
Extract the rotation part of a similarity transform stored in a
AffineTransform3D . |
static void |
extractRotationAnisotropic(AffineTransform3D transform,
double[] q)
Extract the rotation from an
AffineTransform3D comprising
anisotropic scaling, rotation, and translation. |
static double |
extractScale(AffineTransform3D transform,
int axis)
Get the scale factor along the X, Y, or Z axis.
|
static String |
toString(AffineTransform3D transform)
Pretty-print the matrix content of an affine transform.
|
public static void extractRotation(AffineTransform3D transform, double[] q)
AffineTransform3D
.transform
- assumed to be a similarity transform (isotropic scaling +
rotation + translation).q
- rotation will be stored as a quaternion here.public static void extractRotationAnisotropic(AffineTransform3D transform, double[] q)
AffineTransform3D
comprising
anisotropic scaling, rotation, and translation.transform
- assumed to comprise anisotropic scaling, followed by rotation
and translation.q
- rotation will be stored as a quaternion here.public static void extractApproximateRotationAffine(AffineTransform3D transform, double[] q, int coerceAffineDimension)
AffineTransform3D
. Because the
affine can comprise shearing which is not purely due to anisotropic
scaling, there is no unique rotation to extract. The rotation is computed
in the following way: The (X, Y, Z) unit axis are transformed
and scaled to unit length. The resulting transformed unit vectors
(X', Y', Z') are not necessarily pairwise orthogonal. We find
unit vectors (X'', Y'', Z'') to form an orthogonal basis as
follows: The axis specified by the coerceAffineDimension
parameter is computed to be orthogonal to the remaining two. Assuming
coerceAffineDimension=2
, we would set Z'' = X' x Y'
. The next axis (right handed axis order) after the coerced one is
maintained, in this case X'' = X'. Finally the last axis is made
perpendicular, Y'' = Z'' x X''. The rotation that takes
(X, Y, Z) to (X'', Y'', Z'') is returned. The effect is
that the plane spanned by the two non-coerced axes (if
coerceAffineDimension=2
, the XY plane) will be transformed
to the same plane by the computed rotation and the "rotation part" of
transform
.transform
- assumed to comprise anisotropic scaling, followed by rotation
and translation.q
- rotation will be stored as a quaternion here.coerceAffineDimension
- the plane spanned by the remaining two axes (if
coerceAffineDimension=2
, the XY plane) will be
transformed to the same plane by the computed rotation and the
"rotation part" of transform
.public static double extractScale(AffineTransform3D transform, int axis)
transform
- an affine transform.axis
- index of the axis for which the scale factor should be
computed.public static boolean equals(AffineTransform3D t1, AffineTransform3D t2)
true
iff t1
and t2
are exactly the samepublic static final String toString(AffineTransform3D transform)
transform
- the transform to print.Copyright © 2015–2021 Fiji. All rights reserved.