-
public class MatrixMathHelperProvides helper methods for converting transform operations into a matrix and then into a list of translate, scale and rotate commands.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classMatrixMathHelper.MatrixDecompositionContext
-
Method Summary
Modifier and Type Method Description static voidmultiplyInto(Array<double> out, Array<double> a, Array<double> b)static voiddecomposeMatrix(Array<double> transformMatrix, MatrixMathHelper.MatrixDecompositionContext ctx)static doubledeterminant(Array<double> matrix)static Array<double>inverse(Array<double> matrix)Inverse of a matrix. static Array<double>transpose(Array<double> m)Turns columns into rows and rows into columns. static voidmultiplyVectorByMatrix(Array<double> v, Array<double> m, Array<double> result)Based on: http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix. static doublev3Length(Array<double> a)From: https://code.google.com/p/webgl-mjs/source/browse/mjs. static Array<double>v3Normalize(Array<double> vector, double norm)Based on: https://code.google.com/p/webgl-mjs/source/browse/mjs. static doublev3Dot(Array<double> a, Array<double> b)The dot product of a and b, two 3-element vectors. static Array<double>v3Combine(Array<double> a, Array<double> b, double aScale, double bScale)From:http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix. static Array<double>v3Cross(Array<double> a, Array<double> b)From:http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix. static doubleroundTo3Places(double n)static Array<double>createIdentityMatrix()static doubledegreesToRadians(double degrees)static voidresetIdentityMatrix(Array<double> matrix)static voidapplyPerspective(Array<double> m, double perspective)static voidapplyScaleX(Array<double> m, double factor)static voidapplyScaleY(Array<double> m, double factor)static voidapplyScaleZ(Array<double> m, double factor)static voidapplyTranslate2D(Array<double> m, double x, double y)static voidapplyTranslate3D(Array<double> m, double x, double y, double z)static voidapplySkewX(Array<double> m, double radians)static voidapplySkewY(Array<double> m, double radians)static voidapplyRotateX(Array<double> m, double radians)static voidapplyRotateY(Array<double> m, double radians)static voidapplyRotateZ(Array<double> m, double radians)-
-
Method Detail
-
multiplyInto
static void multiplyInto(Array<double> out, Array<double> a, Array<double> b)
-
decomposeMatrix
static void decomposeMatrix(Array<double> transformMatrix, MatrixMathHelper.MatrixDecompositionContext ctx)
- Parameters:
transformMatrix- 16-element array of numbers representing 4x4 transform matrix
-
determinant
static double determinant(Array<double> matrix)
-
inverse
static Array<double> inverse(Array<double> matrix)
Inverse of a matrix. Multiplying by the inverse is used in matrix math instead of division.
Formula from:http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm
-
transpose
static Array<double> transpose(Array<double> m)
Turns columns into rows and rows into columns.
-
multiplyVectorByMatrix
static void multiplyVectorByMatrix(Array<double> v, Array<double> m, Array<double> result)
Based on: http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c
-
v3Length
static double v3Length(Array<double> a)
From: https://code.google.com/p/webgl-mjs/source/browse/mjs.js
-
v3Normalize
static Array<double> v3Normalize(Array<double> vector, double norm)
Based on: https://code.google.com/p/webgl-mjs/source/browse/mjs.js
-
v3Dot
static double v3Dot(Array<double> a, Array<double> b)
The dot product of a and b, two 3-element vectors. From:https://code.google.com/p/webgl-mjs/source/browse/mjs.js
-
v3Combine
static Array<double> v3Combine(Array<double> a, Array<double> b, double aScale, double bScale)
From:http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix.cpp
-
v3Cross
static Array<double> v3Cross(Array<double> a, Array<double> b)
From:http://www.opensource.apple.com/source/WebCore/WebCore-514/platform/graphics/transforms/TransformationMatrix.cpp
-
roundTo3Places
static double roundTo3Places(double n)
-
createIdentityMatrix
static Array<double> createIdentityMatrix()
-
degreesToRadians
static double degreesToRadians(double degrees)
-
resetIdentityMatrix
static void resetIdentityMatrix(Array<double> matrix)
-
applyPerspective
static void applyPerspective(Array<double> m, double perspective)
-
applyScaleX
static void applyScaleX(Array<double> m, double factor)
-
applyScaleY
static void applyScaleY(Array<double> m, double factor)
-
applyScaleZ
static void applyScaleZ(Array<double> m, double factor)
-
applyTranslate2D
static void applyTranslate2D(Array<double> m, double x, double y)
-
applyTranslate3D
static void applyTranslate3D(Array<double> m, double x, double y, double z)
-
applySkewX
static void applySkewX(Array<double> m, double radians)
-
applySkewY
static void applySkewY(Array<double> m, double radians)
-
applyRotateX
static void applyRotateX(Array<double> m, double radians)
-
applyRotateY
static void applyRotateY(Array<double> m, double radians)
-
applyRotateZ
static void applyRotateZ(Array<double> m, double radians)
-
-
-
-