|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.media.j3d.Transform3D
com.xinapse.geom3d.AffineTransform3D
public class AffineTransform3D
The AffineTransform3D class represents a 3D affine transform that performs a linear mapping from 3D coordinates to other 3D coordinates that preserves the "straightness" and "parallelness" of lines. Affine transformations can be constructed using sequences of translations, scales, flips, rotations, and shears.
Such a coordinate transformation can be represented by a 4 row by 4 column matrix with an implied last row of [ 0 0 0 1 ]. This matrix transforms source coordinates (x, y, z) into destination coordinates (x', y', z') by considering them to be a column vector and multiplying the coordinate vector by the matrix according to the following process:
[ x'] [ m00 m01 m02 m03 ] [ x ] [ m00x + m01y + m02z + m03 ] [ y'] = [ m10 m11 m12 m13 ] [ y ] = [ m10x + m11y + m12z + m13 ] [ z'] = [ m20 m21 m22 m23 ] [ z ] [ m20x + m21y + m22z + m23 ] [ 1 ] [ 0 0 0 1 ] [ 1 ] [ 1 ]
| Field Summary |
|---|
| Fields inherited from class javax.media.j3d.Transform3D |
|---|
AFFINE, CONGRUENT, IDENTITY, NEGATIVE_DETERMINANT, ORTHOGONAL, RIGID, SCALE, TRANSLATION, ZERO |
| Constructor Summary | |
|---|---|
AffineTransform3D()
Constructs and initializes a transform to the identity matrix. |
|
AffineTransform3D(float[] matrix)
Constructs and initializes a transform from the float array of length 12; the top row of the matrix is initialized to the first four elements of the array, and so on. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Creates and returns a copy of this AffineTransform3D. |
void |
get12(float[] matrix)
Sets the matrix values of this transform to the matrix values in the single precision array parameter. |
static void |
main(java.lang.String[] args)
Runs the self-test for AffineTransform3D. |
void |
set12(float[] matrix)
Sets the matrix values of this transform to the matrix values in the single precision array parameter. |
java.lang.String |
toPrintString()
Returns a java.lang.String suitable for printing out this AffineTransform3D in a form suitable for later parsing. |
java.lang.String |
toString()
Returns a String that represents the value of this Object. |
void |
transform(float[] ptSrc,
float[] ptDst)
Transforms an array of (x,y,z) locations by this transform. |
float[] |
transform(int nX,
int nY,
int nZ,
float pixelXSize,
float pixelYSize,
float pixelZSize,
float[] dst)
Transforms a set of points by this transform. |
void |
transform(javax.vecmath.Point3f[] ptSrc,
int srcOff,
javax.vecmath.Point3f[] ptDst,
int dstOff,
int numPts)
Transforms an array of point objects by this transform. |
| Methods inherited from class javax.media.j3d.Transform3D |
|---|
add, add, determinant, epsilonEquals, equals, equals, frustum, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, get, getAutoNormalize, getBestType, getDeterminantSign, getRotationScale, getRotationScale, getScale, getScale, getType, hashCode, invert, invert, lookAt, mul, mul, mul, mul, mulInverse, mulInverse, mulTransposeBoth, mulTransposeLeft, mulTransposeRight, normalize, normalize, normalizeCP, normalizeCP, ortho, perspective, rotX, rotY, rotZ, scaleAdd, scaleAdd, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setAutoNormalize, setEuler, setIdentity, setNonUniformScale, setRotation, setRotation, setRotation, setRotation, setRotation, setRotation, setRotationScale, setRotationScale, setScale, setScale, setTranslation, setTranslation, setZero, sub, sub, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform, transpose, transpose |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public AffineTransform3D()
public AffineTransform3D(float[] matrix)
matrix - a float array of 12.| Method Detail |
|---|
public void get12(float[] matrix)
matrix - the single precision array of length 12 in row major format.public void set12(float[] matrix)
matrix - the single precision array of length 12 in row major format.
public void transform(javax.vecmath.Point3f[] ptSrc,
int srcOff,
javax.vecmath.Point3f[] ptDst,
int dstOff,
int numPts)
Note that this method does not take any precautions to avoid problems caused by storing results into Point3f objects that will be used as the source for calculations further down the source array. This method does guarantee that if a specified Point3f object is both the source and destination for the same single point transform operation then the results will not be stored until the calculations are complete to avoid storing the results on top of the operands. If, however, the destination Point3f object for one operation is the same object as the source Point3f object for another operation further down the source array then the original coordinates in that point are overwritten before they can be converted.
ptSrc - the array containing the source point objectsptDst - the array into which the transform point objects are
returned.srcOff - the offset to the first point object to be
transformed in the source array.dstOff - the offset to the location of the first
transformed point object that is stored in the destination array.numPts - the number of point objects to be transformed.
public void transform(float[] ptSrc,
float[] ptDst)
Note that this method does not take any precautions to avoid problems caused by storing results that will be used as the source for calculations further down the source array. This method does guarantee that if a specified array is is both the source and destination for the same single point transform operation then the results will not be stored until the calculations are complete to avoid storing the results on top of the operands. If, however, the destination for one operation is the same object as the source for another operation further down the source array then the original coordinates in that point are overwritten before they can be converted.
ptSrc - the array containing the points in order x,y,z for point 1;
x,y,z for point 2 etc.ptDst - the array into which the transformed points are
returned.
public float[] transform(int nX,
int nY,
int nZ,
float pixelXSize,
float pixelYSize,
float pixelZSize,
float[] dst)
dst - an array large enough to hold the x, y and z coordinates of the transformed points
(i.e., nX * nY * nZ * 3). If dst is null, a new array is created.public java.lang.String toString()
Object.
toString in class javax.media.j3d.Transform3Dpublic java.lang.String toPrintString()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||