public class Affine3D extends AffineBase
BaseTransform.Degree| Modifier and Type | Field and Description |
|---|---|
private double |
mxz |
private double |
myz |
private double |
mzt |
private double |
mzx |
private double |
mzy |
private double |
mzz |
APPLY_2D_DELTA_MASK, APPLY_2D_MASK, APPLY_3D, APPLY_IDENTITY, APPLY_SCALE, APPLY_SHEAR, APPLY_TRANSLATE, HI_3D, HI_IDENTITY, HI_SCALE, HI_SHEAR, HI_SHIFT, HI_TRANSLATE, mxt, mxx, mxy, myt, myx, myy, state, typeEPSILON_ABSOLUTE, IDENTITY_TRANSFORM, TYPE_AFFINE_3D, TYPE_AFFINE2D_MASK, TYPE_FLIP, TYPE_GENERAL_ROTATION, TYPE_GENERAL_SCALE, TYPE_GENERAL_TRANSFORM, TYPE_IDENTITY, TYPE_MASK_ROTATION, TYPE_MASK_SCALE, TYPE_QUADRANT_ROTATION, TYPE_TRANSLATION, TYPE_UNIFORM_SCALE, TYPE_UNKNOWN| Constructor and Description |
|---|
Affine3D() |
Affine3D(Affine3D other) |
Affine3D(BaseTransform transform) |
Affine3D(double mxx,
double mxy,
double mxz,
double mxt,
double myx,
double myy,
double myz,
double myt,
double mzx,
double mzy,
double mzz,
double mzt) |
| Modifier and Type | Method and Description |
|---|---|
private static double |
_matround(double matval) |
(package private) static boolean |
almostOne(double a) |
void |
concatenate(BaseTransform transform)
Concatenates a
BaseTransform Tx to
this Affine2D Cx in the most commonly useful
way to provide a new user space
that is mapped to the former user space by Tx. |
void |
concatenate(double Txx,
double Txy,
double Txz,
double Txt,
double Tyx,
double Tyy,
double Tyz,
double Tyt,
double Tzx,
double Tzy,
double Tzz,
double Tzt) |
BaseTransform |
copy() |
BaseTransform |
createInverse()
This function always returns a new object, unless the transform
is an identity transform in which case it might return the
Identity singleton. |
Vec3d |
deltaTransform(Vec3d src,
Vec3d dst)
Transforms the specified
src vector and stores the result
in dst vector, without applying the translation elements. |
Affine3D |
deriveWithConcatenation(BaseTransform transform) |
Affine3D |
deriveWithConcatenation(double Txx,
double Tyx,
double Txy,
double Tyy,
double Txt,
double Tyt) |
BaseTransform |
deriveWithConcatenation(double mxx,
double mxy,
double mxz,
double mxt,
double myx,
double myy,
double myz,
double myt,
double mzx,
double mzy,
double mzz,
double mzt) |
Affine3D |
deriveWithNewTransform(BaseTransform tx) |
Affine3D |
deriveWithPreConcatenation(BaseTransform transform) |
Affine3D |
deriveWithPreTranslation(double mxt,
double myt) |
BaseTransform |
deriveWithRotation(double theta,
double axisX,
double axisY,
double axisZ) |
BaseTransform |
deriveWithScale(double mxx,
double myy,
double mzz) |
Affine3D |
deriveWithTranslation(double tx,
double ty) |
BaseTransform |
deriveWithTranslation(double mxt,
double myt,
double mzt) |
BaseTransform.Degree |
getDegree() |
double |
getDeterminant()
Returns the determinant of the matrix representation of the transform.
|
double |
getMxz() |
double |
getMyz() |
double |
getMzt() |
double |
getMzx() |
double |
getMzy() |
double |
getMzz() |
void |
inverseDeltaTransform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
Inverse transforms an array of single precision relative coordinates by
this transform.
|
Vec3d |
inverseDeltaTransform(Vec3d src,
Vec3d dst)
Inverse transforms the specified
src vector and stores the
result in dst vector (without applying the translation
elements). |
BaseBounds |
inverseTransform(BaseBounds bounds,
BaseBounds result) |
void |
inverseTransform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
Inverse transforms an array of double precision coordinates by
this transform.
|
void |
inverseTransform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
Inverse transforms an array of single precision coordinates by
this transform.
|
Point2D |
inverseTransform(Point2D src,
Point2D dst)
Inverse transforms the specified
ptSrc and stores the
result in ptDst. |
void |
inverseTransform(Rectangle bounds,
Rectangle result) |
Vec3d |
inverseTransform(Vec3d src,
Vec3d dst)
Inverse transforms the specified
src and stores the
result in dst. |
void |
invert()
Sets this transform to the inverse of itself.
|
Affine3D |
lookAt(Vec3d eye,
Vec3d center,
Vec3d up)
Sets this transform to a viewing transform computed from the specified
eye point, center point, and up vector.
|
private double |
minor(int row,
int col) |
void |
preConcatenate(BaseTransform transform) |
void |
preTranslate(double mxt,
double myt,
double mzt) |
protected void |
reset3Delements()
Resets the 3D (Z) components of the matrix to identity settings
(if they are present).
|
void |
restoreTransform(double mxx,
double myx,
double mxy,
double myy,
double mxt,
double myt)
This function is only guaranteed to succeed if the transform is
of degree AFFINE2D or less and the matrix
parameters specified came from this same instance.
|
void |
restoreTransform(double mxx,
double mxy,
double mxz,
double mxt,
double myx,
double myy,
double myz,
double myt,
double mzx,
double mzy,
double mzz,
double mzt)
This function is only guaranteed to succeed if the matrix
parameters specified came from this same instance.
|
void |
rotate(double theta)
Concatenates this transform with a rotation transformation.
|
void |
rotate(double theta,
double axisX,
double axisY,
double axisZ) |
void |
scale(double sx,
double sy)
Concatenates this transform with a scaling transformation.
|
void |
scale(double sx,
double sy,
double sz) |
void |
setToRotation(double theta,
double axisX,
double axisY,
double axisZ) |
void |
setToRotation(double theta,
double axisX,
double axisY,
double axisZ,
double pivotX,
double pivotY,
double pivotZ) |
void |
setToScale(double sx,
double sy,
double sz) |
void |
setToTranslation(double tx,
double ty,
double tz) |
void |
setTransform(BaseTransform transform) |
void |
setTransform(double mxx,
double mxy,
double mxz,
double mxt,
double myx,
double myy,
double myz,
double myt,
double mzx,
double mzy,
double mzz,
double mzt) |
void |
shear(double shx,
double shy)
Concatenates this transform with a shearing transformation.
|
java.lang.String |
toString()
Returns a
String that represents the value of this
Object. |
BaseBounds |
transform(BaseBounds src,
BaseBounds dst) |
Vec3d |
transform(Vec3d src,
Vec3d dst) |
void |
translate(double tx,
double ty)
Concatenates this transform with a translation transformation.
|
void |
translate(double tx,
double ty,
double tz) |
protected void |
updateState()
Manually recalculates the state of the transform when the matrix
changes too much to predict the effects on the state.
|
calculateType, concatenate, createTransformedShape, deltaTransform, deltaTransform, getMxt, getMxx, getMxy, getMyt, getMyx, getMyy, getType, is2D, isIdentity, isTranslateOrIdentity, rotate180, rotate270, rotate90, setToIdentity, setToShear, setTransform, stateError, transform, transform, transform, transform, transform, transform, transform, updateState2DalmostZero, degreeError, equals, getInstance, getInstance, getInstance, getRotateInstance, getScaleInstance, getTranslateInstance, hashCode, makePointprivate double mxz
private double myz
private double mzx
private double mzy
private double mzz
private double mzt
public Affine3D()
public Affine3D(BaseTransform transform)
public Affine3D(double mxx,
double mxy,
double mxz,
double mxt,
double myx,
double myy,
double myz,
double myt,
double mzx,
double mzy,
double mzz,
double mzt)
public Affine3D(Affine3D other)
public BaseTransform copy()
copy in class BaseTransformpublic BaseTransform.Degree getDegree()
getDegree in class BaseTransformprotected void reset3Delements()
AffineBasereset3Delements in class AffineBaseprotected void updateState()
AffineBase
SCALE SHEAR TRANSLATE
m00/m11 m01/m10 m02/m12
IDENTITY 1.0 0.0 0.0
TRANSLATE (TR) 1.0 0.0 not both 0.0
SCALE (SC) not both 1.0 0.0 0.0
TR | SC not both 1.0 0.0 not both 0.0
SHEAR (SH) 0.0 not both 0.0 0.0
TR | SH 0.0 not both 0.0 not both 0.0
SC | SH not both 0.0 not both 0.0 0.0
TR | SC | SH not both 0.0 not both 0.0 not both 0.0
updateState in class AffineBasepublic double getMxz()
getMxz in class BaseTransformpublic double getMyz()
getMyz in class BaseTransformpublic double getMzx()
getMzx in class BaseTransformpublic double getMzy()
getMzy in class BaseTransformpublic double getMzz()
getMzz in class BaseTransformpublic double getMzt()
getMzt in class BaseTransformpublic double getDeterminant()
AffineBase
If the determinant is non-zero, then this transform is
invertible and the various methods that depend on the inverse
transform do not need to throw a
NoninvertibleTransformException.
If the determinant is zero then this transform can not be
inverted since the transform maps all input coordinates onto
a line or a point.
If the determinant is near enough to zero then inverse transform
operations might not carry enough precision to produce meaningful
results.
If this transform represents a uniform scale, as indicated by
the getType method then the determinant also
represents the square of the uniform scale factor by which all of
the points are expanded from or contracted towards the origin.
If this transform represents a non-uniform scale or more general
transform then the determinant is not likely to represent a
value useful for any purpose other than determining if inverse
transforms are possible.
Mathematically, the determinant is calculated using the formula:
| mxx mxy mxt |
| myx myy myt | = mxx * myy - mxy * myx
| 0 0 1 |
getDeterminant in class AffineBaseAffineBase.getType(),
BaseTransform.createInverse(),
AffineBase.inverseTransform(com.sun.javafx.geom.Point2D, com.sun.javafx.geom.Point2D),
BaseTransform.TYPE_UNIFORM_SCALEpublic void setTransform(BaseTransform transform)
setTransform in class BaseTransformpublic void setTransform(double mxx,
double mxy,
double mxz,
double mxt,
double myx,
double myy,
double myz,
double myt,
double mzx,
double mzy,
double mzz,
double mzt)
public void setToTranslation(double tx,
double ty,
double tz)
public void setToScale(double sx,
double sy,
double sz)
public void setToRotation(double theta,
double axisX,
double axisY,
double axisZ,
double pivotX,
double pivotY,
double pivotZ)
public void setToRotation(double theta,
double axisX,
double axisY,
double axisZ)
public BaseBounds transform(BaseBounds src, BaseBounds dst)
transform in class AffineBasepublic Vec3d transform(Vec3d src, Vec3d dst)
transform in interface CanTransformVec3dtransform in class AffineBasepublic Vec3d deltaTransform(Vec3d src, Vec3d dst)
AffineBasesrc vector and stores the result
in dst vector, without applying the translation elements.
If dst is null, a new Vec3d
object is allocated and then the result of the transformation is
stored in this object.
In either case, dst, which contains the
transformed vector, is returned for convenience.
If src and dst are the same
object, the input vector is correctly overwritten with
the transformed vector.deltaTransform in class AffineBasesrc - the specified Vec3d to be transformeddst - the specified Vec3d that stores the
result of transforming srcdst vector after transforming
src and storing the result in dst.public void inverseTransform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
throws NoninvertibleTransformException
AffineBase[x0, y0, x1, y1, ..., xn, yn].inverseTransform in class AffineBasesrcPts - the array containing the source point coordinates.
Each point is stored as a pair of x, y coordinates.srcOff - the offset to the first point to be transformed
in the source arraydstPts - the array into which the transformed point
coordinates are returned. Each point is stored as a pair of
x, y coordinates.dstOff - the offset to the location of the first
transformed point that is stored in the destination arraynumPts - the number of point objects to be transformedNoninvertibleTransformException - if the matrix cannot be
inverted.public void inverseDeltaTransform(float[] srcPts,
int srcOff,
float[] dstPts,
int dstOff,
int numPts)
throws NoninvertibleTransformException
AffineBase[x0, y0, x1, y1, ..., xn, yn].inverseDeltaTransform in class AffineBasesrcPts - the array containing the relative source coordinates.
Each point is stored as a pair of x, y coordinates.srcOff - the offset to the first point to be transformed
in the source arraydstPts - the array into which the relative transformed point
coordinates are returned. Each point is stored as a pair of
x, y coordinates.dstOff - the offset to the location of the first
transformed point that is stored in the destination arraynumPts - the number of point objects to be transformedNoninvertibleTransformException - if the matrix cannot be
inverted.public void inverseTransform(double[] srcPts,
int srcOff,
double[] dstPts,
int dstOff,
int numPts)
throws NoninvertibleTransformException
AffineBase[x0, y0, x1, y1, ..., xn, yn].inverseTransform in class AffineBasesrcPts - the array containing the source point coordinates.
Each point is stored as a pair of x, y coordinates.srcOff - the offset to the first point to be transformed
in the source arraydstPts - the array into which the transformed point
coordinates are returned. Each point is stored as a pair of
x, y coordinates.dstOff - the offset to the location of the first
transformed point that is stored in the destination arraynumPts - the number of point objects to be transformedNoninvertibleTransformException - if the matrix cannot be
inverted.public Point2D inverseTransform(Point2D src, Point2D dst) throws NoninvertibleTransformException
AffineBaseptSrc and stores the
result in ptDst.
If ptDst is null, a new
Point2D object is allocated and then the result of the
transform is stored in this object.
In either case, ptDst, which contains the transformed
point, is returned for convenience.
If ptSrc and ptDst are the same
object, the input point is correctly overwritten with the
transformed point.inverseTransform in class AffineBasesrc - the point to be inverse transformeddst - the resulting transformed pointptDst, which contains the result of the
inverse transform.NoninvertibleTransformException - if the matrix cannot be
inverted.public Vec3d inverseTransform(Vec3d src, Vec3d dst) throws NoninvertibleTransformException
AffineBasesrc and stores the
result in dst.
If dst is null, a new
Vec3d object is allocated and then the result of the
transform is stored in this object.
In either case, dst, which contains the transformed
point, is returned for convenience.
If src and dst are the same
object, the input point is correctly overwritten with the
transformed point.inverseTransform in class AffineBasesrc - the point to be inverse transformeddst - the resulting transformed pointdst, which contains the result of the
inverse transform.NoninvertibleTransformException - if the matrix cannot be
inverted.public Vec3d inverseDeltaTransform(Vec3d src, Vec3d dst) throws NoninvertibleTransformException
AffineBasesrc vector and stores the
result in dst vector (without applying the translation
elements).
If dst is null, a new
Vec3d object is allocated and then the result of the
transform is stored in this object.
In either case, dst, which contains the transformed
vector, is returned for convenience.
If src and dst are the same
object, the input vector is correctly overwritten with the
transformed vector.inverseDeltaTransform in class AffineBasesrc - the vector to be inverse transformeddst - the resulting transformed vectordst, which contains the result of the
inverse transform.NoninvertibleTransformException - if the matrix cannot be
inverted.public BaseBounds inverseTransform(BaseBounds bounds, BaseBounds result) throws NoninvertibleTransformException
inverseTransform in class AffineBaseNoninvertibleTransformExceptionpublic void inverseTransform(Rectangle bounds, Rectangle result) throws NoninvertibleTransformException
inverseTransform in class AffineBaseNoninvertibleTransformExceptionpublic BaseTransform createInverse() throws NoninvertibleTransformException
BaseTransformIdentity singleton.createInverse in class BaseTransformNoninvertibleTransformExceptionpublic void invert()
throws NoninvertibleTransformException
AffineBase
If this transform maps all coordinates onto a point or a line
then it will not have an inverse, since coordinates that do
not lie on the destination point or line will not have an inverse
mapping.
The getDeterminant method can be used to determine if this
transform has no inverse, in which case an exception will be
thrown if the invert method is called.
invert in class AffineBaseNoninvertibleTransformException - if the matrix cannot be inverted.AffineBase.getDeterminant()private double minor(int row,
int col)
public Affine3D deriveWithNewTransform(BaseTransform tx)
deriveWithNewTransform in class BaseTransformpublic Affine3D deriveWithTranslation(double tx, double ty)
deriveWithTranslation in class BaseTransformpublic void translate(double tx,
double ty)
AffineBaseAffine2D represented by the following matrix:
[ 1 0 tx ]
[ 0 1 ty ]
[ 0 0 1 ]
translate in class AffineBasetx - the distance by which coordinates are translated in the
X axis directionty - the distance by which coordinates are translated in the
Y axis directionpublic void translate(double tx,
double ty,
double tz)
public Affine3D deriveWithPreTranslation(double mxt, double myt)
deriveWithPreTranslation in class BaseTransformpublic BaseTransform deriveWithTranslation(double mxt, double myt, double mzt)
deriveWithTranslation in class BaseTransformpublic BaseTransform deriveWithScale(double mxx, double myy, double mzz)
deriveWithScale in class BaseTransformpublic BaseTransform deriveWithRotation(double theta, double axisX, double axisY, double axisZ)
deriveWithRotation in class BaseTransformpublic void preTranslate(double mxt,
double myt,
double mzt)
public void scale(double sx,
double sy)
AffineBaseAffine2D represented by the following matrix:
[ sx 0 0 ]
[ 0 sy 0 ]
[ 0 0 1 ]
scale in class AffineBasesx - the factor by which coordinates are scaled along the
X axis directionsy - the factor by which coordinates are scaled along the
Y axis directionpublic void scale(double sx,
double sy,
double sz)
public void rotate(double theta)
AffineBaseAffine2D represented by the following matrix:
[ cos(theta) -sin(theta) 0 ]
[ sin(theta) cos(theta) 0 ]
[ 0 0 1 ]
Rotating by a positive angle theta rotates points on the positive
X axis toward the positive Y axis.
Note also the discussion of
Handling 90-Degree Rotations
above.rotate in class AffineBasetheta - the angle of rotation measured in radianspublic void rotate(double theta,
double axisX,
double axisY,
double axisZ)
public void shear(double shx,
double shy)
AffineBaseAffine2D represented by the following matrix:
[ 1 shx 0 ]
[ shy 1 0 ]
[ 0 0 1 ]
shear in class AffineBaseshx - the multiplier by which coordinates are shifted in the
direction of the positive X axis as a factor of their Y coordinateshy - the multiplier by which coordinates are shifted in the
direction of the positive Y axis as a factor of their X coordinatepublic Affine3D deriveWithConcatenation(BaseTransform transform)
deriveWithConcatenation in class BaseTransformpublic Affine3D deriveWithPreConcatenation(BaseTransform transform)
deriveWithPreConcatenation in class BaseTransformpublic void concatenate(BaseTransform transform)
AffineBaseBaseTransform Tx to
this Affine2D Cx in the most commonly useful
way to provide a new user space
that is mapped to the former user space by Tx.
Cx is updated to perform the combined transformation.
Transforming a point p by the updated transform Cx' is
equivalent to first transforming p by Tx and then
transforming the result by the original transform Cx like this:
Cx'(p) = Cx(Tx(p))
In matrix notation, if this transform Cx is
represented by the matrix [this] and Tx is represented
by the matrix [Tx] then this method does the following:
[this] = [this] x [Tx]
concatenate in class AffineBasetransform - the BaseTransform object to be
concatenated with this Affine2D object.#preConcatenatepublic void concatenate(double Txx,
double Txy,
double Txz,
double Txt,
double Tyx,
double Tyy,
double Tyz,
double Tyt,
double Tzx,
double Tzy,
double Tzz,
double Tzt)
public Affine3D deriveWithConcatenation(double Txx, double Tyx, double Txy, double Tyy, double Txt, double Tyt)
deriveWithConcatenation in class BaseTransformpublic BaseTransform deriveWithConcatenation(double mxx, double mxy, double mxz, double mxt, double myx, double myy, double myz, double myt, double mzx, double mzy, double mzz, double mzt)
deriveWithConcatenation in class BaseTransformpublic void preConcatenate(BaseTransform transform)
public void restoreTransform(double mxx,
double myx,
double mxy,
double myy,
double mxt,
double myt)
BaseTransformrestoreTransform in class BaseTransformpublic void restoreTransform(double mxx,
double mxy,
double mxz,
double mxt,
double myx,
double myy,
double myz,
double myt,
double mzx,
double mzy,
double mzz,
double mzt)
BaseTransformrestoreTransform in class BaseTransformpublic Affine3D lookAt(Vec3d eye, Vec3d center, Vec3d up)
eye - the eye pointcenter - the center pointup - the up vectorstatic boolean almostOne(double a)
private static double _matround(double matval)
public java.lang.String toString()
String that represents the value of this
Object.toString in class BaseTransformString representing the value of this
Object.