Class l3d.L3DMath
All Packages Class Hierarchy This Package Previous Next Index
Class l3d.L3DMath
java.lang.Object
|
+----l3d.L3DMath
- public final class L3DMath
- extends Object
Live3D Math Library utility
GENERAL NOTES:
Unless otherwise noted: Methods return 1 (true) or 0 (false)
ALL vector float arrays are three-value arrays
ALL matrix float arrays are 16-value arrays
THE FOLLOWING CODES APPLY TO EACH METHOD LISTED:
GOOD = Method has been implemented and tested
AVAIL = Method has been implemented but not tested
NYA = Method has not been implemented.
-
POSTCONCATENATE
-
-
PRECONCATENATE
- Variables for matrix combine operations
-
REPLACE
-
-
addVector(float[], float[], float[])
-
-
addVectorF(Float[], Float[], Float[])
- Adds two vectors
GOOD
-
crossProduct(float[], float[], float[])
-
-
crossProductF(Float[], Float[], Float[])
- Calculates the cross product of two vectors
GOOD
-
dotProduct(float[], float[], float[])
-
-
dotProductF(Float[], Float[], Float[])
- Calculates the dot product of two vectors
GOOD
-
getRotateMatrix(float[], float[], float)
-
-
getRotateMatrixF(Float[], Float[], Float)
- Retrieves the rotation component from a matrix comprising only rotations and translations.
-
identityMatrix(float[])
-
-
identityMatrixF(Float[])
- Sets the matrix to the identity matrix
GOOD
-
invertMatrix(float[], float[])
-
-
invertMatrixF(Float[], Float[])
- Inverts matrix source and stores the result in matrix destination
GOOD
-
multiplyMatrix(float[], float[], float[])
-
-
multiplyMatrixF(Float[], Float[], Float[])
- Multiplies two matrices together
GOOD
-
normalize(float[])
-
-
normalizeF(Float[])
- Normalizes a vector to unit length while retaining the ratio between its
X, Y, and Z components
GOOD
-
orthoNormalizeMatrix(float[], float[])
-
-
orthoNormalizeMatrixF(Float[], Float[])
- Ortho-normalizes the source matrix and places the result in the destination matrix
GOOD
-
rotateMatrix(float[], float, float, float, float, int)
-
-
rotateMatrixCos(float[], float, float, float, float, float, int)
-
-
rotateMatrixCosF(Float[], Float, Float, Float, Float, Float, int)
- Builds a rotation matrix and applies it to matrix,
The angle of rotation is given by the cosine of the angle
(cosangle) and a direction of rotation (rotdir), The operation
may be a pre-concatenation, post-concatenation, or replacement
GOOD
-
rotateMatrixF(Float[], Float, Float, Float, Float, int)
- Builds a rotation matrix and applies it to matrix,
The operation may be a pre-concatenation, post-concatenation, or replacement
GOOD
-
scaleMatrix(float[], float, float, float, int)
-
-
scaleMatrixF(Float[], Float, Float, Float, int)
- Builds a scaling matrix and applies it to matrix,
The operation may be a pre-concatenation, post-concatenation, or replacement
GOOD
-
scaleVector(float[], float, float[])
-
-
scaleVectorF(Float[], Float, Float[])
- Scales a vector
GOOD
-
transformMatrix(float[], float[], int)
-
-
transformMatrixF(Float[], Float[], int)
- Applies the transformation matrix source to matrix dest
GOOD
-
transformPoint(float[], float[], float[])
-
-
transformPointF(Float[], Float[], Float[])
- Applies a transformation matrix to a point
GOOD
-
transformVector(float[], float[], float[])
-
-
transformVectorF(Float[], Float[], Float[])
- Applies a transformation matrix to a vector.
-
translateMatrix(float[], float, float, float, int)
-
-
translateMatrixF(Float[], Float, Float, Float, int)
- Builds a translation matrix and applies it to matrix, The operation
may be a pre-concatenation, post-concatenation, or replacement
GOOD
PRECONCATENATE
public final int PRECONCATENATE
- Variables for matrix combine operations
POSTCONCATENATE
public final int POSTCONCATENATE
REPLACE
public final int REPLACE
addVector
public static int addVector(float v1[],
float v2[],
float v3[])
addVectorF
public static int addVectorF(Float v1[],
Float v2[],
Float v3[])
- Adds two vectors
GOOD
- Parameters:
- v1 - First vector array to add
- v2 - Second vector array to add
- v3 - null float array to receive vector calculation result
- Returns:
- v3 resultant vector array
crossProduct
public static int crossProduct(float v1[],
float v2[],
float v3[])
crossProductF
public static int crossProductF(Float v1[],
Float v2[],
Float v3[])
- Calculates the cross product of two vectors
GOOD
- Parameters:
- v1 - First vector array
- v2 - Second vector array
- v3 - null float array to receive vector calculation result
- Returns:
- v3 resultant vector array
dotProduct
public static int dotProduct(float v1[],
float v2[],
float v3[])
dotProductF
public static int dotProductF(Float v1[],
Float v2[],
Float v3[])
- Calculates the dot product of two vectors
GOOD
- Parameters:
- v1 - First vector array
- v2 - Second vector array
- v3 - null float array to receive vector calculation result
- Returns:
- v3 resultant vector array
normalize
public static int normalize(float vector[])
normalizeF
public static int normalizeF(Float vector[])
- Normalizes a vector to unit length while retaining the ratio between its
X, Y, and Z components
GOOD
- Parameters:
- vector - the vector array to normalize
scaleVector
public static int scaleVector(float v1[],
float scale,
float v2[])
scaleVectorF
public static int scaleVectorF(Float v1[],
Float scale,
Float v2[])
- Scales a vector
GOOD
- Parameters:
- v1 - Vector array
- scale - scale factor
- v2 - null float array to receive vector calculation result
- Returns:
- v2 resultant vector array
transformPoint
public static int transformPoint(float v1[],
float matrix[],
float v2[])
transformPointF
public static int transformPointF(Float v1[],
Float matrix[],
Float v2[])
- Applies a transformation matrix to a point
GOOD
- Parameters:
- v1 - Vector array
- matrix - matrix array
- v2 - null float array to receive vector calculation result
- Returns:
- v2 resultant vector array
transformVector
public static int transformVector(float v1[],
float matrix[],
float v2[])
transformVectorF
public static int transformVectorF(Float v1[],
Float matrix[],
Float v2[])
- Applies a transformation matrix to a vector. However, since a vector does not
have a position in space, the translation component of the matrix is ignored
GOOD
- Parameters:
- v1 - Vector array
- matrix - matrix array
- v2 - null float array to receive vector calculation result
- Returns:
- v2 resultant vector array
identityMatrix
public static int identityMatrix(float matrix[])
identityMatrixF
public static int identityMatrixF(Float matrix[])
- Sets the matrix to the identity matrix
GOOD
- Parameters:
- matrix - matrix array
invertMatrix
public static int invertMatrix(float m1[],
float m2[])
invertMatrixF
public static int invertMatrixF(Float m1[],
Float m2[])
- Inverts matrix source and stores the result in matrix destination
GOOD
- Parameters:
- m1 - matrix array source
- m2 - matrix array destination
multiplyMatrix
public static int multiplyMatrix(float m1[],
float m2[],
float m3[])
multiplyMatrixF
public static int multiplyMatrixF(Float m1[],
Float m2[],
Float m3[])
- Multiplies two matrices together
GOOD
- Parameters:
- m1 - First matrix array
- m2 - Second matrix array
- m3 - null float array to receive matrix calculation result
- Returns:
- m3 resultant matrix array
orthoNormalizeMatrix
public static int orthoNormalizeMatrix(float m1[],
float m2[])
orthoNormalizeMatrixF
public static int orthoNormalizeMatrixF(Float m1[],
Float m2[])
- Ortho-normalizes the source matrix and places the result in the destination matrix
GOOD
- Parameters:
- m1 - matrix array source
- m2 - matrix array destination
getRotateMatrix
public static int getRotateMatrix(float matrix[],
float axis[],
float degrees)
getRotateMatrixF
public static int getRotateMatrixF(Float matrix[],
Float axis[],
Float degrees)
- Retrieves the rotation component from a matrix comprising only rotations and translations.
The rotation is returned as a unit direction vector along the axis of rotation through
the origin and an angle in degrees.
GOOD
As a typical VRML use, this method would take a matrix and return the SFRotation.
- Parameters:
- matrix - source matrix array
- null - 3-value array of x, y, z axis
- null - float to hold degrees
- Returns:
- axis three float array for x, y, z
rotateMatrix
public static int rotateMatrix(float matrix[],
float x,
float y,
float z,
float angle,
int nCombineOperation)
rotateMatrixF
public static int rotateMatrixF(Float matrix[],
Float x,
Float y,
Float z,
Float angle,
int nCombineOperation)
- Builds a rotation matrix and applies it to matrix,
The operation may be a pre-concatenation, post-concatenation, or replacement
GOOD
- Parameters:
- matrix - source matrix array
- x - x component of rotation
- y - y component of rotation
- z - z component of rotation
- angle - rotation in radians
- nCombineOperation - PRECONCANTENATE,POSTCONCATENATE, or REPLACE
rotateMatrixCos
public static int rotateMatrixCos(float matrix[],
float x,
float y,
float z,
float cosangle,
float rotdir,
int nCombineOperation)
rotateMatrixCosF
public static int rotateMatrixCosF(Float matrix[],
Float x,
Float y,
Float z,
Float cosangle,
Float rotdir,
int nCombineOperation)
- Builds a rotation matrix and applies it to matrix,
The angle of rotation is given by the cosine of the angle
(cosangle) and a direction of rotation (rotdir), The operation
may be a pre-concatenation, post-concatenation, or replacement
GOOD
- Parameters:
- matrix - source matrix array
- x - x component of rotation
- y - y component of rotation
- z - z component of rotation
- angle - cosine of the angle of rotation
- rotdir - direction of rotation (positive is anticlockwise, negative is clockwise)
- nCombineOperation - PRECONCANTENATE,POSTCONCATENATE, or REPLACE
scaleMatrix
public static int scaleMatrix(float matrix[],
float x,
float y,
float z,
int nCombineOperation)
scaleMatrixF
public static int scaleMatrixF(Float matrix[],
Float x,
Float y,
Float z,
int nCombineOperation)
- Builds a scaling matrix and applies it to matrix,
The operation may be a pre-concatenation, post-concatenation, or replacement
GOOD
- Parameters:
- matrix - source matrix array
- x - x scale component
- y - y scale component
- z - z scale component
- nCombineOperation - PRECONCANTENATE,POSTCONCATENATE, or REPLACE
transformMatrix
public static int transformMatrix(float dest[],
float source[],
int nCombineOperation)
transformMatrixF
public static int transformMatrixF(Float dest[],
Float source[],
int nCombineOperation)
- Applies the transformation matrix source to matrix dest
GOOD
- Parameters:
- dest - matrix array destination
- source - matrix array source
- nCombineOperation - PRECONCANTENATE,POSTCONCATENATE, or REPLACE
translateMatrix
public static int translateMatrix(float matrix[],
float x,
float y,
float z,
int nCombineOperation)
translateMatrixF
public static int translateMatrixF(Float matrix[],
Float x,
Float y,
Float z,
int nCombineOperation)
- Builds a translation matrix and applies it to matrix, The operation
may be a pre-concatenation, post-concatenation, or replacement
GOOD
- Parameters:
- matrix - source matrix array
- x - x translation component
- y - y translation component
- z - z translation component
- nCombineOperation - PRECONCANTENATE,POSTCONCATENATE, or REPLACE
All Packages Class Hierarchy This Package Previous Next Index