4x4 matrix implementation. Matrices are used to describe a transformation; see PMatrix for a general description. This matrix looks like the following when multiplying a vector (x, y, z, w) in mult(). [m00 m01 m02 m03][x] [m00 x + m01 y + m02 z + m03 w] [x'] [m10 m11 m12 m1
| 41 | * resulting point is then (x', y', z'). |
| 42 | */ |
| 43 | public final class PMatrix3D implements PMatrix /*, PConstants*/ { |
| 44 | |
| 45 | public float m00, m01, m02, m03; |
| 46 | public float m10, m11, m12, m13; |
| 47 | public float m20, m21, m22, m23; |
| 48 | public float m30, m31, m32, m33; |
| 49 | |
| 50 | |
| 51 | // locally allocated version to avoid creating new memory |
| 52 | protected PMatrix3D inverseCopy; |
| 53 | |
| 54 | |
| 55 | public PMatrix3D() { |
| 56 | reset(); |
| 57 | } |
| 58 | |
| 59 | |
| 60 | public PMatrix3D(float m00, float m01, float m02, |
| 61 | float m10, float m11, float m12) { |
| 62 | set(m00, m01, m02, 0, |
| 63 | m10, m11, m12, 0, |
| 64 | 0, 0, 1, 0, |
| 65 | 0, 0, 0, 1); |
| 66 | } |
| 67 | |
| 68 | |
| 69 | public PMatrix3D(float m00, float m01, float m02, float m03, |
| 70 | float m10, float m11, float m12, float m13, |
| 71 | float m20, float m21, float m22, float m23, |
| 72 | float m30, float m31, float m32, float m33) { |
| 73 | set(m00, m01, m02, m03, |
| 74 | m10, m11, m12, m13, |
| 75 | m20, m21, m22, m23, |
| 76 | m30, m31, m32, m33); |
| 77 | } |
| 78 | |
| 79 | |
| 80 | public PMatrix3D(PMatrix matrix) { |
| 81 | set(matrix); |
| 82 | } |
| 83 | |
| 84 | |
| 85 | public void reset() { |
| 86 | set(1, 0, 0, 0, |
| 87 | 0, 1, 0, 0, |
| 88 | 0, 0, 1, 0, |
| 89 | 0, 0, 0, 1); |
| 90 | } |
| 91 | |
| 92 | |
| 93 | /** |
| 94 | * Returns a copy of this PMatrix. |
| 95 | */ |
| 96 | public PMatrix3D get() { |
| 97 | PMatrix3D outgoing = new PMatrix3D(); |
| 98 | outgoing.set(this); |
| 99 | return outgoing; |
| 100 | } |
nothing calls this directly
no outgoing calls
no test coverage detected