diff options
author | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:42 -0500 |
commit | ce28e056c20bf2723f565bbf464b87781ec248a2 (patch) | |
tree | ef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/llmath/m3math.h | |
parent | Second Life viewer sources 1.19.1.4b (diff) | |
download | meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2 meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz |
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/llmath/m3math.h')
-rw-r--r-- | linden/indra/llmath/m3math.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/linden/indra/llmath/m3math.h b/linden/indra/llmath/m3math.h index 8bd94d8..cd22a86 100644 --- a/linden/indra/llmath/m3math.h +++ b/linden/indra/llmath/m3math.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #define LL_M3MATH_H | 33 | #define LL_M3MATH_H |
34 | 34 | ||
35 | #include "llerror.h" | 35 | #include "llerror.h" |
36 | #include "stdtypes.h" | ||
36 | 37 | ||
37 | class LLVector4; | 38 | class LLVector4; |
38 | class LLVector3; | 39 | class LLVector3; |
@@ -76,8 +77,9 @@ class LLMatrix3 | |||
76 | // | 77 | // |
77 | 78 | ||
78 | // various useful matrix functions | 79 | // various useful matrix functions |
79 | const LLMatrix3& identity(); // Load identity matrix | 80 | const LLMatrix3& setIdentity(); // Load identity matrix |
80 | const LLMatrix3& zero(); // Clears Matrix to zero | 81 | const LLMatrix3& clear(); // Clears Matrix to zero |
82 | const LLMatrix3& setZero(); // Clears Matrix to zero | ||
81 | 83 | ||
82 | /////////////////////////// | 84 | /////////////////////////// |
83 | // | 85 | // |
@@ -91,6 +93,9 @@ class LLMatrix3 | |||
91 | const LLMatrix3& setRot(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos | 93 | const LLMatrix3& setRot(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos |
92 | 94 | ||
93 | const LLMatrix3& setRows(const LLVector3 &x_axis, const LLVector3 &y_axis, const LLVector3 &z_axis); | 95 | const LLMatrix3& setRows(const LLVector3 &x_axis, const LLVector3 &y_axis, const LLVector3 &z_axis); |
96 | const LLMatrix3& setRow( U32 rowIndex, const LLVector3& row ); | ||
97 | const LLMatrix3& setCol( U32 colIndex, const LLVector3& col ); | ||
98 | |||
94 | 99 | ||
95 | /////////////////////////// | 100 | /////////////////////////// |
96 | // | 101 | // |
@@ -103,29 +108,31 @@ class LLMatrix3 | |||
103 | LLVector3 getFwdRow() const; | 108 | LLVector3 getFwdRow() const; |
104 | LLVector3 getLeftRow() const; | 109 | LLVector3 getLeftRow() const; |
105 | LLVector3 getUpRow() const; | 110 | LLVector3 getUpRow() const; |
106 | F32 determinant() const; // Return determinant | 111 | F32 determinant() const; // Return determinant |
107 | 112 | ||
108 | 113 | ||
109 | /////////////////////////// | 114 | /////////////////////////// |
110 | // | 115 | // |
111 | // Operations on an existing matrix | 116 | // Operations on an existing matrix |
112 | // | 117 | // |
113 | const LLMatrix3& transpose(); // Transpose MAT4 | 118 | const LLMatrix3& transpose(); // Transpose MAT4 |
114 | const LLMatrix3& invert(); // Invert MAT4 | 119 | const LLMatrix3& orthogonalize(); // Orthogonalizes X, then Y, then Z |
115 | const LLMatrix3& orthogonalize(); // Orthogonalizes X, then Y, then Z | 120 | void invert(); // Invert MAT4 |
116 | const LLMatrix3& adjointTranspose(); // returns transpose of matrix adjoint, for multiplying normals | 121 | const LLMatrix3& adjointTranspose();// returns transpose of matrix adjoint, for multiplying normals |
117 | 122 | ||
118 | 123 | ||
119 | // Rotate existing matrix | 124 | // Rotate existing matrix |
120 | // Note: the two lines below are equivalent: | 125 | // Note: the two lines below are equivalent: |
121 | // foo.rotate(bar) | 126 | // foo.rotate(bar) |
122 | // foo = foo * bar | 127 | // foo = foo * bar |
123 | // That is, foo.rotMat3(bar) multiplies foo by bar FROM THE RIGHT | 128 | // That is, foo.rotate(bar) multiplies foo by bar FROM THE RIGHT |
124 | const LLMatrix3& rotate(const F32 angle, const F32 x, const F32 y, const F32 z); // Rotate matrix by rotating angle radians about (x, y, z) | 129 | const LLMatrix3& rotate(const F32 angle, const F32 x, const F32 y, const F32 z); // Rotate matrix by rotating angle radians about (x, y, z) |
125 | const LLMatrix3& rotate(const F32 angle, const LLVector3 &vec); // Rotate matrix by rotating angle radians about vec | 130 | const LLMatrix3& rotate(const F32 angle, const LLVector3 &vec); // Rotate matrix by rotating angle radians about vec |
126 | const LLMatrix3& rotate(const F32 roll, const F32 pitch, const F32 yaw); // Rotate matrix by roll (about x), pitch (about y), and yaw (about z) | 131 | const LLMatrix3& rotate(const F32 roll, const F32 pitch, const F32 yaw); // Rotate matrix by roll (about x), pitch (about y), and yaw (about z) |
127 | const LLMatrix3& rotate(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos | 132 | const LLMatrix3& rotate(const LLQuaternion &q); // Transform matrix by Euler angles and translating by pos |
128 | 133 | ||
134 | void add(const LLMatrix3& other_matrix); // add other_matrix to this one | ||
135 | |||
129 | // This operator is misleading as to operation direction | 136 | // This operator is misleading as to operation direction |
130 | // friend LLVector3 operator*(const LLMatrix3 &a, const LLVector3 &b); // Apply rotation a to vector b | 137 | // friend LLVector3 operator*(const LLMatrix3 &a, const LLVector3 &b); // Apply rotation a to vector b |
131 | 138 | ||
@@ -137,6 +144,7 @@ class LLMatrix3 | |||
137 | friend bool operator!=(const LLMatrix3 &a, const LLMatrix3 &b); // Return a != b | 144 | friend bool operator!=(const LLMatrix3 &a, const LLMatrix3 &b); // Return a != b |
138 | 145 | ||
139 | friend const LLMatrix3& operator*=(LLMatrix3 &a, const LLMatrix3 &b); // Return a * b | 146 | friend const LLMatrix3& operator*=(LLMatrix3 &a, const LLMatrix3 &b); // Return a * b |
147 | friend const LLMatrix3& operator*=(LLMatrix3 &a, F32 scalar ); // Return a * scalar | ||
140 | 148 | ||
141 | friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a | 149 | friend std::ostream& operator<<(std::ostream& s, const LLMatrix3 &a); // Stream a |
142 | }; | 150 | }; |