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.

Variable Index

 o POSTCONCATENATE
 o PRECONCATENATE
Variables for matrix combine operations
 o REPLACE

Method Index

 o addVector(float[], float[], float[])
 o addVectorF(Float[], Float[], Float[])
Adds two vectors GOOD
 o crossProduct(float[], float[], float[])
 o crossProductF(Float[], Float[], Float[])
Calculates the cross product of two vectors GOOD
 o dotProduct(float[], float[], float[])
 o dotProductF(Float[], Float[], Float[])
Calculates the dot product of two vectors GOOD
 o getRotateMatrix(float[], float[], float)
 o getRotateMatrixF(Float[], Float[], Float)
Retrieves the rotation component from a matrix comprising only rotations and translations.
 o identityMatrix(float[])
 o identityMatrixF(Float[])
Sets the matrix to the identity matrix GOOD
 o invertMatrix(float[], float[])
 o invertMatrixF(Float[], Float[])
Inverts matrix source and stores the result in matrix destination GOOD
 o multiplyMatrix(float[], float[], float[])
 o multiplyMatrixF(Float[], Float[], Float[])
Multiplies two matrices together GOOD
 o normalize(float[])
 o normalizeF(Float[])
Normalizes a vector to unit length while retaining the ratio between its X, Y, and Z components GOOD
 o orthoNormalizeMatrix(float[], float[])
 o orthoNormalizeMatrixF(Float[], Float[])
Ortho-normalizes the source matrix and places the result in the destination matrix GOOD
 o rotateMatrix(float[], float, float, float, float, int)
 o rotateMatrixCos(float[], float, float, float, float, float, int)
 o 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
 o 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
 o scaleMatrix(float[], float, float, float, int)
 o 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
 o scaleVector(float[], float, float[])
 o scaleVectorF(Float[], Float, Float[])
Scales a vector GOOD
 o transformMatrix(float[], float[], int)
 o transformMatrixF(Float[], Float[], int)
Applies the transformation matrix source to matrix dest GOOD
 o transformPoint(float[], float[], float[])
 o transformPointF(Float[], Float[], Float[])
Applies a transformation matrix to a point GOOD
 o transformVector(float[], float[], float[])
 o transformVectorF(Float[], Float[], Float[])
Applies a transformation matrix to a vector.
 o translateMatrix(float[], float, float, float, int)
 o 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

Variables

 o PRECONCATENATE
  public final int PRECONCATENATE
Variables for matrix combine operations
 o POSTCONCATENATE
  public final int POSTCONCATENATE
 o REPLACE
  public final int REPLACE

Methods

 o addVector
  public static int addVector(float v1[],
                              float v2[],
                              float v3[])
 o 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
 o crossProduct
  public static int crossProduct(float v1[],
                                 float v2[],
                                 float v3[])
 o 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
 o dotProduct
  public static int dotProduct(float v1[],
                               float v2[],
                               float v3[])
 o 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
 o normalize
  public static int normalize(float vector[])
 o 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
 o scaleVector
  public static int scaleVector(float v1[],
                                float scale,
                                float v2[])
 o 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
 o transformPoint
  public static int transformPoint(float v1[],
                                   float matrix[],
                                   float v2[])
 o 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
 o transformVector
  public static int transformVector(float v1[],
                                    float matrix[],
                                    float v2[])
 o 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
 o identityMatrix
  public static int identityMatrix(float matrix[])
 o identityMatrixF
  public static int identityMatrixF(Float matrix[])
Sets the matrix to the identity matrix GOOD
Parameters:
matrix - matrix array
 o invertMatrix
  public static int invertMatrix(float m1[],
                                 float m2[])
 o 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
 o multiplyMatrix
  public static int multiplyMatrix(float m1[],
                                   float m2[],
                                   float m3[])
 o 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
 o orthoNormalizeMatrix
  public static int orthoNormalizeMatrix(float m1[],
                                         float m2[])
 o 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
 o getRotateMatrix
  public static int getRotateMatrix(float matrix[],
                                    float axis[],
                                    float degrees)
 o 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
 o rotateMatrix
  public static int rotateMatrix(float matrix[],
                                 float x,
                                 float y,
                                 float z,
                                 float angle,
                                 int nCombineOperation)
 o 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
 o rotateMatrixCos
  public static int rotateMatrixCos(float matrix[],
                                    float x,
                                    float y,
                                    float z,
                                    float cosangle,
                                    float rotdir,
                                    int nCombineOperation)
 o 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
 o scaleMatrix
  public static int scaleMatrix(float matrix[],
                                float x,
                                float y,
                                float z,
                                int nCombineOperation)
 o 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
 o transformMatrix
  public static int transformMatrix(float dest[],
                                    float source[],
                                    int nCombineOperation)
 o 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
 o translateMatrix
  public static int translateMatrix(float matrix[],
                                    float x,
                                    float y,
                                    float z,
                                    int nCombineOperation)
 o 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