processing.core
Class PMatrix2D

java.lang.Object
  extended by processing.core.PMatrix2D
All Implemented Interfaces:
PMatrix

public class PMatrix2D
extends java.lang.Object
implements PMatrix

3x2 affine matrix implementation.


Field Summary
 float m00
           
 float m01
           
 float m02
           
 float m10
           
 float m11
           
 float m12
           
 
Constructor Summary
PMatrix2D()
           
PMatrix2D(float m00, float m01, float m02, float m10, float m11, float m12)
           
PMatrix2D(PMatrix matrix)
           
 
Method Summary
 void apply(float n00, float n01, float n02, float n10, float n11, float n12)
           
 void apply(float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
           
 void apply(PMatrix source)
          Multiply this matrix by another.
 void apply(PMatrix2D source)
           
 void apply(PMatrix3D source)
           
 float determinant()
           
 PMatrix2D get()
          Returns a copy of this PMatrix.
 float[] get(float[] target)
          Copies the matrix contents into a 6 entry float array.
 boolean invert()
          Invert this matrix.
 float[] mult(float[] vec, float[] out)
          Multiply a two element vector against this matrix.
 PVector mult(PVector source, PVector target)
          Multiply the x and y coordinates of a PVector against this matrix.
 float multX(float x, float y)
           
 float multY(float x, float y)
           
 void preApply(float n00, float n01, float n02, float n10, float n11, float n12)
           
 void preApply(float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
           
 void preApply(PMatrix2D left)
          Apply another matrix to the left of this one.
 void preApply(PMatrix3D left)
           
 void print()
           
 void reset()
           
 void rotate(float angle)
           
 void rotate(float angle, float v0, float v1, float v2)
           
 void rotateX(float angle)
           
 void rotateY(float angle)
           
 void rotateZ(float angle)
           
 void scale(float s)
           
 void scale(float sx, float sy)
           
 void scale(float x, float y, float z)
           
 void set(float[] source)
           
 void set(float m00, float m01, float m02, float m10, float m11, float m12)
           
 void set(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33)
           
 void set(PMatrix matrix)
           
 void set(PMatrix3D src)
           
 void skewX(float angle)
           
 void skewY(float angle)
           
 void translate(float tx, float ty)
           
 void translate(float x, float y, float z)
           
 void transpose()
          Transpose this matrix.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m00

public float m00

m01

public float m01

m02

public float m02

m10

public float m10

m11

public float m11

m12

public float m12
Constructor Detail

PMatrix2D

public PMatrix2D()

PMatrix2D

public PMatrix2D(float m00,
                 float m01,
                 float m02,
                 float m10,
                 float m11,
                 float m12)

PMatrix2D

public PMatrix2D(PMatrix matrix)
Method Detail

reset

public void reset()
Specified by:
reset in interface PMatrix

get

public PMatrix2D get()
Returns a copy of this PMatrix.

Specified by:
get in interface PMatrix

get

public float[] get(float[] target)
Copies the matrix contents into a 6 entry float array. If target is null (or not the correct size), a new array will be created.

Specified by:
get in interface PMatrix

set

public void set(PMatrix matrix)
Specified by:
set in interface PMatrix

set

public void set(PMatrix3D src)

set

public void set(float[] source)
Specified by:
set in interface PMatrix

set

public void set(float m00,
                float m01,
                float m02,
                float m10,
                float m11,
                float m12)
Specified by:
set in interface PMatrix

set

public void set(float m00,
                float m01,
                float m02,
                float m03,
                float m10,
                float m11,
                float m12,
                float m13,
                float m20,
                float m21,
                float m22,
                float m23,
                float m30,
                float m31,
                float m32,
                float m33)
Specified by:
set in interface PMatrix

translate

public void translate(float tx,
                      float ty)
Specified by:
translate in interface PMatrix

translate

public void translate(float x,
                      float y,
                      float z)
Specified by:
translate in interface PMatrix

rotate

public void rotate(float angle)
Specified by:
rotate in interface PMatrix

rotateX

public void rotateX(float angle)
Specified by:
rotateX in interface PMatrix

rotateY

public void rotateY(float angle)
Specified by:
rotateY in interface PMatrix

rotateZ

public void rotateZ(float angle)
Specified by:
rotateZ in interface PMatrix

rotate

public void rotate(float angle,
                   float v0,
                   float v1,
                   float v2)
Specified by:
rotate in interface PMatrix

scale

public void scale(float s)
Specified by:
scale in interface PMatrix

scale

public void scale(float sx,
                  float sy)
Specified by:
scale in interface PMatrix

scale

public void scale(float x,
                  float y,
                  float z)
Specified by:
scale in interface PMatrix

skewX

public void skewX(float angle)
Specified by:
skewX in interface PMatrix

skewY

public void skewY(float angle)
Specified by:
skewY in interface PMatrix

apply

public void apply(PMatrix source)
Description copied from interface: PMatrix
Multiply this matrix by another.

Specified by:
apply in interface PMatrix

apply

public void apply(PMatrix2D source)
Specified by:
apply in interface PMatrix

apply

public void apply(PMatrix3D source)
Specified by:
apply in interface PMatrix

apply

public void apply(float n00,
                  float n01,
                  float n02,
                  float n10,
                  float n11,
                  float n12)
Specified by:
apply in interface PMatrix

apply

public void apply(float n00,
                  float n01,
                  float n02,
                  float n03,
                  float n10,
                  float n11,
                  float n12,
                  float n13,
                  float n20,
                  float n21,
                  float n22,
                  float n23,
                  float n30,
                  float n31,
                  float n32,
                  float n33)
Specified by:
apply in interface PMatrix

preApply

public void preApply(PMatrix2D left)
Apply another matrix to the left of this one.

Specified by:
preApply in interface PMatrix

preApply

public void preApply(PMatrix3D left)
Specified by:
preApply in interface PMatrix

preApply

public void preApply(float n00,
                     float n01,
                     float n02,
                     float n10,
                     float n11,
                     float n12)
Specified by:
preApply in interface PMatrix

preApply

public void preApply(float n00,
                     float n01,
                     float n02,
                     float n03,
                     float n10,
                     float n11,
                     float n12,
                     float n13,
                     float n20,
                     float n21,
                     float n22,
                     float n23,
                     float n30,
                     float n31,
                     float n32,
                     float n33)
Specified by:
preApply in interface PMatrix

mult

public PVector mult(PVector source,
                    PVector target)
Multiply the x and y coordinates of a PVector against this matrix.

Specified by:
mult in interface PMatrix

mult

public float[] mult(float[] vec,
                    float[] out)
Multiply a two element vector against this matrix. If out is null or not length four, a new float array will be returned. The values for vec and out can be the same (though that's less efficient).

Specified by:
mult in interface PMatrix

multX

public float multX(float x,
                   float y)

multY

public float multY(float x,
                   float y)

transpose

public void transpose()
Transpose this matrix.

Specified by:
transpose in interface PMatrix

invert

public boolean invert()
Invert this matrix. Implementation stolen from OpenJDK.

Specified by:
invert in interface PMatrix
Returns:
true if successful

determinant

public float determinant()
Specified by:
determinant in interface PMatrix
Returns:
the determinant of the matrix

print

public void print()