IceMatrix4x4.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICEMATRIX4X4_H__
13 #define __ICEMATRIX4X4_H__
14 
15  // Forward declarations
16  class PRS;
17  class PR;
18 
19  #define MATRIX4X4_EPSILON (1.0e-7f)
20 
22  {
23 // void LUBackwardSubstitution( sdword *indx, float* b );
24 // void LUDecomposition( sdword* indx, float* d );
25 
26  public:
30  inline_ Matrix4x4( float m00, float m01, float m02, float m03,
31  float m10, float m11, float m12, float m13,
32  float m20, float m21, float m22, float m23,
33  float m30, float m31, float m32, float m33)
34  {
35  m[0][0] = m00; m[0][1] = m01; m[0][2] = m02; m[0][3] = m03;
36  m[1][0] = m10; m[1][1] = m11; m[1][2] = m12; m[1][3] = m13;
37  m[2][0] = m20; m[2][1] = m21; m[2][2] = m22; m[2][3] = m23;
38  m[3][0] = m30; m[3][1] = m31; m[3][2] = m32; m[3][3] = m33;
39  }
41  inline_ Matrix4x4(const Matrix4x4& mat) { CopyMemory(m, &mat.m, 16*sizeof(float)); }
44 
46  inline_ Matrix4x4& Set( float m00, float m01, float m02,
47  float m10, float m11, float m12,
48  float m20, float m21, float m22)
49  {
50  m[0][0] = m00; m[0][1] = m01; m[0][2] = m02;
51  m[1][0] = m10; m[1][1] = m11; m[1][2] = m12;
52  m[2][0] = m20; m[2][1] = m21; m[2][2] = m22;
53  return *this;
54  }
56  inline_ Matrix4x4& Set( float m00, float m01, float m02, float m03,
57  float m10, float m11, float m12, float m13,
58  float m20, float m21, float m22, float m23,
59  float m30, float m31, float m32, float m33)
60  {
61  m[0][0] = m00; m[0][1] = m01; m[0][2] = m02; m[0][3] = m03;
62  m[1][0] = m10; m[1][1] = m11; m[1][2] = m12; m[1][3] = m13;
63  m[2][0] = m20; m[2][1] = m21; m[2][2] = m22; m[2][3] = m23;
64  m[3][0] = m30; m[3][1] = m31; m[3][2] = m32; m[3][3] = m33;
65  return *this;
66  }
67 
69  inline_ void Copy(const Matrix4x4& source) { CopyMemory(m, source.m, 16*sizeof(float)); }
70 
71  // Row-column access
73  inline_ void GetRow(const udword r, HPoint& p) const { p.x=m[r][0]; p.y=m[r][1]; p.z=m[r][2]; p.w=m[r][3]; }
75  inline_ void GetRow(const udword r, Point& p) const { p.x=m[r][0]; p.y=m[r][1]; p.z=m[r][2]; }
77  inline_ const HPoint& GetRow(const udword r) const { return *(const HPoint*)&m[r][0]; }
79  inline_ HPoint& GetRow(const udword r) { return *(HPoint*)&m[r][0]; }
81  inline_ void SetRow(const udword r, const HPoint& p) { m[r][0]=p.x; m[r][1]=p.y; m[r][2]=p.z; m[r][3]=p.w; }
83  inline_ void SetRow(const udword r, const Point& p) { m[r][0]=p.x; m[r][1]=p.y; m[r][2]=p.z; m[r][3]= (r!=3) ? 0.0f : 1.0f; }
85  inline_ void GetCol(const udword c, HPoint& p) const { p.x=m[0][c]; p.y=m[1][c]; p.z=m[2][c]; p.w=m[3][c]; }
87  inline_ void GetCol(const udword c, Point& p) const { p.x=m[0][c]; p.y=m[1][c]; p.z=m[2][c]; }
89  inline_ void SetCol(const udword c, const HPoint& p) { m[0][c]=p.x; m[1][c]=p.y; m[2][c]=p.z; m[3][c]=p.w; }
91  inline_ void SetCol(const udword c, const Point& p) { m[0][c]=p.x; m[1][c]=p.y; m[2][c]=p.z; m[3][c]= (c!=3) ? 0.0f : 1.0f; }
92 
93  // Translation
95  inline_ const HPoint& GetTrans() const { return GetRow(3); }
97  inline_ void GetTrans(Point& p) const { p.x=m[3][0]; p.y=m[3][1]; p.z=m[3][2]; }
99  inline_ void SetTrans(const Point& p) { m[3][0]=p.x; m[3][1]=p.y; m[3][2]=p.z; }
101  inline_ void SetTrans(const HPoint& p) { m[3][0]=p.x; m[3][1]=p.y; m[3][2]=p.z; m[3][3]=p.w; }
103  inline_ void SetTrans(float tx, float ty, float tz) { m[3][0]=tx; m[3][1]=ty; m[3][2]=tz; }
104 
105  // Scale
107  inline_ void SetScale(const Point& p) { m[0][0]=p.x; m[1][1]=p.y; m[2][2]=p.z; }
109  inline_ void SetScale(float sx, float sy, float sz) { m[0][0]=sx; m[1][1]=sy; m[2][2]=sz; }
111  void Scale(const Point& p)
112  {
113  m[0][0] *= p.x; m[1][0] *= p.y; m[2][0] *= p.z;
114  m[0][1] *= p.x; m[1][1] *= p.y; m[2][1] *= p.z;
115  m[0][2] *= p.x; m[1][2] *= p.y; m[2][2] *= p.z;
116  }
118  void Scale(float sx, float sy, float sz)
119  {
120  m[0][0] *= sx; m[1][0] *= sy; m[2][0] *= sz;
121  m[0][1] *= sx; m[1][1] *= sy; m[2][1] *= sz;
122  m[0][2] *= sx; m[1][2] *= sy; m[2][2] *= sz;
123  }
124 /*
126  inline_ HPoint GetRow(const udword row) const { return mRow[row]; }
128  inline_ Matrix4x4& SetRow(const udword row, const HPoint& p) { mRow[row] = p; return *this; }
130  Matrix4x4& SetRow(const udword row, const Point& p)
131  {
132  m[row][0] = p.x;
133  m[row][1] = p.y;
134  m[row][2] = p.z;
135  m[row][3] = (row != 3) ? 0.0f : 1.0f;
136  return *this;
137  }
139  HPoint GetCol(const udword col) const
140  {
141  HPoint Res;
142  Res.x = m[0][col];
143  Res.y = m[1][col];
144  Res.z = m[2][col];
145  Res.w = m[3][col];
146  return Res;
147  }
149  Matrix4x4& SetCol(const udword col, const HPoint& p)
150  {
151  m[0][col] = p.x;
152  m[1][col] = p.y;
153  m[2][col] = p.z;
154  m[3][col] = p.w;
155  return *this;
156  }
158  Matrix4x4& SetCol(const udword col, const Point& p)
159  {
160  m[0][col] = p.x;
161  m[1][col] = p.y;
162  m[2][col] = p.z;
163  m[3][col] = (col != 3) ? 0.0f : 1.0f;
164  return *this;
165  }
166 */
168  inline_ float Trace() const { return m[0][0] + m[1][1] + m[2][2] + m[3][3]; }
170  inline_ float Trace3x3() const { return m[0][0] + m[1][1] + m[2][2]; }
172  inline_ void Zero() { ZeroMemory(&m, sizeof(m)); }
174  inline_ void Identity() { Zero(); m[0][0] = m[1][1] = m[2][2] = m[3][3] = 1.0f; }
176  inline_ bool IsIdentity() const
177  {
178  if(IR(m[0][0])!=IEEE_1_0) return false;
179  if(IR(m[0][1])!=0) return false;
180  if(IR(m[0][2])!=0) return false;
181  if(IR(m[0][3])!=0) return false;
182 
183  if(IR(m[1][0])!=0) return false;
184  if(IR(m[1][1])!=IEEE_1_0) return false;
185  if(IR(m[1][2])!=0) return false;
186  if(IR(m[1][3])!=0) return false;
187 
188  if(IR(m[2][0])!=0) return false;
189  if(IR(m[2][1])!=0) return false;
190  if(IR(m[2][2])!=IEEE_1_0) return false;
191  if(IR(m[2][3])!=0) return false;
192 
193  if(IR(m[3][0])!=0) return false;
194  if(IR(m[3][1])!=0) return false;
195  if(IR(m[3][2])!=0) return false;
196  if(IR(m[3][3])!=IEEE_1_0) return false;
197  return true;
198  }
199 
202  {
203  for(udword j=0;j<4;j++)
204  {
205  for(udword i=0;i<4;i++)
206  {
207  if(!IsValidFloat(m[j][i])) return FALSE;
208  }
209  }
210  return TRUE;
211  }
212 
214  void RotX(float angle) { float Cos = cosf(angle), Sin = sinf(angle); Identity(); m[1][1] = m[2][2] = Cos; m[2][1] = -Sin; m[1][2] = Sin; }
216  void RotY(float angle) { float Cos = cosf(angle), Sin = sinf(angle); Identity(); m[0][0] = m[2][2] = Cos; m[2][0] = Sin; m[0][2] = -Sin; }
218  void RotZ(float angle) { float Cos = cosf(angle), Sin = sinf(angle); Identity(); m[0][0] = m[1][1] = Cos; m[1][0] = -Sin; m[0][1] = Sin; }
219 
221  Matrix4x4& Rot(float angle, Point& p1, Point& p2);
222 
224  void Transpose()
225  {
226  IR(m[1][0]) ^= IR(m[0][1]); IR(m[0][1]) ^= IR(m[1][0]); IR(m[1][0]) ^= IR(m[0][1]);
227  IR(m[2][0]) ^= IR(m[0][2]); IR(m[0][2]) ^= IR(m[2][0]); IR(m[2][0]) ^= IR(m[0][2]);
228  IR(m[3][0]) ^= IR(m[0][3]); IR(m[0][3]) ^= IR(m[3][0]); IR(m[3][0]) ^= IR(m[0][3]);
229  IR(m[1][2]) ^= IR(m[2][1]); IR(m[2][1]) ^= IR(m[1][2]); IR(m[1][2]) ^= IR(m[2][1]);
230  IR(m[1][3]) ^= IR(m[3][1]); IR(m[3][1]) ^= IR(m[1][3]); IR(m[1][3]) ^= IR(m[3][1]);
231  IR(m[2][3]) ^= IR(m[3][2]); IR(m[3][2]) ^= IR(m[2][3]); IR(m[2][3]) ^= IR(m[3][2]);
232  }
233 
235  float CoFactor(udword row, udword col) const;
237  float Determinant() const;
239  Matrix4x4& Invert();
240 // Matrix& ComputeAxisMatrix(Point& axis, float angle);
241 
242  // Cast operators
244  inline_ operator Matrix3x3() const
245  {
246  return Matrix3x3(
247  m[0][0], m[0][1], m[0][2],
248  m[1][0], m[1][1], m[1][2],
249  m[2][0], m[2][1], m[2][2]);
250  }
252  operator Quat() const;
254  operator PR() const;
255 
256  // Arithmetic operators
259  {
260  return Matrix4x4(
261  m[0][0]+mat.m[0][0], m[0][1]+mat.m[0][1], m[0][2]+mat.m[0][2], m[0][3]+mat.m[0][3],
262  m[1][0]+mat.m[1][0], m[1][1]+mat.m[1][1], m[1][2]+mat.m[1][2], m[1][3]+mat.m[1][3],
263  m[2][0]+mat.m[2][0], m[2][1]+mat.m[2][1], m[2][2]+mat.m[2][2], m[2][3]+mat.m[2][3],
264  m[3][0]+mat.m[3][0], m[3][1]+mat.m[3][1], m[3][2]+mat.m[3][2], m[3][3]+mat.m[3][3]);
265  }
266 
269  {
270  return Matrix4x4(
271  m[0][0]-mat.m[0][0], m[0][1]-mat.m[0][1], m[0][2]-mat.m[0][2], m[0][3]-mat.m[0][3],
272  m[1][0]-mat.m[1][0], m[1][1]-mat.m[1][1], m[1][2]-mat.m[1][2], m[1][3]-mat.m[1][3],
273  m[2][0]-mat.m[2][0], m[2][1]-mat.m[2][1], m[2][2]-mat.m[2][2], m[2][3]-mat.m[2][3],
274  m[3][0]-mat.m[3][0], m[3][1]-mat.m[3][1], m[3][2]-mat.m[3][2], m[3][3]-mat.m[3][3]);
275  }
276 
279  {
280  return Matrix4x4(
281  m[0][0]*mat.m[0][0] + m[0][1]*mat.m[1][0] + m[0][2]*mat.m[2][0] + m[0][3]*mat.m[3][0],
282  m[0][0]*mat.m[0][1] + m[0][1]*mat.m[1][1] + m[0][2]*mat.m[2][1] + m[0][3]*mat.m[3][1],
283  m[0][0]*mat.m[0][2] + m[0][1]*mat.m[1][2] + m[0][2]*mat.m[2][2] + m[0][3]*mat.m[3][2],
284  m[0][0]*mat.m[0][3] + m[0][1]*mat.m[1][3] + m[0][2]*mat.m[2][3] + m[0][3]*mat.m[3][3],
285 
286  m[1][0]*mat.m[0][0] + m[1][1]*mat.m[1][0] + m[1][2]*mat.m[2][0] + m[1][3]*mat.m[3][0],
287  m[1][0]*mat.m[0][1] + m[1][1]*mat.m[1][1] + m[1][2]*mat.m[2][1] + m[1][3]*mat.m[3][1],
288  m[1][0]*mat.m[0][2] + m[1][1]*mat.m[1][2] + m[1][2]*mat.m[2][2] + m[1][3]*mat.m[3][2],
289  m[1][0]*mat.m[0][3] + m[1][1]*mat.m[1][3] + m[1][2]*mat.m[2][3] + m[1][3]*mat.m[3][3],
290 
291  m[2][0]*mat.m[0][0] + m[2][1]*mat.m[1][0] + m[2][2]*mat.m[2][0] + m[2][3]*mat.m[3][0],
292  m[2][0]*mat.m[0][1] + m[2][1]*mat.m[1][1] + m[2][2]*mat.m[2][1] + m[2][3]*mat.m[3][1],
293  m[2][0]*mat.m[0][2] + m[2][1]*mat.m[1][2] + m[2][2]*mat.m[2][2] + m[2][3]*mat.m[3][2],
294  m[2][0]*mat.m[0][3] + m[2][1]*mat.m[1][3] + m[2][2]*mat.m[2][3] + m[2][3]*mat.m[3][3],
295 
296  m[3][0]*mat.m[0][0] + m[3][1]*mat.m[1][0] + m[3][2]*mat.m[2][0] + m[3][3]*mat.m[3][0],
297  m[3][0]*mat.m[0][1] + m[3][1]*mat.m[1][1] + m[3][2]*mat.m[2][1] + m[3][3]*mat.m[3][1],
298  m[3][0]*mat.m[0][2] + m[3][1]*mat.m[1][2] + m[3][2]*mat.m[2][2] + m[3][3]*mat.m[3][2],
299  m[3][0]*mat.m[0][3] + m[3][1]*mat.m[1][3] + m[3][2]*mat.m[2][3] + m[3][3]*mat.m[3][3]);
300  }
301 
303  inline_ HPoint operator*(const HPoint& v) const { return HPoint(GetRow(0)|v, GetRow(1)|v, GetRow(2)|v, GetRow(3)|v); }
304 
306  inline_ Point operator*(const Point& v) const
307  {
308  return Point( m[0][0]*v.x + m[0][1]*v.y + m[0][2]*v.z + m[0][3],
309  m[1][0]*v.x + m[1][1]*v.y + m[1][2]*v.z + m[1][3],
310  m[2][0]*v.x + m[2][1]*v.y + m[2][2]*v.z + m[2][3] );
311  }
312 
314  inline_ Matrix4x4 operator*(float s) const
315  {
316  return Matrix4x4(
317  m[0][0]*s, m[0][1]*s, m[0][2]*s, m[0][3]*s,
318  m[1][0]*s, m[1][1]*s, m[1][2]*s, m[1][3]*s,
319  m[2][0]*s, m[2][1]*s, m[2][2]*s, m[2][3]*s,
320  m[3][0]*s, m[3][1]*s, m[3][2]*s, m[3][3]*s);
321  }
322 
324  inline_ friend Matrix4x4 operator*(float s, const Matrix4x4& mat)
325  {
326  return Matrix4x4(
327  s*mat.m[0][0], s*mat.m[0][1], s*mat.m[0][2], s*mat.m[0][3],
328  s*mat.m[1][0], s*mat.m[1][1], s*mat.m[1][2], s*mat.m[1][3],
329  s*mat.m[2][0], s*mat.m[2][1], s*mat.m[2][2], s*mat.m[2][3],
330  s*mat.m[3][0], s*mat.m[3][1], s*mat.m[3][2], s*mat.m[3][3]);
331  }
332 
334  inline_ Matrix4x4 operator/(float s) const
335  {
336  if(s) s = 1.0f / s;
337 
338  return Matrix4x4(
339  m[0][0]*s, m[0][1]*s, m[0][2]*s, m[0][3]*s,
340  m[1][0]*s, m[1][1]*s, m[1][2]*s, m[1][3]*s,
341  m[2][0]*s, m[2][1]*s, m[2][2]*s, m[2][3]*s,
342  m[3][0]*s, m[3][1]*s, m[3][2]*s, m[3][3]*s);
343  }
344 
346  inline_ friend Matrix4x4 operator/(float s, const Matrix4x4& mat)
347  {
348  return Matrix4x4(
349  s/mat.m[0][0], s/mat.m[0][1], s/mat.m[0][2], s/mat.m[0][3],
350  s/mat.m[1][0], s/mat.m[1][1], s/mat.m[1][2], s/mat.m[1][3],
351  s/mat.m[2][0], s/mat.m[2][1], s/mat.m[2][2], s/mat.m[2][3],
352  s/mat.m[3][0], s/mat.m[3][1], s/mat.m[3][2], s/mat.m[3][3]);
353  }
354 
357  {
358  m[0][0]+=mat.m[0][0]; m[0][1]+=mat.m[0][1]; m[0][2]+=mat.m[0][2]; m[0][3]+=mat.m[0][3];
359  m[1][0]+=mat.m[1][0]; m[1][1]+=mat.m[1][1]; m[1][2]+=mat.m[1][2]; m[1][3]+=mat.m[1][3];
360  m[2][0]+=mat.m[2][0]; m[2][1]+=mat.m[2][1]; m[2][2]+=mat.m[2][2]; m[2][3]+=mat.m[2][3];
361  m[3][0]+=mat.m[3][0]; m[3][1]+=mat.m[3][1]; m[3][2]+=mat.m[3][2]; m[3][3]+=mat.m[3][3];
362  return *this;
363  }
364 
367  {
368  m[0][0]-=mat.m[0][0]; m[0][1]-=mat.m[0][1]; m[0][2]-=mat.m[0][2]; m[0][3]-=mat.m[0][3];
369  m[1][0]-=mat.m[1][0]; m[1][1]-=mat.m[1][1]; m[1][2]-=mat.m[1][2]; m[1][3]-=mat.m[1][3];
370  m[2][0]-=mat.m[2][0]; m[2][1]-=mat.m[2][1]; m[2][2]-=mat.m[2][2]; m[2][3]-=mat.m[2][3];
371  m[3][0]-=mat.m[3][0]; m[3][1]-=mat.m[3][1]; m[3][2]-=mat.m[3][2]; m[3][3]-=mat.m[3][3];
372  return *this;
373  }
374 
377  {
378  HPoint TempRow;
379 
380  GetRow(0, TempRow);
381  m[0][0] = TempRow.x*mat.m[0][0] + TempRow.y*mat.m[1][0] + TempRow.z*mat.m[2][0] + TempRow.w*mat.m[3][0];
382  m[0][1] = TempRow.x*mat.m[0][1] + TempRow.y*mat.m[1][1] + TempRow.z*mat.m[2][1] + TempRow.w*mat.m[3][1];
383  m[0][2] = TempRow.x*mat.m[0][2] + TempRow.y*mat.m[1][2] + TempRow.z*mat.m[2][2] + TempRow.w*mat.m[3][2];
384  m[0][3] = TempRow.x*mat.m[0][3] + TempRow.y*mat.m[1][3] + TempRow.z*mat.m[2][3] + TempRow.w*mat.m[3][3];
385 
386  GetRow(1, TempRow);
387  m[1][0] = TempRow.x*mat.m[0][0] + TempRow.y*mat.m[1][0] + TempRow.z*mat.m[2][0] + TempRow.w*mat.m[3][0];
388  m[1][1] = TempRow.x*mat.m[0][1] + TempRow.y*mat.m[1][1] + TempRow.z*mat.m[2][1] + TempRow.w*mat.m[3][1];
389  m[1][2] = TempRow.x*mat.m[0][2] + TempRow.y*mat.m[1][2] + TempRow.z*mat.m[2][2] + TempRow.w*mat.m[3][2];
390  m[1][3] = TempRow.x*mat.m[0][3] + TempRow.y*mat.m[1][3] + TempRow.z*mat.m[2][3] + TempRow.w*mat.m[3][3];
391 
392  GetRow(2, TempRow);
393  m[2][0] = TempRow.x*mat.m[0][0] + TempRow.y*mat.m[1][0] + TempRow.z*mat.m[2][0] + TempRow.w*mat.m[3][0];
394  m[2][1] = TempRow.x*mat.m[0][1] + TempRow.y*mat.m[1][1] + TempRow.z*mat.m[2][1] + TempRow.w*mat.m[3][1];
395  m[2][2] = TempRow.x*mat.m[0][2] + TempRow.y*mat.m[1][2] + TempRow.z*mat.m[2][2] + TempRow.w*mat.m[3][2];
396  m[2][3] = TempRow.x*mat.m[0][3] + TempRow.y*mat.m[1][3] + TempRow.z*mat.m[2][3] + TempRow.w*mat.m[3][3];
397 
398  GetRow(3, TempRow);
399  m[3][0] = TempRow.x*mat.m[0][0] + TempRow.y*mat.m[1][0] + TempRow.z*mat.m[2][0] + TempRow.w*mat.m[3][0];
400  m[3][1] = TempRow.x*mat.m[0][1] + TempRow.y*mat.m[1][1] + TempRow.z*mat.m[2][1] + TempRow.w*mat.m[3][1];
401  m[3][2] = TempRow.x*mat.m[0][2] + TempRow.y*mat.m[1][2] + TempRow.z*mat.m[2][2] + TempRow.w*mat.m[3][2];
402  m[3][3] = TempRow.x*mat.m[0][3] + TempRow.y*mat.m[1][3] + TempRow.z*mat.m[2][3] + TempRow.w*mat.m[3][3];
403 
404  return *this;
405  }
406 
409  {
410  m[0][0]*=s; m[0][1]*=s; m[0][2]*=s; m[0][3]*=s;
411  m[1][0]*=s; m[1][1]*=s; m[1][2]*=s; m[1][3]*=s;
412  m[2][0]*=s; m[2][1]*=s; m[2][2]*=s; m[2][3]*=s;
413  m[3][0]*=s; m[3][1]*=s; m[3][2]*=s; m[3][3]*=s;
414  return *this;
415  }
416 
419  {
420  if(s) s = 1.0f / s;
421  m[0][0]*=s; m[0][1]*=s; m[0][2]*=s; m[0][3]*=s;
422  m[1][0]*=s; m[1][1]*=s; m[1][2]*=s; m[1][3]*=s;
423  m[2][0]*=s; m[2][1]*=s; m[2][2]*=s; m[2][3]*=s;
424  m[3][0]*=s; m[3][1]*=s; m[3][2]*=s; m[3][3]*=s;
425  return *this;
426  }
427 
428  inline_ const HPoint& operator[](int row) const { return *(const HPoint*)&m[row][0]; }
429  inline_ HPoint& operator[](int row) { return *(HPoint*)&m[row][0]; }
430 
431  public:
432 
433  float m[4][4];
434  };
435 
437  inline_ void TransformPoint4x3(Point& dest, const Point& source, const Matrix4x4& rot)
438  {
439  dest.x = rot.m[3][0] + source.x * rot.m[0][0] + source.y * rot.m[1][0] + source.z * rot.m[2][0];
440  dest.y = rot.m[3][1] + source.x * rot.m[0][1] + source.y * rot.m[1][1] + source.z * rot.m[2][1];
441  dest.z = rot.m[3][2] + source.x * rot.m[0][2] + source.y * rot.m[1][2] + source.z * rot.m[2][2];
442  }
443 
445  inline_ void TransformPoint3x3(Point& dest, const Point& source, const Matrix4x4& rot)
446  {
447  dest.x = source.x * rot.m[0][0] + source.y * rot.m[1][0] + source.z * rot.m[2][0];
448  dest.y = source.x * rot.m[0][1] + source.y * rot.m[1][1] + source.z * rot.m[2][1];
449  dest.z = source.x * rot.m[0][2] + source.y * rot.m[1][2] + source.z * rot.m[2][2];
450  }
451 
452  ICEMATHS_API void InvertPRMatrix(Matrix4x4& dest, const Matrix4x4& src);
453 
454 #endif // __ICEMATRIX4X4_H__
455 
Matrix4x4::Trace
inline_ float Trace() const
Computes the trace. The trace is the sum of the 4 diagonal components.
Definition: IceMatrix4x4.h:168
Matrix4x4::operator[]
const inline_ HPoint & operator[](int row) const
Definition: IceMatrix4x4.h:428
i
png_uint_32 i
Definition: png.h:2732
Matrix4x4::SetScale
inline_ void SetScale(const Point &p)
Sets the scale from a Point. The point is put on the diagonal.
Definition: IceMatrix4x4.h:107
Matrix4x4::RotY
void RotY(float angle)
Sets a rotation matrix around the Y axis.
Definition: IceMatrix4x4.h:216
Matrix4x4::Zero
inline_ void Zero()
Clears the matrix.
Definition: IceMatrix4x4.h:172
Matrix4x4
Definition: IceMatrix4x4.h:21
Matrix4x4::InvertPRMatrix
InvertPRMatrix(Matrix4x4 &dest, const Matrix4x4 &src)
Matrix4x4::SetCol
inline_ void SetCol(const udword c, const HPoint &p)
Sets a column.
Definition: IceMatrix4x4.h:89
Matrix4x4::Identity
inline_ void Identity()
Sets the identity matrix.
Definition: IceMatrix4x4.h:174
Matrix4x4::GetTrans
inline_ void GetTrans(Point &p) const
Gets the translation part of the matrix.
Definition: IceMatrix4x4.h:97
Point::z
float z
Definition: IcePoint.h:524
Matrix4x4::GetTrans
const inline_ HPoint & GetTrans() const
Returns the translation part of the matrix.
Definition: IceMatrix4x4.h:95
ZeroMemory
inline_ void ZeroMemory(void *addr, udword size)
Definition: IceMemoryMacros.h:27
Matrix4x4::operator*
inline_ Matrix4x4 operator*(const Matrix4x4 &mat) const
Operator for Matrix4x4 Mul = Matrix4x4 * Matrix4x4;.
Definition: IceMatrix4x4.h:278
Matrix4x4::IsIdentity
inline_ bool IsIdentity() const
Checks for identity.
Definition: IceMatrix4x4.h:176
Matrix4x4::m
float m[4][4]
Definition: IceMatrix4x4.h:433
Matrix4x4::operator[]
inline_ HPoint & operator[](int row)
Definition: IceMatrix4x4.h:429
Matrix4x4::GetRow
inline_ void GetRow(const udword r, HPoint &p) const
Returns a row.
Definition: IceMatrix4x4.h:73
udword
unsigned int udword
sizeof(udword) must be 4
Definition: IceTypes.h:65
HPoint::w
float w
Cast a HPoint to a Point. w is discarded.
Definition: IceHPoint.h:156
Matrix4x4::SetCol
inline_ void SetCol(const udword c, const Point &p)
Sets a column.
Definition: IceMatrix4x4.h:91
BOOL
int BOOL
Another boolean type.
Definition: IceTypes.h:102
Matrix4x4::SetTrans
inline_ void SetTrans(const Point &p)
Sets the translation part of the matrix, from a Point.
Definition: IceMatrix4x4.h:99
swingTest.f
f
Definition: swingTest.py:6
Matrix4x4::operator+
inline_ Matrix4x4 operator+(const Matrix4x4 &mat) const
Operator for Matrix4x4 Plus = Matrix4x4 + Matrix4x4;.
Definition: IceMatrix4x4.h:258
Matrix4x4::GetRow
const inline_ HPoint & GetRow(const udword r) const
Returns a row.
Definition: IceMatrix4x4.h:77
Matrix4x4::GetCol
inline_ void GetCol(const udword c, Point &p) const
Returns a column.
Definition: IceMatrix4x4.h:87
Matrix4x4::~Matrix4x4
inline_ ~Matrix4x4()
Destructor.
Definition: IceMatrix4x4.h:43
Point::x
float x
Definition: IcePoint.h:524
CopyMemory
inline_ void CopyMemory(void *dest, const void *src, udword size)
Definition: IceMemoryMacros.h:81
Matrix4x4::Set
inline_ Matrix4x4 & Set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
Assign values (rotation only)
Definition: IceMatrix4x4.h:46
IR
#define IR(x)
Integer representation of a floating-point value.
Definition: IceFPU.h:18
Matrix4x4::operator*
inline_ friend Matrix4x4 operator*(float s, const Matrix4x4 &mat)
Operator for Matrix4x4 Scale = float * Matrix4x4;.
Definition: IceMatrix4x4.h:324
Matrix4x4::operator*=
inline_ Matrix4x4 & operator*=(float s)
Operator for Matrix4x4 *= float;.
Definition: IceMatrix4x4.h:408
Matrix4x4::GetRow
inline_ void GetRow(const udword r, Point &p) const
Returns a row.
Definition: IceMatrix4x4.h:75
Matrix4x4::Matrix4x4
inline_ Matrix4x4(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)
Constructor from 16 values.
Definition: IceMatrix4x4.h:30
Matrix4x4::Trace3x3
inline_ float Trace3x3() const
Computes the trace of the upper 3x3 matrix.
Definition: IceMatrix4x4.h:170
Matrix4x4::SetTrans
inline_ void SetTrans(float tx, float ty, float tz)
Sets the translation part of the matrix, from floats.
Definition: IceMatrix4x4.h:103
Matrix4x4::SetTrans
inline_ void SetTrans(const HPoint &p)
Sets the translation part of the matrix, from a HPoint.
Definition: IceMatrix4x4.h:101
Matrix4x4::IsValid
inline_ BOOL IsValid() const
Checks matrix validity.
Definition: IceMatrix4x4.h:201
Matrix4x4::operator*
inline_ Matrix4x4 operator*(float s) const
Operator for Matrix4x4 Scale = Matrix4x4 * float;.
Definition: IceMatrix4x4.h:314
Matrix4x4::operator/
inline_ Matrix4x4 operator/(float s) const
Operator for Matrix4x4 Div = Matrix4x4 / float;.
Definition: IceMatrix4x4.h:334
Matrix4x4::operator*
inline_ Point operator*(const Point &v) const
Operator for Point Mul = Matrix4x4 * Point;.
Definition: IceMatrix4x4.h:306
Matrix4x4::SetScale
inline_ void SetScale(float sx, float sy, float sz)
Sets the scale from floats. Values are put on the diagonal.
Definition: IceMatrix4x4.h:109
Matrix4x4::RotX
void RotX(float angle)
Sets a rotation matrix around the X axis.
Definition: IceMatrix4x4.h:214
IEEE_1_0
#define IEEE_1_0
integer representation of 1.0
Definition: IceTypes.h:132
row
png_bytepp row
Definition: png.h:1756
IsValidFloat
inline_ bool IsValidFloat(float value)
Definition: IceFPU.h:131
Matrix4x4::Transpose
void Transpose()
Transposes the matrix.
Definition: IceMatrix4x4.h:224
TRUE
#define TRUE
Definition: OPC_IceHook.h:13
Matrix4x4::operator/
inline_ friend Matrix4x4 operator/(float s, const Matrix4x4 &mat)
Operator for Matrix4x4 Div = float / Matrix4x4;.
Definition: IceMatrix4x4.h:346
Matrix4x4::Scale
void Scale(const Point &p)
Scales from a Point. Each row is multiplied by a component.
Definition: IceMatrix4x4.h:111
Matrix4x4::operator-=
inline_ Matrix4x4 & operator-=(const Matrix4x4 &mat)
Operator for Matrix4x4 -= Matrix4x4;.
Definition: IceMatrix4x4.h:366
HPoint
Definition: IceHPoint.h:15
TransformPoint3x3
inline_ void TransformPoint3x3(Point &dest, const Point &source, const Matrix4x4 &rot)
Quickly rotates a vector, using the 3x3 part of a 4x4 matrix.
Definition: IceMatrix4x4.h:445
Matrix4x4::operator/=
inline_ Matrix4x4 & operator/=(float s)
Operator for Matrix4x4 /= float;.
Definition: IceMatrix4x4.h:418
autoplay.c
int c
Definition: autoplay.py:16
TransformPoint4x3
inline_ void TransformPoint4x3(Point &dest, const Point &source, const Matrix4x4 &rot)
Quickly rotates & translates a vector, using the 4x3 part of a 4x4 matrix.
Definition: IceMatrix4x4.h:437
ICEMATHS_API
#define ICEMATHS_API
Definition: OPC_IceHook.h:51
FALSE
#define FALSE
Definition: OPC_IceHook.h:9
Matrix4x4::operator-
inline_ Matrix4x4 operator-(const Matrix4x4 &mat) const
Operator for Matrix4x4 Minus = Matrix4x4 - Matrix4x4;.
Definition: IceMatrix4x4.h:268
Point
Definition: IcePoint.h:25
Matrix4x4::Scale
void Scale(float sx, float sy, float sz)
Scales from floats. Each row is multiplied by a value.
Definition: IceMatrix4x4.h:118
Matrix4x4::Matrix4x4
inline_ Matrix4x4()
Empty constructor.
Definition: IceMatrix4x4.h:28
Matrix4x4::GetRow
inline_ HPoint & GetRow(const udword r)
Returns a row.
Definition: IceMatrix4x4.h:79
Matrix4x4::RotZ
void RotZ(float angle)
Sets a rotation matrix around the Z axis.
Definition: IceMatrix4x4.h:218
Point::y
float y
Definition: IcePoint.h:524
Matrix3x3
Definition: IceMatrix3x3.h:20
Matrix4x4::GetCol
inline_ void GetCol(const udword c, HPoint &p) const
Returns a column.
Definition: IceMatrix4x4.h:85
Matrix4x4::operator+=
inline_ Matrix4x4 & operator+=(const Matrix4x4 &mat)
Operator for Matrix4x4 += Matrix4x4;.
Definition: IceMatrix4x4.h:356
Matrix4x4::operator*=
Matrix4x4 & operator*=(const Matrix4x4 &mat)
Operator for Matrix4x4 *= Matrix4x4;.
Definition: IceMatrix4x4.h:376
Matrix4x4::Matrix4x4
inline_ Matrix4x4(const Matrix4x4 &mat)
Copy constructor.
Definition: IceMatrix4x4.h:41
Matrix4x4::SetRow
inline_ void SetRow(const udword r, const HPoint &p)
Sets a row.
Definition: IceMatrix4x4.h:81
Matrix4x4::Set
inline_ Matrix4x4 & 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)
Assign values.
Definition: IceMatrix4x4.h:56
Matrix4x4::SetRow
inline_ void SetRow(const udword r, const Point &p)
Sets a row.
Definition: IceMatrix4x4.h:83
Matrix4x4::Copy
inline_ void Copy(const Matrix4x4 &source)
Copy from a Matrix4x4.
Definition: IceMatrix4x4.h:69
inline_
#define inline_
Definition: IcePreprocessor.h:103
Matrix4x4::operator*
inline_ HPoint operator*(const HPoint &v) const
Operator for HPoint Mul = Matrix4x4 * HPoint;.
Definition: IceMatrix4x4.h:303


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