Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## toxi.geom
Class Matrix4x4

    java.lang.Object
      toxi.geom.Matrix4x4

    public class Matrix4x4

extends java.lang.Object

Implements a simple row-major 4x4 matrix class, all matrix operations are applied to new instances. Use `transpose()` to convert from column-major formats...

Field Summary
`double[][]` | `matrix`

Constructor Summary
`Matrix4x4()`
`Matrix4x4(double[] array)` Initialising constructor from a 1d array.
`Matrix4x4(double v11, double v12, double v13, double v14, double v21, double v22, double v23, double v24, double v31, double v32, double v33, double v34, double v41, double v42, double v43, double v44)`
`Matrix4x4(Matrix4x4 m)`

Method Summary
`Matrix4x4` | `add(Matrix4x4 rhs)`
`Matrix4x4` | `addSelf(Matrix4x4 m)`
`Vec3D` | `applyTo(ReadonlyVec3D v)` Creates a copy of the given vector, transformed by this matrix.
`Vec3D` | `applyToSelf(Vec3D v)`
`Matrix4x4` | `copy()`
`Matrix4x4` | `getInverted()`
`Matrix4x4` | `getRotatedAroundAxis(ReadonlyVec3D axis, double theta)`
`Matrix4x4` | `getRotatedX(double theta)`
`Matrix4x4` | `getRotatedY(double theta)`
`Matrix4x4` | `getRotatedZ(double theta)`
`Matrix4x4` | `getTransposed()`
`Matrix4x4` | `identity()`
`Matrix4x4` | `invert()` Matrix Inversion using Cramer's Method Computes Adjoint matrix divided by determinant Code modified from http://www.intel.com/design/pentiumiii/sml/24504301.pdf
`Matrix4x4` | `multiply(double factor)`
`Matrix4x4` | `multiply(Matrix4x4 mat)` Matrix-Matrix Right-multiplication.
`Matrix4x4` | `multiplySelf(double factor)` In-place matrix-scalar multiplication.
`Matrix4x4` | `multiplySelf(Matrix4x4 mat)`
`Matrix4x4` | `rotateAroundAxis(ReadonlyVec3D axis, double theta)` Applies rotation about arbitrary axis to matrix
`Matrix4x4` | `rotateX(double theta)` Applies rotation about X to this matrix.
`Matrix4x4` | `rotateY(double theta)` Applies rotation about Y to this matrix.
`Matrix4x4` | `rotateZ(double theta)`
`Matrix4x4` | `scale(double scale)`
`Matrix4x4` | `scale(double scaleX, double scaleY, double scaleZ)`
`Matrix4x4` | `scale(ReadonlyVec3D scale)`
`Matrix4x4` | `scaleSelf(double scale)`
`Matrix4x4` | `scaleSelf(double scaleX, double scaleY, double scaleZ)`
`Matrix4x4` | `scaleSelf(ReadonlyVec3D scale)`
`Matrix4x4` | `set(double a, double b, double c, double d, double e, double f, double g, double h, double i, double j, double k, double l, double m, double n, double o, double p)`
`Matrix4x4` | `set(Matrix4x4 mat)`
`Matrix4x4` | `sub(Matrix4x4 m)`
`Matrix4x4` | `subSelf(Matrix4x4 mat)`
`double[]` | `toArray(double[] result)` Copies all matrix elements into an linear array.
`float[]` | `toFloatArray(float[] result)`
`java.lang.String` | `toString()`
`float[]` | `toTransposedFloatArray(float[] result)`
`Matrix4x4` | `translate(double dx, double dy, double dz)`
`Matrix4x4` | `translate(ReadonlyVec3D trans)`
`Matrix4x4` | `translateSelf(double dx, double dy, double dz)`
`Matrix4x4` | `translateSelf(ReadonlyVec3D trans)`
`Matrix4x4` | `transpose()` Converts the matrix (in-place) between column-major to row-major order (and vice versa).

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### matrix

    public double[][] matrix

Constructor Detail

### Matrix4x4

    public Matrix4x4()

### Matrix4x4

    public Matrix4x4(double v11,
                     double v12,
                     double v13,
                     double v14,
                     double v21,
                     double v22,
                     double v23,
                     double v24,
                     double v31,
                     double v32,
                     double v33,
                     double v34,
                     double v41,
                     double v42,
                     double v43,
                     double v44)

### Matrix4x4

    public Matrix4x4(double[] array)

  Initialising constructor from a 1d array. Assumes row-major ordering (column index increases faster).

  Parameters:
    `array` -

### Matrix4x4

    public Matrix4x4(Matrix4x4 m)

Method Detail

### add

    public Matrix4x4 add(Matrix4x4 rhs)

### addSelf

    public Matrix4x4 addSelf(Matrix4x4 m)

### applyTo

    public Vec3D applyTo(ReadonlyVec3D v)

  Creates a copy of the given vector, transformed by this matrix.

  Parameters:
    `v` -
  Returns:
    transformed vector

### applyToSelf

    public Vec3D applyToSelf(Vec3D v)

### copy

    public Matrix4x4 copy()

### getInverted

    public Matrix4x4 getInverted()

### getRotatedAroundAxis

    public Matrix4x4 getRotatedAroundAxis(ReadonlyVec3D axis,
                                          double theta)

### getRotatedX

    public Matrix4x4 getRotatedX(double theta)

### getRotatedY

    public Matrix4x4 getRotatedY(double theta)

### getRotatedZ

    public Matrix4x4 getRotatedZ(double theta)

### getTransposed

    public Matrix4x4 getTransposed()

### identity

    public Matrix4x4 identity()

### invert

    public Matrix4x4 invert()

  Matrix Inversion using Cramer's Method Computes Adjoint matrix divided by determinant Code modified from http://www.intel.com/design/pentiumiii/sml/24504301.pdf

  Returns:
    itself

### multiply

    public Matrix4x4 multiply(double factor)

### multiply

    public Matrix4x4 multiply(Matrix4x4 mat)

  Matrix-Matrix Right-multiplication.

  Parameters:
    `mat` -
  Returns:
    product as new matrix

### multiplySelf

    public Matrix4x4 multiplySelf(double factor)

  In-place matrix-scalar multiplication.

  Parameters:
    `factor` -
  Returns:
    product applied to this matrix.

### multiplySelf

    public Matrix4x4 multiplySelf(Matrix4x4 mat)

### rotateAroundAxis

    public Matrix4x4 rotateAroundAxis(ReadonlyVec3D axis,
                                      double theta)

  Applies rotation about arbitrary axis to matrix

  Parameters:
    `axis` -
    `theta` -
  Returns:
    rotation applied to this matrix

### rotateX

    public Matrix4x4 rotateX(double theta)

  Applies rotation about X to this matrix.

  Parameters:
    `theta` - rotation angle in radians
  Returns:
    itself

### rotateY

    public Matrix4x4 rotateY(double theta)

  Applies rotation about Y to this matrix.

  Parameters:
    `theta` - rotation angle in radians
  Returns:
    itself

### rotateZ

    public Matrix4x4 rotateZ(double theta)

### scale

    public Matrix4x4 scale(double scale)

### scale

    public Matrix4x4 scale(double scaleX,
                           double scaleY,
                           double scaleZ)

### scale

    public Matrix4x4 scale(ReadonlyVec3D scale)

### scaleSelf

    public Matrix4x4 scaleSelf(double scale)

### scaleSelf

    public Matrix4x4 scaleSelf(double scaleX,
                               double scaleY,
                               double scaleZ)

### scaleSelf

    public Matrix4x4 scaleSelf(ReadonlyVec3D scale)

### set

    public Matrix4x4 set(double a,
                         double b,
                         double c,
                         double d,
                         double e,
                         double f,
                         double g,
                         double h,
                         double i,
                         double j,
                         double k,
                         double l,
                         double m,
                         double n,
                         double o,
                         double p)

### set

    public Matrix4x4 set(Matrix4x4 mat)

### sub

    public Matrix4x4 sub(Matrix4x4 m)

### subSelf

    public Matrix4x4 subSelf(Matrix4x4 mat)

### toArray

    public double[] toArray(double[] result)

  Copies all matrix elements into an linear array.

  Parameters:
    `result` - array (or null to create a new one)
  Returns:
    matrix as 16 element array

### toFloatArray

    public float[] toFloatArray(float[] result)

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### toTransposedFloatArray

    public float[] toTransposedFloatArray(float[] result)

### translate

    public Matrix4x4 translate(double dx,
                               double dy,
                               double dz)

### translate

    public Matrix4x4 translate(ReadonlyVec3D trans)

### translateSelf

    public Matrix4x4 translateSelf(double dx,
                                   double dy,
                                   double dz)

### translateSelf

    public Matrix4x4 translateSelf(ReadonlyVec3D trans)

### transpose

    public Matrix4x4 transpose()

  Converts the matrix (in-place) between column-major to row-major order (and vice versa).

  Returns:
    itself

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD