public final class GeneralTransform3D extends java.lang.Object implements CanTransformVec3d
Modifier and Type | Field and Description |
---|---|
private static double |
EPSILON_ABSOLUTE |
private boolean |
identity |
protected double[] |
mat |
private Vec3d |
tempV3d |
Constructor and Description |
---|
GeneralTransform3D()
Constructs and initializes a transform to the identity matrix.
|
Modifier and Type | Method and Description |
---|---|
(package private) static boolean |
almostOne(double a) |
(package private) static boolean |
almostZero(double a) |
double |
computeClipZCoord() |
GeneralTransform3D |
copy() |
double |
determinant()
Computes the determinant of this transform.
|
double[] |
get(double[] rv)
Returns a copy of an array of 16 values that contains the 4x4 matrix
of this transform.
|
double |
get(int index) |
GeneralTransform3D |
invert()
Inverts this transform in place.
|
private GeneralTransform3D |
invert(GeneralTransform3D t1)
General invert routine.
|
boolean |
isAffine()
Returns true if the transform is affine.
|
boolean |
isIdentity()
Returns true if the transform is identity.
|
(package private) boolean |
isInfOrNaN() |
private static void |
luBacksubstitution(double[] matrix1,
int[] row_perm,
double[] matrix2)
Solves a set of linear equations.
|
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.
|
GeneralTransform3D |
mul(BaseTransform t1)
Sets the value of this transform to the result of multiplying itself
with transform t1 : this = this * t1.
|
GeneralTransform3D |
mul(GeneralTransform3D t1)
Sets the value of this transform to the result of multiplying itself
with transform t1 : this = this * t1.
|
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.
|
GeneralTransform3D |
perspective(boolean verticalFOV,
double fov,
double aspect,
double zNear,
double zFar)
Sets the value of this transform to a perspective projection transform.
|
GeneralTransform3D |
scale(double sx,
double sy,
double sz)
Sets the value of this transform to the result of multiplying itself
with a scale transform:
|
GeneralTransform3D |
set(double[] m)
Sets the matrix values of this transform to the values in the
specified array.
|
GeneralTransform3D |
set(GeneralTransform3D t1)
Sets the value of this transform to the specified transform.
|
GeneralTransform3D |
setIdentity()
Sets this transform to the identity matrix.
|
java.lang.String |
toString()
Returns the matrix elements of this transform as a string.
|
BaseBounds |
transform(BaseBounds src,
BaseBounds dst) |
Point2D |
transform(Point2D point,
Point2D pointOut)
Transform 2D point (with z == 0)
|
Vec3d |
transform(Vec3d point)
Transforms the point parameter with this transform and
places the result back into point.
|
Vec3d |
transform(Vec3d point,
Vec3d pointOut)
Transforms the point parameter with this transform and
places the result into pointOut.
|
Vec3f |
transformNormal(Vec3f normal)
Transforms the normal parameter by this transform and places the value
back into normal.
|
Vec3f |
transformNormal(Vec3f normal,
Vec3f normalOut)
Transforms the normal parameter by this transform and places the value
into normalOut.
|
private void |
updateState() |
protected double[] mat
private boolean identity
private Vec3d tempV3d
private static final double EPSILON_ABSOLUTE
public GeneralTransform3D()
public boolean isAffine()
public GeneralTransform3D set(GeneralTransform3D t1)
t1
- the transform to copy into this transform.public GeneralTransform3D set(double[] m)
m
- an array of 16 values to copy into this transform in
row major order.public double[] get(double[] rv)
rv
- the return value, or nullpublic double get(int index)
public BaseBounds transform(BaseBounds src, BaseBounds dst)
public Point2D transform(Point2D point, Point2D pointOut)
point
- pointOut
- public Vec3d transform(Vec3d point, Vec3d pointOut)
transform
in interface CanTransformVec3d
point
- the input point to be transformedpointOut
- the transformed pointpublic Vec3d transform(Vec3d point)
point
- the input point to be transformedpublic Vec3f transformNormal(Vec3f normal, Vec3f normalOut)
normal
- the input normal to be transformednormalOut
- the transformed normalpublic Vec3f transformNormal(Vec3f normal)
normal
- the input normal to be transformedpublic GeneralTransform3D perspective(boolean verticalFOV, double fov, double aspect, double zNear, double zFar)
verticalFOV
- specifies whether the fov is vertical (Y direction).fov
- specifies the field of view in radiansaspect
- specifies the aspect ratio. The aspect ratio is the ratio
of width to height.zNear
- 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
- the distance to the frustum's far clipping planepublic GeneralTransform3D ortho(double left, double right, double bottom, double top, double near, double far)
left
- the vertical line on the left edge of the near
clipping plane mapped to the left edge of the graphics windowright
- the vertical line on the right edge of the near
clipping plane mapped to the right edge of the graphics windowbottom
- the horizontal line on the bottom edge of the near
clipping plane mapped to the bottom edge of the graphics windowtop
- the horizontal line on the top edge of the near
clipping plane mapped to the top edge of the graphics windownear
- the distance to the frustum's near clipping plane
(the value -near is the location of the near clip plane)far
- the distance to the frustum's far clipping planepublic double computeClipZCoord()
public double determinant()
public GeneralTransform3D invert()
private GeneralTransform3D invert(GeneralTransform3D t1)
private static boolean luDecomposition(double[] matrix0, int[] row_perm)
private static void luBacksubstitution(double[] matrix1, int[] row_perm, double[] matrix2)
public GeneralTransform3D mul(BaseTransform t1)
t1
- the other transformpublic GeneralTransform3D scale(double sx, double sy, double sz)
scaletx = [ sx 0 0 0 ] [ 0 sy 0 0 ] [ 0 0 sz 0 ] [ 0 0 0 1 ]. this = this * scaletx.
sx
- the X coordinate scale factorsy
- the Y coordinate scale factorsz
- the Z coordinate scale factorpublic GeneralTransform3D mul(GeneralTransform3D t1)
t1
- the other transformpublic GeneralTransform3D setIdentity()
public boolean isIdentity()
private void updateState()
boolean isInfOrNaN()
static boolean almostZero(double a)
static boolean almostOne(double a)
public GeneralTransform3D copy()
public java.lang.String toString()
toString
in class java.lang.Object