-
public class MatrixMathHelper
Provides 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 class
MatrixMathHelper.MatrixDecompositionContext
-
Method Summary
Modifier and Type Method Description static void
multiplyInto(Array<double> out, Array<double> a, Array<double> b)
static void
decomposeMatrix(Array<double> transformMatrix, MatrixMathHelper.MatrixDecompositionContext ctx)
static double
determinant(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 void
multiplyVectorByMatrix(Array<double> v, Array<double> m, Array<double> result)
Based on: http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix. static double
v3Length(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 double
v3Dot(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 double
roundTo3Places(double n)
static Array<double>
createIdentityMatrix()
static double
degreesToRadians(double degrees)
static void
resetIdentityMatrix(Array<double> matrix)
static void
applyPerspective(Array<double> m, double perspective)
static void
applyScaleX(Array<double> m, double factor)
static void
applyScaleY(Array<double> m, double factor)
static void
applyScaleZ(Array<double> m, double factor)
static void
applyTranslate2D(Array<double> m, double x, double y)
static void
applyTranslate3D(Array<double> m, double x, double y, double z)
static void
applySkewX(Array<double> m, double radians)
static void
applySkewY(Array<double> m, double radians)
static void
applyRotateX(Array<double> m, double radians)
static void
applyRotateY(Array<double> m, double radians)
static void
applyRotateZ(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)
-
-
-
-