A matrix is used to define graphical transformations. PMatrix is the common interface for both the 2D and 3D matrix classes in Processing. A matrix is a grid of numbers, which can be multiplied by a vector to give another vector. Multiplying a point by a particular matrix might translate it, rotate
| 35 | * {@code apply} and {@code preApply} methods for this. |
| 36 | */ |
| 37 | public interface PMatrix { |
| 38 | |
| 39 | /** |
| 40 | * Make this an identity matrix. Multiplying by it will have no effect. |
| 41 | */ |
| 42 | public void reset(); |
| 43 | |
| 44 | /** |
| 45 | * Returns a copy of this PMatrix. |
| 46 | */ |
| 47 | public PMatrix get(); |
| 48 | |
| 49 | /** |
| 50 | * Copies the matrix contents into a float array. |
| 51 | * If target is null (or not the correct size), a new array will be created. |
| 52 | */ |
| 53 | public float[] get(float[] target); |
| 54 | |
| 55 | |
| 56 | /** |
| 57 | * Make this matrix become a copy of src. |
| 58 | */ |
| 59 | public void set(PMatrix src); |
| 60 | |
| 61 | /** |
| 62 | * Set the contents of this matrix to the contents of source. Fills the |
| 63 | * matrix left-to-right, starting in the top row. |
| 64 | */ |
| 65 | public void set(float[] source); |
| 66 | |
| 67 | /** |
| 68 | * Set the matrix content to this 2D matrix or its 3D equivalent. |
| 69 | */ |
| 70 | public void set(float m00, float m01, float m02, |
| 71 | float m10, float m11, float m12); |
| 72 | |
| 73 | /** |
| 74 | * Set the matrix content to the 3D matrix supplied, if this matrix is 3D. |
| 75 | */ |
| 76 | public void set(float m00, float m01, float m02, float m03, |
| 77 | float m10, float m11, float m12, float m13, |
| 78 | float m20, float m21, float m22, float m23, |
| 79 | float m30, float m31, float m32, float m33); |
| 80 | |
| 81 | |
| 82 | public void translate(float tx, float ty); |
| 83 | |
| 84 | public void translate(float tx, float ty, float tz); |
| 85 | |
| 86 | public void rotate(float angle); |
| 87 | |
| 88 | public void rotateX(float angle); |
| 89 | |
| 90 | public void rotateY(float angle); |
| 91 | |
| 92 | public void rotateZ(float angle); |
| 93 | |
| 94 | public void rotate(float angle, float v0, float v1, float v2); |
no outgoing calls
no test coverage detected