Top Description Fields Constructors Methods
com.sun.javafx.geom.transform

public final Class GeneralTransform3D

extends Object
implements CanTransformVec3d
Class Inheritance
All Implemented Interfaces
com.sun.javafx.geom.transform.CanTransformVec3d
Imports
com.sun.javafx.geom.BaseBounds, .Point2D, .Vec3d, .Vec3f

A general-purpose 4x4 transform that may or may not be affine. The GeneralTransform is typically used only for projection transforms.

Field Summary

Modifier and TypeField and Description
private static final double
private boolean
protected double[]
private Vec3d

Constructor Summary

AccessConstructor and Description
public
GeneralTransform3D()

Constructs and initializes a transform to the identity matrix.

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean
almostOne(double a)

pack-priv static boolean
almostZero(double a)

public double
public GeneralTransform3D
copy()

public double

Returns:

the determinant
determinant
()

Computes the determinant of this transform.

public double[]

Returns:

an array of 16 values
get
(double[]
the return value, or null
rv
)

Returns a copy of an array of 16 values that contains the 4x4 matrix of this transform.

public double
get(int index)

public GeneralTransform3D

Returns:

this transform
invert
()

Inverts this transform in place.

private GeneralTransform3D
invert(GeneralTransform3D t1)

General invert routine.

public boolean
isAffine()

Returns true if the transform is affine.

public boolean
isIdentity()

Returns true if the transform is identity.

pack-priv boolean
private static void
luBacksubstitution(double[] matrix1, int[] row_perm, double[] matrix2)

Solves a set of linear equations.

private static boolean

Returns:

true if the matrix is nonsingular, or false otherwise.
luDecomposition
(double[] matrix0, int[] row_perm)

Given a 4x4 array "matrix0", this function replaces it with the LU decomposition of a row-wise permutation of itself.

public GeneralTransform3D

Returns:

this transform
mul
(BaseTransform
the other transform
t1
)

Sets the value of this transform to the result of multiplying itself with transform t1 : this = this * t1.

public GeneralTransform3D

Returns:

this transform
mul
(GeneralTransform3D
the other transform
t1
)

Sets the value of this transform to the result of multiplying itself with transform t1 : this = this * t1.

public GeneralTransform3D

Returns:

this transform
ortho
(double
the vertical line on the left edge of the near clipping plane mapped to the left edge of the graphics window
left
,
double
the vertical line on the right edge of the near clipping plane mapped to the right edge of the graphics window
right
,
double
the horizontal line on the bottom edge of the near clipping plane mapped to the bottom edge of the graphics window
bottom
,
double
the horizontal line on the top edge of the near clipping plane mapped to the top edge of the graphics window
top
,
double
the distance to the frustum's near clipping plane (the value -near is the location of the near clip plane)
near
,
double
the distance to the frustum's far clipping plane
far
)

Sets the value of this transform to an orthographic (parallel) projection transform.

public GeneralTransform3D

Returns:

this transform
perspective
(boolean
specifies whether the fov is vertical (Y direction).
verticalFOV
,
double
specifies the field of view in radians
fov
,
double
specifies the aspect ratio. The aspect ratio is the ratio of width to height.
aspect
,
double
the distance to the frustum's near clipping plane. This value must be positive, (the value -zNear is the location of the near clip plane).
zNear
,
double
the distance to the frustum's far clipping plane
zFar
)

Sets the value of this transform to a perspective projection transform.

public GeneralTransform3D

Returns:

this transform
scale
(double
the X coordinate scale factor
sx
,
double
the Y coordinate scale factor
sy
,
double
the Z coordinate scale factor
sz
)

Sets the value of this transform to the result of multiplying itself with a scale transform:

scaletx =
    [ sx  0  0  0 ]
    [  0 sy  0  0 ]
    [  0  0 sz  0 ]
    [  0  0  0  1 ].
public GeneralTransform3D

Returns:

this transform
set
(GeneralTransform3D
the transform to copy into this transform.
t1
)

Sets the value of this transform to the specified transform.

public GeneralTransform3D

Returns:

this transform
set
(double[]
an array of 16 values to copy into this transform in row major order.
m
)

Sets the matrix values of this transform to the values in the specified array.

public GeneralTransform3D

Returns:

this transform
setIdentity
()

Sets this transform to the identity matrix.

public String

Returns:

the matrix elements of this transform
toString
()

Overrides java.lang.Object.toString.

Returns the matrix elements of this transform as a string.

public BaseBounds
public Point2D
transform(Point2D point, Point2D pointOut)

Transform 2D point (with z == 0)

public Vec3d

Returns:

the transformed point
transform
(Vec3d
the input point to be transformed
point
,
Vec3d
the transformed point
pointOut
)

Implements com.sun.javafx.geom.transform.CanTransformVec3d.transform.

Transforms the point parameter with this transform and places the result into pointOut.

public Vec3d

Returns:

the transformed point
transform
(Vec3d
the input point to be transformed
point
)

Transforms the point parameter with this transform and places the result back into point.

public Vec3f

Returns:

the transformed normal
transformNormal
(Vec3f
the input normal to be transformed
normal
,
Vec3f
the transformed normal
normalOut
)

Transforms the normal parameter by this transform and places the value into normalOut.

public Vec3f

Returns:

the transformed normal
transformNormal
(Vec3f
the input normal to be transformed
normal
)

Transforms the normal parameter by this transform and places the value back into normal.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

EPSILON_ABSOLUTEback to summary
private static final double EPSILON_ABSOLUTE
identityback to summary
private boolean identity
matback to summary
protected double[] mat
tempV3dback to summary
private Vec3d tempV3d

Constructor Detail

GeneralTransform3Dback to summary
public GeneralTransform3D()

Constructs and initializes a transform to the identity matrix.

Method Detail

almostOneback to summary
pack-priv static boolean almostOne(double a)
almostZeroback to summary
pack-priv static boolean almostZero(double a)
computeClipZCoordback to summary
public double computeClipZCoord()
copyback to summary
public GeneralTransform3D copy()
determinantback to summary
public double determinant()

Computes the determinant of this transform.

Returns:double

the determinant

getback to summary
public double[] get(double[] rv)

Returns a copy of an array of 16 values that contains the 4x4 matrix of this transform. The first four elements of the array will contain the top row of the transform matrix, etc.

Parameters
rv:double[]

the return value, or null

Returns:double[]

an array of 16 values

getback to summary
public double get(int index)
invertback to summary
public GeneralTransform3D invert()

Inverts this transform in place.

Returns:GeneralTransform3D

this transform

invertback to summary
private GeneralTransform3D invert(GeneralTransform3D t1)

General invert routine. Inverts t1 and places the result in "this". Note that this routine handles both the "this" version and the non-"this" version. Also note that since this routine is slow anyway, we won't worry about allocating a little bit of garbage.

isAffineback to summary
public boolean isAffine()

Returns true if the transform is affine. A transform is considered to be affine if the last row of its matrix is (0,0,0,1). Note that an instance of AffineTransform3D is always affine.

isIdentityback to summary
public boolean isIdentity()

Returns true if the transform is identity. A transform is considered to be identity if the diagonal elements of its matrix is all 1s otherwise 0s.

isInfOrNaNback to summary
pack-priv boolean isInfOrNaN()
luBacksubstitutionback to summary
private static void luBacksubstitution(double[] matrix1, int[] row_perm, double[] matrix2)

Solves a set of linear equations. The input parameters "matrix1", and "row_perm" come from luDecompostionD4x4 and do not change here. The parameter "matrix2" is a set of column vectors assembled into a 4x4 matrix of floating-point values. The procedure takes each column of "matrix2" in turn and treats it as the right-hand side of the matrix equation Ax = LUx = b. The solution vector replaces the original column of the matrix. If "matrix2" is the identity matrix, the procedure replaces its contents with the inverse of the matrix from which "matrix1" was originally derived.

luDecompositionback to summary
private static boolean luDecomposition(double[] matrix0, int[] row_perm)

Given a 4x4 array "matrix0", this function replaces it with the LU decomposition of a row-wise permutation of itself. The input parameters are "matrix0" and "dimen". The array "matrix0" is also an output parameter. The vector "row_perm[4]" is an output parameter that contains the row permutations resulting from partial pivoting. The output parameter "even_row_xchg" is 1 when the number of row exchanges is even, or -1 otherwise. Assumes data type is always double. This function is similar to luDecomposition, except that it is tuned specifically for 4x4 matrices.

Returns:boolean

true if the matrix is nonsingular, or false otherwise.

mulback to summary
public GeneralTransform3D mul(BaseTransform t1)

Sets the value of this transform to the result of multiplying itself with transform t1 : this = this * t1.

Parameters
t1:BaseTransform

the other transform

Returns:GeneralTransform3D

this transform

mulback to summary
public GeneralTransform3D mul(GeneralTransform3D t1)

Sets the value of this transform to the result of multiplying itself with transform t1 : this = this * t1.

Parameters
t1:GeneralTransform3D

the other transform

Returns:GeneralTransform3D

this transform

orthoback to summary
public GeneralTransform3D ortho(double left, double right, double bottom, double top, double near, double far)

Sets the value of this transform to an orthographic (parallel) projection transform. This transform maps coordinates from Eye Coordinates (EC) to Clipping Coordinates (CC). Note that unlike the similar function in OpenGL, the clipping coordinates generated by the resulting transform are in a right-handed coordinate system.

Parameters
left:double

the vertical line on the left edge of the near clipping plane mapped to the left edge of the graphics window

right:double

the vertical line on the right edge of the near clipping plane mapped to the right edge of the graphics window

bottom:double

the horizontal line on the bottom edge of the near clipping plane mapped to the bottom edge of the graphics window

top:double

the horizontal line on the top edge of the near clipping plane mapped to the top edge of the graphics window

near:double

the distance to the frustum's near clipping plane (the value -near is the location of the near clip plane)

far:double

the distance to the frustum's far clipping plane

Returns:GeneralTransform3D

this transform

perspectiveback to summary
public GeneralTransform3D perspective(boolean verticalFOV, double fov, double aspect, double zNear, double zFar)

Sets the value of this transform to a perspective projection transform. This transform maps points from Eye Coordinates (EC) to Clipping Coordinates (CC). Note that the field of view is specified in radians.

Parameters
verticalFOV:boolean

specifies whether the fov is vertical (Y direction).

fov:double

specifies the field of view in radians

aspect:double

specifies the aspect ratio. The aspect ratio is the ratio of width to height.

zNear:double

the distance to the frustum's near clipping plane. This value must be positive, (the value -zNear is the location of the near clip plane).

zFar:double

the distance to the frustum's far clipping plane

Returns:GeneralTransform3D

this transform

scaleback to summary
public GeneralTransform3D scale(double sx, double sy, double sz)

Sets the value of this transform to the result of multiplying itself with a scale transform:

scaletx =
    [ sx  0  0  0 ]
    [  0 sy  0  0 ]
    [  0  0 sz  0 ]
    [  0  0  0  1 ].
this = this * scaletx.
Parameters
sx:double

the X coordinate scale factor

sy:double

the Y coordinate scale factor

sz:double

the Z coordinate scale factor

Returns:GeneralTransform3D

this transform

setback to summary
public GeneralTransform3D set(GeneralTransform3D t1)

Sets the value of this transform to the specified transform.

Parameters
t1:GeneralTransform3D

the transform to copy into this transform.

Returns:GeneralTransform3D

this transform

setback to summary
public GeneralTransform3D set(double[] m)

Sets the matrix values of this transform to the values in the specified array.

Parameters
m:double[]

an array of 16 values to copy into this transform in row major order.

Returns:GeneralTransform3D

this transform

setIdentityback to summary
public GeneralTransform3D setIdentity()

Sets this transform to the identity matrix.

Returns:GeneralTransform3D

this transform

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the matrix elements of this transform as a string.

Returns:String

the matrix elements of this transform

Annotations
@Override
transformback to summary
public BaseBounds transform(BaseBounds src, BaseBounds dst)
transformback to summary
public Point2D transform(Point2D point, Point2D pointOut)

Transform 2D point (with z == 0)

transformback to summary
public Vec3d transform(Vec3d point, Vec3d pointOut)

Implements com.sun.javafx.geom.transform.CanTransformVec3d.transform.

Transforms the point parameter with this transform and places the result into pointOut. The fourth element of the point input parameter is assumed to be one.

Parameters
point:Vec3d

the input point to be transformed

pointOut:Vec3d

the transformed point

Returns:Vec3d

the transformed point

Annotations
@Override
transformback to summary
public Vec3d transform(Vec3d point)

Transforms the point parameter with this transform and places the result back into point. The fourth element of the point input parameter is assumed to be one.

Parameters
point:Vec3d

the input point to be transformed

Returns:Vec3d

the transformed point

transformNormalback to summary
public Vec3f transformNormal(Vec3f normal, Vec3f normalOut)

Transforms the normal parameter by this transform and places the value into normalOut. The fourth element of the normal is assumed to be zero.

Note

For correct lighting results, if a transform has uneven scaling surface normals should transformed by the inverse transpose of the transform. This the responsibility of the application and is not done automatically by this method.

Parameters
normal:Vec3f

the input normal to be transformed

normalOut:Vec3f

the transformed normal

Returns:Vec3f

the transformed normal

transformNormalback to summary
public Vec3f transformNormal(Vec3f normal)

Transforms the normal parameter by this transform and places the value back into normal. The fourth element of the normal is assumed to be zero.

Note

For correct lighting results, if a transform has uneven scaling surface normals should transformed by the inverse transpose of the transform. This the responsibility of the application and is not done automatically by this method.

Parameters
normal:Vec3f

the input normal to be transformed

Returns:Vec3f

the transformed normal

updateStateback to summary
private void updateState()