IceMatrix3x3.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICEMATRIX3X3_H__
13 #define __ICEMATRIX3X3_H__
14 
15  // Forward declarations
16  class Quat;
17 
18  #define MATRIX3X3_EPSILON (1.0e-7f)
19 
21  {
22  public:
26  inline_ Matrix3x3(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
27  {
28  m[0][0] = m00; m[0][1] = m01; m[0][2] = m02;
29  m[1][0] = m10; m[1][1] = m11; m[1][2] = m12;
30  m[2][0] = m20; m[2][1] = m21; m[2][2] = m22;
31  }
33  inline_ Matrix3x3(const Matrix3x3& mat) { CopyMemory(m, &mat.m, 9*sizeof(float)); }
36 
38  inline_ void Set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
39  {
40  m[0][0] = m00; m[0][1] = m01; m[0][2] = m02;
41  m[1][0] = m10; m[1][1] = m11; m[1][2] = m12;
42  m[2][0] = m20; m[2][1] = m21; m[2][2] = m22;
43  }
44 
46  inline_ void SetScale(const Point& p) { m[0][0] = p.x; m[1][1] = p.y; m[2][2] = p.z; }
47 
49  inline_ void SetScale(float sx, float sy, float sz) { m[0][0] = sx; m[1][1] = sy; m[2][2] = sz; }
50 
52  inline_ void Scale(const Point& p)
53  {
54  m[0][0] *= p.x; m[0][1] *= p.x; m[0][2] *= p.x;
55  m[1][0] *= p.y; m[1][1] *= p.y; m[1][2] *= p.y;
56  m[2][0] *= p.z; m[2][1] *= p.z; m[2][2] *= p.z;
57  }
58 
60  inline_ void Scale(float sx, float sy, float sz)
61  {
62  m[0][0] *= sx; m[0][1] *= sx; m[0][2] *= sx;
63  m[1][0] *= sy; m[1][1] *= sy; m[1][2] *= sy;
64  m[2][0] *= sz; m[2][1] *= sz; m[2][2] *= sz;
65  }
66 
68  inline_ void Copy(const Matrix3x3& source) { CopyMemory(m, source.m, 9*sizeof(float)); }
69 
70  // Row-column access
72  inline_ void GetRow(const udword r, Point& p) const { p.x = m[r][0]; p.y = m[r][1]; p.z = m[r][2]; }
74  inline_ const Point& GetRow(const udword r) const { return *(const Point*)&m[r][0]; }
76  inline_ Point& GetRow(const udword r) { return *(Point*)&m[r][0]; }
78  inline_ void SetRow(const udword r, const Point& p) { m[r][0] = p.x; m[r][1] = p.y; m[r][2] = p.z; }
80  inline_ void GetCol(const udword c, Point& p) const { p.x = m[0][c]; p.y = m[1][c]; p.z = m[2][c]; }
82  inline_ void SetCol(const udword c, const Point& p) { m[0][c] = p.x; m[1][c] = p.y; m[2][c] = p.z; }
83 
85  inline_ float Trace() const { return m[0][0] + m[1][1] + m[2][2]; }
87  inline_ void Zero() { ZeroMemory(&m, sizeof(m)); }
89  inline_ void Identity() { Zero(); m[0][0] = m[1][1] = m[2][2] = 1.0f; }
91  inline_ bool IsIdentity() const
92  {
93  if(IR(m[0][0])!=IEEE_1_0) return false;
94  if(IR(m[0][1])!=0) return false;
95  if(IR(m[0][2])!=0) return false;
96 
97  if(IR(m[1][0])!=0) return false;
98  if(IR(m[1][1])!=IEEE_1_0) return false;
99  if(IR(m[1][2])!=0) return false;
100 
101  if(IR(m[2][0])!=0) return false;
102  if(IR(m[2][1])!=0) return false;
103  if(IR(m[2][2])!=IEEE_1_0) return false;
104 
105  return true;
106  }
107 
110  {
111  for(udword j=0;j<3;j++)
112  {
113  for(udword i=0;i<3;i++)
114  {
115  if(!IsValidFloat(m[j][i])) return FALSE;
116  }
117  }
118  return TRUE;
119  }
120 
127  inline_ void SkewSymmetric(const Point& a)
128  {
129  m[0][0] = 0.0f;
130  m[0][1] = -a.z;
131  m[0][2] = a.y;
132 
133  m[1][0] = a.z;
134  m[1][1] = 0.0f;
135  m[1][2] = -a.x;
136 
137  m[2][0] = -a.y;
138  m[2][1] = a.x;
139  m[2][2] = 0.0f;
140  }
141 
143  inline_ void Neg()
144  {
145  m[0][0] = -m[0][0]; m[0][1] = -m[0][1]; m[0][2] = -m[0][2];
146  m[1][0] = -m[1][0]; m[1][1] = -m[1][1]; m[1][2] = -m[1][2];
147  m[2][0] = -m[2][0]; m[2][1] = -m[2][1]; m[2][2] = -m[2][2];
148  }
149 
151  inline_ void Neg(const Matrix3x3& mat)
152  {
153  m[0][0] = -mat.m[0][0]; m[0][1] = -mat.m[0][1]; m[0][2] = -mat.m[0][2];
154  m[1][0] = -mat.m[1][0]; m[1][1] = -mat.m[1][1]; m[1][2] = -mat.m[1][2];
155  m[2][0] = -mat.m[2][0]; m[2][1] = -mat.m[2][1]; m[2][2] = -mat.m[2][2];
156  }
157 
159  inline_ void Add(const Matrix3x3& mat)
160  {
161  m[0][0] += mat.m[0][0]; m[0][1] += mat.m[0][1]; m[0][2] += mat.m[0][2];
162  m[1][0] += mat.m[1][0]; m[1][1] += mat.m[1][1]; m[1][2] += mat.m[1][2];
163  m[2][0] += mat.m[2][0]; m[2][1] += mat.m[2][1]; m[2][2] += mat.m[2][2];
164  }
165 
167  inline_ void Sub(const Matrix3x3& mat)
168  {
169  m[0][0] -= mat.m[0][0]; m[0][1] -= mat.m[0][1]; m[0][2] -= mat.m[0][2];
170  m[1][0] -= mat.m[1][0]; m[1][1] -= mat.m[1][1]; m[1][2] -= mat.m[1][2];
171  m[2][0] -= mat.m[2][0]; m[2][1] -= mat.m[2][1]; m[2][2] -= mat.m[2][2];
172  }
174  inline_ void Mac(const Matrix3x3& a, const Matrix3x3& b, float s)
175  {
176  m[0][0] = a.m[0][0] + b.m[0][0] * s;
177  m[0][1] = a.m[0][1] + b.m[0][1] * s;
178  m[0][2] = a.m[0][2] + b.m[0][2] * s;
179 
180  m[1][0] = a.m[1][0] + b.m[1][0] * s;
181  m[1][1] = a.m[1][1] + b.m[1][1] * s;
182  m[1][2] = a.m[1][2] + b.m[1][2] * s;
183 
184  m[2][0] = a.m[2][0] + b.m[2][0] * s;
185  m[2][1] = a.m[2][1] + b.m[2][1] * s;
186  m[2][2] = a.m[2][2] + b.m[2][2] * s;
187  }
189  inline_ void Mac(const Matrix3x3& a, float s)
190  {
191  m[0][0] += a.m[0][0] * s; m[0][1] += a.m[0][1] * s; m[0][2] += a.m[0][2] * s;
192  m[1][0] += a.m[1][0] * s; m[1][1] += a.m[1][1] * s; m[1][2] += a.m[1][2] * s;
193  m[2][0] += a.m[2][0] * s; m[2][1] += a.m[2][1] * s; m[2][2] += a.m[2][2] * s;
194  }
195 
197  inline_ void Mult(const Matrix3x3& a, float s)
198  {
199  m[0][0] = a.m[0][0] * s; m[0][1] = a.m[0][1] * s; m[0][2] = a.m[0][2] * s;
200  m[1][0] = a.m[1][0] * s; m[1][1] = a.m[1][1] * s; m[1][2] = a.m[1][2] * s;
201  m[2][0] = a.m[2][0] * s; m[2][1] = a.m[2][1] * s; m[2][2] = a.m[2][2] * s;
202  }
203 
204  inline_ void Add(const Matrix3x3& a, const Matrix3x3& b)
205  {
206  m[0][0] = a.m[0][0] + b.m[0][0]; m[0][1] = a.m[0][1] + b.m[0][1]; m[0][2] = a.m[0][2] + b.m[0][2];
207  m[1][0] = a.m[1][0] + b.m[1][0]; m[1][1] = a.m[1][1] + b.m[1][1]; m[1][2] = a.m[1][2] + b.m[1][2];
208  m[2][0] = a.m[2][0] + b.m[2][0]; m[2][1] = a.m[2][1] + b.m[2][1]; m[2][2] = a.m[2][2] + b.m[2][2];
209  }
210 
211  inline_ void Sub(const Matrix3x3& a, const Matrix3x3& b)
212  {
213  m[0][0] = a.m[0][0] - b.m[0][0]; m[0][1] = a.m[0][1] - b.m[0][1]; m[0][2] = a.m[0][2] - b.m[0][2];
214  m[1][0] = a.m[1][0] - b.m[1][0]; m[1][1] = a.m[1][1] - b.m[1][1]; m[1][2] = a.m[1][2] - b.m[1][2];
215  m[2][0] = a.m[2][0] - b.m[2][0]; m[2][1] = a.m[2][1] - b.m[2][1]; m[2][2] = a.m[2][2] - b.m[2][2];
216  }
217 
219  inline_ void Mult(const Matrix3x3& a, const Matrix3x3& b)
220  {
221  m[0][0] = a.m[0][0] * b.m[0][0] + a.m[0][1] * b.m[1][0] + a.m[0][2] * b.m[2][0];
222  m[0][1] = a.m[0][0] * b.m[0][1] + a.m[0][1] * b.m[1][1] + a.m[0][2] * b.m[2][1];
223  m[0][2] = a.m[0][0] * b.m[0][2] + a.m[0][1] * b.m[1][2] + a.m[0][2] * b.m[2][2];
224  m[1][0] = a.m[1][0] * b.m[0][0] + a.m[1][1] * b.m[1][0] + a.m[1][2] * b.m[2][0];
225  m[1][1] = a.m[1][0] * b.m[0][1] + a.m[1][1] * b.m[1][1] + a.m[1][2] * b.m[2][1];
226  m[1][2] = a.m[1][0] * b.m[0][2] + a.m[1][1] * b.m[1][2] + a.m[1][2] * b.m[2][2];
227  m[2][0] = a.m[2][0] * b.m[0][0] + a.m[2][1] * b.m[1][0] + a.m[2][2] * b.m[2][0];
228  m[2][1] = a.m[2][0] * b.m[0][1] + a.m[2][1] * b.m[1][1] + a.m[2][2] * b.m[2][1];
229  m[2][2] = a.m[2][0] * b.m[0][2] + a.m[2][1] * b.m[1][2] + a.m[2][2] * b.m[2][2];
230  }
231 
233  inline_ void MultAtB(const Matrix3x3& a, const Matrix3x3& b)
234  {
235  m[0][0] = a.m[0][0] * b.m[0][0] + a.m[1][0] * b.m[1][0] + a.m[2][0] * b.m[2][0];
236  m[0][1] = a.m[0][0] * b.m[0][1] + a.m[1][0] * b.m[1][1] + a.m[2][0] * b.m[2][1];
237  m[0][2] = a.m[0][0] * b.m[0][2] + a.m[1][0] * b.m[1][2] + a.m[2][0] * b.m[2][2];
238  m[1][0] = a.m[0][1] * b.m[0][0] + a.m[1][1] * b.m[1][0] + a.m[2][1] * b.m[2][0];
239  m[1][1] = a.m[0][1] * b.m[0][1] + a.m[1][1] * b.m[1][1] + a.m[2][1] * b.m[2][1];
240  m[1][2] = a.m[0][1] * b.m[0][2] + a.m[1][1] * b.m[1][2] + a.m[2][1] * b.m[2][2];
241  m[2][0] = a.m[0][2] * b.m[0][0] + a.m[1][2] * b.m[1][0] + a.m[2][2] * b.m[2][0];
242  m[2][1] = a.m[0][2] * b.m[0][1] + a.m[1][2] * b.m[1][1] + a.m[2][2] * b.m[2][1];
243  m[2][2] = a.m[0][2] * b.m[0][2] + a.m[1][2] * b.m[1][2] + a.m[2][2] * b.m[2][2];
244  }
245 
247  inline_ void MultABt(const Matrix3x3& a, const Matrix3x3& b)
248  {
249  m[0][0] = a.m[0][0] * b.m[0][0] + a.m[0][1] * b.m[0][1] + a.m[0][2] * b.m[0][2];
250  m[0][1] = a.m[0][0] * b.m[1][0] + a.m[0][1] * b.m[1][1] + a.m[0][2] * b.m[1][2];
251  m[0][2] = a.m[0][0] * b.m[2][0] + a.m[0][1] * b.m[2][1] + a.m[0][2] * b.m[2][2];
252  m[1][0] = a.m[1][0] * b.m[0][0] + a.m[1][1] * b.m[0][1] + a.m[1][2] * b.m[0][2];
253  m[1][1] = a.m[1][0] * b.m[1][0] + a.m[1][1] * b.m[1][1] + a.m[1][2] * b.m[1][2];
254  m[1][2] = a.m[1][0] * b.m[2][0] + a.m[1][1] * b.m[2][1] + a.m[1][2] * b.m[2][2];
255  m[2][0] = a.m[2][0] * b.m[0][0] + a.m[2][1] * b.m[0][1] + a.m[2][2] * b.m[0][2];
256  m[2][1] = a.m[2][0] * b.m[1][0] + a.m[2][1] * b.m[1][1] + a.m[2][2] * b.m[1][2];
257  m[2][2] = a.m[2][0] * b.m[2][0] + a.m[2][1] * b.m[2][1] + a.m[2][2] * b.m[2][2];
258  }
259 
261  Matrix3x3& FromTo(const Point& from, const Point& to);
262 
267  void RotX(float angle);
272  void RotY(float angle);
277  void RotZ(float angle);
281  void RotYX(float y, float x);
282 
284  Matrix3x3& Rot(float angle, const Point& axis);
285 
287  void Transpose()
288  {
289  IR(m[1][0]) ^= IR(m[0][1]); IR(m[0][1]) ^= IR(m[1][0]); IR(m[1][0]) ^= IR(m[0][1]);
290  IR(m[2][0]) ^= IR(m[0][2]); IR(m[0][2]) ^= IR(m[2][0]); IR(m[2][0]) ^= IR(m[0][2]);
291  IR(m[2][1]) ^= IR(m[1][2]); IR(m[1][2]) ^= IR(m[2][1]); IR(m[2][1]) ^= IR(m[1][2]);
292  }
293 
295  void Transpose(const Matrix3x3& a)
296  {
297  m[0][0] = a.m[0][0]; m[0][1] = a.m[1][0]; m[0][2] = a.m[2][0];
298  m[1][0] = a.m[0][1]; m[1][1] = a.m[1][1]; m[1][2] = a.m[2][1];
299  m[2][0] = a.m[0][2]; m[2][1] = a.m[1][2]; m[2][2] = a.m[2][2];
300  }
301 
303  float Determinant() const
304  {
305  return (m[0][0]*m[1][1]*m[2][2] + m[0][1]*m[1][2]*m[2][0] + m[0][2]*m[1][0]*m[2][1])
306  - (m[2][0]*m[1][1]*m[0][2] + m[2][1]*m[1][2]*m[0][0] + m[2][2]*m[1][0]*m[0][1]);
307  }
308 /*
310  float CoFactor(ubyte row, ubyte column) const
311  {
312  static sdword gIndex[3+2] = { 0, 1, 2, 0, 1 };
313  return (m[gIndex[row+1]][gIndex[column+1]]*m[gIndex[row+2]][gIndex[column+2]] - m[gIndex[row+2]][gIndex[column+1]]*m[gIndex[row+1]][gIndex[column+2]]);
314  }
315 */
318  {
319  float Det = Determinant(); // Must be !=0
320  float OneOverDet = 1.0f / Det;
321 
322  Matrix3x3 Temp;
323  Temp.m[0][0] = +(m[1][1] * m[2][2] - m[2][1] * m[1][2]) * OneOverDet;
324  Temp.m[1][0] = -(m[1][0] * m[2][2] - m[2][0] * m[1][2]) * OneOverDet;
325  Temp.m[2][0] = +(m[1][0] * m[2][1] - m[2][0] * m[1][1]) * OneOverDet;
326  Temp.m[0][1] = -(m[0][1] * m[2][2] - m[2][1] * m[0][2]) * OneOverDet;
327  Temp.m[1][1] = +(m[0][0] * m[2][2] - m[2][0] * m[0][2]) * OneOverDet;
328  Temp.m[2][1] = -(m[0][0] * m[2][1] - m[2][0] * m[0][1]) * OneOverDet;
329  Temp.m[0][2] = +(m[0][1] * m[1][2] - m[1][1] * m[0][2]) * OneOverDet;
330  Temp.m[1][2] = -(m[0][0] * m[1][2] - m[1][0] * m[0][2]) * OneOverDet;
331  Temp.m[2][2] = +(m[0][0] * m[1][1] - m[1][0] * m[0][1]) * OneOverDet;
332 
333  *this = Temp;
334 
335  return *this;
336  }
337 
338  Matrix3x3& Normalize();
339 
341  Matrix3x3& Exp(const Matrix3x3& a);
342 
343 void FromQuat(const Quat &q);
344 void FromQuatL2(const Quat &q, float l2);
345 
346  // Arithmetic operators
349  {
350  return Matrix3x3(
351  m[0][0] + mat.m[0][0], m[0][1] + mat.m[0][1], m[0][2] + mat.m[0][2],
352  m[1][0] + mat.m[1][0], m[1][1] + mat.m[1][1], m[1][2] + mat.m[1][2],
353  m[2][0] + mat.m[2][0], m[2][1] + mat.m[2][1], m[2][2] + mat.m[2][2]);
354  }
355 
358  {
359  return Matrix3x3(
360  m[0][0] - mat.m[0][0], m[0][1] - mat.m[0][1], m[0][2] - mat.m[0][2],
361  m[1][0] - mat.m[1][0], m[1][1] - mat.m[1][1], m[1][2] - mat.m[1][2],
362  m[2][0] - mat.m[2][0], m[2][1] - mat.m[2][1], m[2][2] - mat.m[2][2]);
363  }
364 
367  {
368  return Matrix3x3(
369  m[0][0]*mat.m[0][0] + m[0][1]*mat.m[1][0] + m[0][2]*mat.m[2][0],
370  m[0][0]*mat.m[0][1] + m[0][1]*mat.m[1][1] + m[0][2]*mat.m[2][1],
371  m[0][0]*mat.m[0][2] + m[0][1]*mat.m[1][2] + m[0][2]*mat.m[2][2],
372 
373  m[1][0]*mat.m[0][0] + m[1][1]*mat.m[1][0] + m[1][2]*mat.m[2][0],
374  m[1][0]*mat.m[0][1] + m[1][1]*mat.m[1][1] + m[1][2]*mat.m[2][1],
375  m[1][0]*mat.m[0][2] + m[1][1]*mat.m[1][2] + m[1][2]*mat.m[2][2],
376 
377  m[2][0]*mat.m[0][0] + m[2][1]*mat.m[1][0] + m[2][2]*mat.m[2][0],
378  m[2][0]*mat.m[0][1] + m[2][1]*mat.m[1][1] + m[2][2]*mat.m[2][1],
379  m[2][0]*mat.m[0][2] + m[2][1]*mat.m[1][2] + m[2][2]*mat.m[2][2]);
380  }
381 
383  inline_ Point operator*(const Point& v) const { return Point(GetRow(0)|v, GetRow(1)|v, GetRow(2)|v); }
384 
386  inline_ Matrix3x3 operator*(float s) const
387  {
388  return Matrix3x3(
389  m[0][0]*s, m[0][1]*s, m[0][2]*s,
390  m[1][0]*s, m[1][1]*s, m[1][2]*s,
391  m[2][0]*s, m[2][1]*s, m[2][2]*s);
392  }
393 
395  inline_ friend Matrix3x3 operator*(float s, const Matrix3x3& mat)
396  {
397  return Matrix3x3(
398  s*mat.m[0][0], s*mat.m[0][1], s*mat.m[0][2],
399  s*mat.m[1][0], s*mat.m[1][1], s*mat.m[1][2],
400  s*mat.m[2][0], s*mat.m[2][1], s*mat.m[2][2]);
401  }
402 
404  inline_ Matrix3x3 operator/(float s) const
405  {
406  if (s) s = 1.0f / s;
407  return Matrix3x3(
408  m[0][0]*s, m[0][1]*s, m[0][2]*s,
409  m[1][0]*s, m[1][1]*s, m[1][2]*s,
410  m[2][0]*s, m[2][1]*s, m[2][2]*s);
411  }
412 
414  inline_ friend Matrix3x3 operator/(float s, const Matrix3x3& mat)
415  {
416  return Matrix3x3(
417  s/mat.m[0][0], s/mat.m[0][1], s/mat.m[0][2],
418  s/mat.m[1][0], s/mat.m[1][1], s/mat.m[1][2],
419  s/mat.m[2][0], s/mat.m[2][1], s/mat.m[2][2]);
420  }
421 
424  {
425  m[0][0] += mat.m[0][0]; m[0][1] += mat.m[0][1]; m[0][2] += mat.m[0][2];
426  m[1][0] += mat.m[1][0]; m[1][1] += mat.m[1][1]; m[1][2] += mat.m[1][2];
427  m[2][0] += mat.m[2][0]; m[2][1] += mat.m[2][1]; m[2][2] += mat.m[2][2];
428  return *this;
429  }
430 
433  {
434  m[0][0] -= mat.m[0][0]; m[0][1] -= mat.m[0][1]; m[0][2] -= mat.m[0][2];
435  m[1][0] -= mat.m[1][0]; m[1][1] -= mat.m[1][1]; m[1][2] -= mat.m[1][2];
436  m[2][0] -= mat.m[2][0]; m[2][1] -= mat.m[2][1]; m[2][2] -= mat.m[2][2];
437  return *this;
438  }
439 
442  {
443  Point TempRow;
444 
445  GetRow(0, TempRow);
446  m[0][0] = TempRow.x*mat.m[0][0] + TempRow.y*mat.m[1][0] + TempRow.z*mat.m[2][0];
447  m[0][1] = TempRow.x*mat.m[0][1] + TempRow.y*mat.m[1][1] + TempRow.z*mat.m[2][1];
448  m[0][2] = TempRow.x*mat.m[0][2] + TempRow.y*mat.m[1][2] + TempRow.z*mat.m[2][2];
449 
450  GetRow(1, TempRow);
451  m[1][0] = TempRow.x*mat.m[0][0] + TempRow.y*mat.m[1][0] + TempRow.z*mat.m[2][0];
452  m[1][1] = TempRow.x*mat.m[0][1] + TempRow.y*mat.m[1][1] + TempRow.z*mat.m[2][1];
453  m[1][2] = TempRow.x*mat.m[0][2] + TempRow.y*mat.m[1][2] + TempRow.z*mat.m[2][2];
454 
455  GetRow(2, TempRow);
456  m[2][0] = TempRow.x*mat.m[0][0] + TempRow.y*mat.m[1][0] + TempRow.z*mat.m[2][0];
457  m[2][1] = TempRow.x*mat.m[0][1] + TempRow.y*mat.m[1][1] + TempRow.z*mat.m[2][1];
458  m[2][2] = TempRow.x*mat.m[0][2] + TempRow.y*mat.m[1][2] + TempRow.z*mat.m[2][2];
459  return *this;
460  }
461 
464  {
465  m[0][0] *= s; m[0][1] *= s; m[0][2] *= s;
466  m[1][0] *= s; m[1][1] *= s; m[1][2] *= s;
467  m[2][0] *= s; m[2][1] *= s; m[2][2] *= s;
468  return *this;
469  }
470 
473  {
474  if (s) s = 1.0f / s;
475  m[0][0] *= s; m[0][1] *= s; m[0][2] *= s;
476  m[1][0] *= s; m[1][1] *= s; m[1][2] *= s;
477  m[2][0] *= s; m[2][1] *= s; m[2][2] *= s;
478  return *this;
479  }
480 
481  // Cast operators
483  operator Matrix4x4() const;
485  operator Quat() const;
486 
487  inline_ const Point& operator[](int row) const { return *(const Point*)&m[row][0]; }
488  inline_ Point& operator[](int row) { return *(Point*)&m[row][0]; }
489 
490  public:
491 
492  float m[3][3];
493  };
494 
495 #endif // __ICEMATRIX3X3_H__
496 
#define IR(x)
Integer representation of a floating-point value.
Definition: IceFPU.h:18
inline_ void Mac(const Matrix3x3 &a, float s)
Mac.
Definition: IceMatrix3x3.h:189
int c
Definition: autoplay.py:16
inline_ const Point & operator[](int row) const
Definition: IceMatrix3x3.h:487
inline_ friend Matrix3x3 operator/(float s, const Matrix3x3 &mat)
Operator for Matrix3x3 Div = float / Matrix3x3;.
Definition: IceMatrix3x3.h:414
inline_ void Sub(const Matrix3x3 &a, const Matrix3x3 &b)
Definition: IceMatrix3x3.h:211
#define FALSE
Definition: OPC_IceHook.h:9
inline_ Matrix3x3 & operator*=(const Matrix3x3 &mat)
Operator for Matrix3x3 *= Matrix3x3.
Definition: IceMatrix3x3.h:441
* x
Definition: IceUtils.h:98
inline_ Matrix3x3 & operator+=(const Matrix3x3 &mat)
Operator for Matrix3x3 += Matrix3x3.
Definition: IceMatrix3x3.h:423
inline_ void Sub(const Matrix3x3 &mat)
Sub another matrix.
Definition: IceMatrix3x3.h:167
float m[3][3]
Definition: IceMatrix3x3.h:492
inline_ Matrix3x3()
Empty constructor.
Definition: IceMatrix3x3.h:24
inline_ void Identity()
Sets the identity matrix.
Definition: IceMatrix3x3.h:89
inline_ void SetScale(const Point &p)
Sets the scale from a Point. The point is put on the diagonal.
Definition: IceMatrix3x3.h:46
inline_ Matrix3x3 & operator*=(float s)
Operator for Matrix3x3 *= float.
Definition: IceMatrix3x3.h:463
#define TRUE
Definition: OPC_IceHook.h:13
#define inline_
inline_ Point & operator[](int row)
Definition: IceMatrix3x3.h:488
inline_ const Point & GetRow(const udword r) const
Returns a row.
Definition: IceMatrix3x3.h:74
float Determinant() const
Compute the determinant of the matrix. We use the rule of Sarrus.
Definition: IceMatrix3x3.h:303
float z
Definition: IcePoint.h:524
inline_ void Scale(const Point &p)
Scales from a Point. Each row is multiplied by a component.
Definition: IceMatrix3x3.h:52
png_uint_32 i
Definition: png.h:2735
Definition: IcePoint.h:25
#define ICEMATHS_API
Definition: OPC_IceHook.h:51
inline_ void Neg()
Negates the matrix.
Definition: IceMatrix3x3.h:143
long b
Definition: jpegint.h:371
inline_ void Copy(const Matrix3x3 &source)
Copy from a Matrix3x3.
Definition: IceMatrix3x3.h:68
inline_ void SkewSymmetric(const Point &a)
Definition: IceMatrix3x3.h:127
inline_ friend Matrix3x3 operator*(float s, const Matrix3x3 &mat)
Operator for Matrix3x3 Mul = float * Matrix3x3;.
Definition: IceMatrix3x3.h:395
inline_ Matrix3x3 operator+(const Matrix3x3 &mat) const
Operator for Matrix3x3 Plus = Matrix3x3 + Matrix3x3;.
Definition: IceMatrix3x3.h:348
inline_ Matrix3x3 & operator/=(float s)
Operator for Matrix3x3 /= float.
Definition: IceMatrix3x3.h:472
int BOOL
Another boolean type.
Definition: IceTypes.h:102
float x
Definition: IcePoint.h:524
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
inline_ ~Matrix3x3()
Destructor.
Definition: IceMatrix3x3.h:35
inline_ Point & GetRow(const udword r)
Returns a row.
Definition: IceMatrix3x3.h:76
Matrix3x3 & Invert()
Invert the matrix. Determinant must be different from zero, else matrix can&#39;t be inverted.
Definition: IceMatrix3x3.h:317
inline_ void Add(const Matrix3x3 &mat)
Add another matrix.
Definition: IceMatrix3x3.h:159
inline_ void SetCol(const udword c, const Point &p)
Sets a column.
Definition: IceMatrix3x3.h:82
inline_ void Add(const Matrix3x3 &a, const Matrix3x3 &b)
Definition: IceMatrix3x3.h:204
inline_ Matrix3x3 operator*(float s) const
Operator for Matrix3x3 Mul = Matrix3x3 * float;.
Definition: IceMatrix3x3.h:386
inline_ void MultABt(const Matrix3x3 &a, const Matrix3x3 &b)
this = a * transpose(b)
Definition: IceMatrix3x3.h:247
string a
png_bytepp row
Definition: png.h:1759
inline_ bool IsIdentity() const
Checks for identity.
Definition: IceMatrix3x3.h:91
inline_ Matrix3x3 operator-(const Matrix3x3 &mat) const
Operator for Matrix3x3 Minus = Matrix3x3 - Matrix3x3;.
Definition: IceMatrix3x3.h:357
inline_ bool IsValidFloat(float value)
Definition: IceFPU.h:131
inline_ void SetRow(const udword r, const Point &p)
Sets a row.
Definition: IceMatrix3x3.h:78
inline_ float Trace() const
Computes the trace. The trace is the sum of the 3 diagonal components.
Definition: IceMatrix3x3.h:85
inline_ void Mac(const Matrix3x3 &a, const Matrix3x3 &b, float s)
Mac.
Definition: IceMatrix3x3.h:174
inline_ Matrix3x3(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
Constructor from 9 values.
Definition: IceMatrix3x3.h:26
inline_ void SetScale(float sx, float sy, float sz)
Sets the scale from floats. Values are put on the diagonal.
Definition: IceMatrix3x3.h:49
inline_ Matrix3x3(const Matrix3x3 &mat)
Copy constructor.
Definition: IceMatrix3x3.h:33
inline_ void Mult(const Matrix3x3 &a, const Matrix3x3 &b)
this = a * b
Definition: IceMatrix3x3.h:219
inline_ void MultAtB(const Matrix3x3 &a, const Matrix3x3 &b)
this = transpose(a) * b
Definition: IceMatrix3x3.h:233
float y
Definition: IcePoint.h:524
inline_ void CopyMemory(void *dest, const void *src, udword size)
inline_ void GetRow(const udword r, Point &p) const
Returns a row.
Definition: IceMatrix3x3.h:72
inline_ Matrix3x3 operator/(float s) const
Operator for Matrix3x3 Div = Matrix3x3 / float;.
Definition: IceMatrix3x3.h:404
inline_ void GetCol(const udword c, Point &p) const
Returns a column.
Definition: IceMatrix3x3.h:80
inline_ Matrix3x3 & operator-=(const Matrix3x3 &mat)
Operator for Matrix3x3 -= Matrix3x3.
Definition: IceMatrix3x3.h:432
#define IEEE_1_0
integer representation of 1.0
Definition: IceTypes.h:132
inline_ void ZeroMemory(void *addr, udword size)
inline_ BOOL IsValid() const
Checks matrix validity.
Definition: IceMatrix3x3.h:109
inline_ void Set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
Assign values.
Definition: IceMatrix3x3.h:38
inline_ void Neg(const Matrix3x3 &mat)
Neg from another matrix.
Definition: IceMatrix3x3.h:151
void Transpose(const Matrix3x3 &a)
this = Transpose(a)
Definition: IceMatrix3x3.h:295
void Transpose()
Transpose the matrix.
Definition: IceMatrix3x3.h:287
inline_ void Mult(const Matrix3x3 &a, float s)
this = A * s
Definition: IceMatrix3x3.h:197
* y
Definition: IceUtils.h:97
inline_ Matrix3x3 operator*(const Matrix3x3 &mat) const
Operator for Matrix3x3 Mul = Matrix3x3 * Matrix3x3;.
Definition: IceMatrix3x3.h:366
inline_ void Zero()
Clears the matrix.
Definition: IceMatrix3x3.h:87
inline_ Point operator*(const Point &v) const
Operator for Point Mul = Matrix3x3 * Point;.
Definition: IceMatrix3x3.h:383
inline_ void Scale(float sx, float sy, float sz)
Scales from floats. Each row is multiplied by a value.
Definition: IceMatrix3x3.h:60


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:03