12#ifndef TT_INCLUDE__MATRIX3D_H
13#define TT_INCLUDE__MATRIX3D_H
21class SCRIPTS_API Matrix3D
26 static Matrix3D Identity;
27 TT_INLINE Vector4 & operator [] (
int i) {
return Row[i]; }
28 TT_INLINE
const Vector4 & operator [] (
int i)
const {
return Row[i]; }
30 TT_INLINE
explicit Matrix3D(
bool init) {
if (init) Make_Identity(); }
31 TT_INLINE
explicit Matrix3D(
float m[12])
33 Row[0].Set(m[0],m[1],m[2],m[3]);
34 Row[1].Set(m[4],m[5],m[6],m[7]);
35 Row[2].Set(m[8],m[9],m[10],m[11]);
37 TT_INLINE
explicit Matrix3D(
const Vector3 &x,
const Vector3 &y,
const Vector3 &z,
const Vector3 &pos)
41 TT_INLINE
explicit Matrix3D(
const Vector3 &axis,
float angle)
45 TT_INLINE
explicit Matrix3D(
const Vector3 &axis,
float sine,
float cosine)
47 Set(axis,sine,cosine);
49 TT_INLINE
explicit Matrix3D(
const Matrix3 & rotation,
const Vector3 & position)
51 Set(rotation,position);
53 TT_INLINE
explicit Matrix3D(
const Quaternion & rotation,
const Vector3 & position)
55 Set(rotation,position);
57 TT_INLINE
explicit Matrix3D(
const Vector3 & position)
61 TT_INLINE Matrix3D(
const Matrix3D & m)
67 TT_INLINE Matrix3D & operator = (
const Matrix3D & m)
75 Matrix3D (
float _11,
float _12,
float _13,
float _14,
76 float _21,
float _22,
float _23,
float _24,
77 float _31,
float _32,
float _33,
float _34);
79 void Get_Orthogonal_Inverse (Matrix3D& target)
const;
80 float Get_X_Rotation ()
const;
81 float Get_Y_Rotation ()
const;
82 float Get_Z_Rotation ()
const;
83 void Look_At (
const Vector3&,
const Vector3&,
float);
84 void Obj_Look_At (
const Vector3&,
const Vector3&,
float unknown = 0);
85 Vector3 Rotate_Vector (
const Vector3& vector)
const;
86 Vector3 Inverse_Rotate_Vector (
const Vector3& vector)
const;
87 TT_INLINE
void Set(
float m[12])
89 Row[0].Set(m[0],m[1],m[2],m[3]);
90 Row[1].Set(m[4],m[5],m[6],m[7]);
91 Row[2].Set(m[8],m[9],m[10],m[11]);
93 TT_INLINE
void Set(
float m11,
float m12,
float m13,
float m14,
float m21,
float m22,
float m23,
float m24,
float m31,
float m32,
float m33,
float m34)
95 Row[0].Set(m11,m12,m13,m14);
96 Row[1].Set(m21,m22,m23,m24);
97 Row[2].Set(m31,m32,m33,m34);
99 TT_INLINE
void Set(
const Vector3 &x,
const Vector3 &y,
const Vector3 &z,
const Vector3 &pos)
101 Row[0].Set(x[0],y[0],z[0],pos[0]);
102 Row[1].Set(x[1],y[1],z[1],pos[1]);
103 Row[2].Set(x[2],y[2],z[2],pos[2]);
105 TT_INLINE
void Set(
const Vector3 & axis,
float angle)
107 float c = cosf(angle);
108 float s = sinf(angle);
111 TT_INLINE
void Set(
const Vector3 & axis,
float s,
float c)
114 (
float)(axis[0]*axis[0] + c*(1.0f - axis[0]*axis[0])),
115 (
float)(axis[0]*axis[1]*(1.0f - c) - axis[2]*s),
116 (
float)(axis[2]*axis[0]*(1.0f - c) + axis[1]*s),
120 (
float)(axis[0]*axis[1]*(1.0f - c) + axis[2]*s),
121 (
float)(axis[1]*axis[1] + c*(1.0f - axis[1]*axis[1])),
122 (
float)(axis[1]*axis[2]*(1.0f - c) - axis[0]*s),
126 (
float)(axis[2]*axis[0]*(1.0f - c) - axis[1]*s),
127 (
float)(axis[1]*axis[2]*(1.0f - c) + axis[0]*s),
128 (
float)(axis[2]*axis[2] + c*(1 - axis[2]*axis[2])),
132 TT_INLINE
void Set(
const Vector3 & position)
134 Row[0].Set(1.0f,0.0f,0.0f,position[0]);
135 Row[1].Set(0.0f,1.0f,0.0f,position[1]);
136 Row[2].Set(0.0f,0.0f,1.0f,position[2]);
138 void Set (
const Matrix3& rotation,
const Vector3& position);
139 void Set (
const Quaternion& rotation,
const Vector3& position);
140 void Set_Rotation (
const Quaternion& rotation);
141 TT_INLINE Vector3 Get_Translation(
void)
const {
return Vector3(Row[0][3],Row[1][3],Row[2][3]); }
142 TT_INLINE
void Get_Translation(Vector3 * set)
const { set->X = Row[0][3]; set->Y = Row[1][3]; set->Z = Row[2][3]; }
143 TT_INLINE
void Set_Translation(
const Vector3 & t) { Row[0][3] = t[0]; Row[1][3] = t[1];Row[2][3] = t[2]; }
144 void Set_Rotation(
const Matrix3 & m);
145 TT_INLINE
float Get_X_Translation(
void)
const {
return Row[0][3]; };
146 TT_INLINE
float Get_Y_Translation(
void)
const {
return Row[1][3]; };
147 TT_INLINE
float Get_Z_Translation(
void)
const {
return Row[2][3]; };
148 TT_INLINE
void Set_X_Translation(
float x) { Row[0][3] = x; };
149 TT_INLINE
void Set_Y_Translation(
float y) { Row[1][3] = y; };
150 TT_INLINE
void Set_Z_Translation(
float z) { Row[2][3] = z; };
151 TT_INLINE
void Adjust_Translation(
const Vector3 & t) { Row[0][3] += t[0]; Row[1][3] += t[1]; Row[2][3] += t[2]; };
152 TT_INLINE
void Adjust_X_Translation(
float x) { Row[0][3] += x; };
153 TT_INLINE
void Adjust_Y_Translation(
float y) { Row[1][3] += y; };
154 TT_INLINE
void Adjust_Z_Translation(
float z) { Row[2][3] += z; };
155 TT_INLINE
void Make_Identity(
void)
157 Row[0].Set(1.0f,0.0f,0.0f,0.0f);
158 Row[1].Set(0.0f,1.0f,0.0f,0.0f);
159 Row[2].Set(0.0f,0.0f,1.0f,0.0f);
161 TT_INLINE
void Translate(
float x,
float y,
float z)
163 Row[0][3] += (float)(Row[0][0]*x + Row[0][1]*y + Row[0][2]*z);
164 Row[1][3] += (float)(Row[1][0]*x + Row[1][1]*y + Row[1][2]*z);
165 Row[2][3] += (float)(Row[2][0]*x + Row[2][1]*y + Row[2][2]*z);
167 TT_INLINE
void Translate(
const Vector3 &t)
169 Row[0][3] += Row[0][0]*t[0] + Row[0][1]*t[1] + Row[0][2]*t[2];
170 Row[1][3] += Row[1][0]*t[0] + Row[1][1]*t[1] + Row[1][2]*t[2];
171 Row[2][3] += Row[2][0]*t[0] + Row[2][1]*t[1] + Row[2][2]*t[2];
173 TT_INLINE
void Translate_X(
float x)
175 Row[0][3] += (float)(Row[0][0]*x);
176 Row[1][3] += (float)(Row[1][0]*x);
177 Row[2][3] += (float)(Row[2][0]*x);
179 TT_INLINE
void Translate_Y(
float y)
181 Row[0][3] += (float)(Row[0][1]*y);
182 Row[1][3] += (float)(Row[1][1]*y);
183 Row[2][3] += (float)(Row[2][1]*y);
185 TT_INLINE
void Translate_Z(
float z)
187 Row[0][3] += (float)(Row[0][2]*z);
188 Row[1][3] += (float)(Row[1][2]*z);
189 Row[2][3] += (float)(Row[2][2]*z);
191 TT_INLINE
void Rotate_X(
float theta)
197 tmp1 = Row[0][1]; tmp2 = Row[0][2];
198 Row[0][1] = (float)( c*tmp1 + s*tmp2);
199 Row[0][2] = (float)(-s*tmp1 + c*tmp2);
200 tmp1 = Row[1][1]; tmp2 = Row[1][2];
201 Row[1][1] = (float)( c*tmp1 + s*tmp2);
202 Row[1][2] = (float)(-s*tmp1 + c*tmp2);
203 tmp1 = Row[2][1]; tmp2 = Row[2][2];
204 Row[2][1] = (float)( c*tmp1 + s*tmp2);
205 Row[2][2] = (float)(-s*tmp1 + c*tmp2);
207 TT_INLINE
void Rotate_Y(
float theta)
213 tmp1 = Row[0][0]; tmp2 = Row[0][2];
214 Row[0][0] = (float)(c*tmp1 - s*tmp2);
215 Row[0][2] = (float)(s*tmp1 + c*tmp2);
216 tmp1 = Row[1][0]; tmp2 = Row[1][2];
217 Row[1][0] = (float)(c*tmp1 - s*tmp2);
218 Row[1][2] = (float)(s*tmp1 + c*tmp2);
219 tmp1 = Row[2][0]; tmp2 = Row[2][2];
220 Row[2][0] = (float)(c*tmp1 - s*tmp2);
221 Row[2][2] = (float)(s*tmp1 + c*tmp2);
223 TT_INLINE
void Rotate_Z(
float theta)
229 tmp1 = Row[0][0]; tmp2 = Row[0][1];
230 Row[0][0] = (float)( c*tmp1 + s*tmp2);
231 Row[0][1] = (float)(-s*tmp1 + c*tmp2);
232 tmp1 = Row[1][0]; tmp2 = Row[1][1];
233 Row[1][0] = (float)( c*tmp1 + s*tmp2);
234 Row[1][1] = (float)(-s*tmp1 + c*tmp2);
235 tmp1 = Row[2][0]; tmp2 = Row[2][1];
236 Row[2][0] = (float)( c*tmp1 + s*tmp2);
237 Row[2][1] = (float)(-s*tmp1 + c*tmp2);
239 TT_INLINE
void Rotate_X(
float s,
float c)
242 tmp1 = Row[0][1]; tmp2 = Row[0][2];
243 Row[0][1] = (float)( c*tmp1 + s*tmp2);
244 Row[0][2] = (float)(-s*tmp1 + c*tmp2);
245 tmp1 = Row[1][1]; tmp2 = Row[1][2];
246 Row[1][1] = (float)( c*tmp1 + s*tmp2);
247 Row[1][2] = (float)(-s*tmp1 + c*tmp2);
248 tmp1 = Row[2][1]; tmp2 = Row[2][2];
249 Row[2][1] = (float)( c*tmp1 + s*tmp2);
250 Row[2][2] = (float)(-s*tmp1 + c*tmp2);
252 TT_INLINE
void Rotate_Y(
float s,
float c)
255 tmp1 = Row[0][0]; tmp2 = Row[0][2];
256 Row[0][0] = (float)(c*tmp1 - s*tmp2);
257 Row[0][2] = (float)(s*tmp1 + c*tmp2);
258 tmp1 = Row[1][0]; tmp2 = Row[1][2];
259 Row[1][0] = (float)(c*tmp1 - s*tmp2);
260 Row[1][2] = (float)(s*tmp1 + c*tmp2);
261 tmp1 = Row[2][0]; tmp2 = Row[2][2];
262 Row[2][0] = (float)(c*tmp1 - s*tmp2);
263 Row[2][2] = (float)(s*tmp1 + c*tmp2);
265 TT_INLINE
void Rotate_Z(
float s,
float c)
268 tmp1 = Row[0][0]; tmp2 = Row[0][1];
269 Row[0][0] = (float)( c*tmp1 + s*tmp2);
270 Row[0][1] = (float)(-s*tmp1 + c*tmp2);
271 tmp1 = Row[1][0]; tmp2 = Row[1][1];
272 Row[1][0] = (float)( c*tmp1 + s*tmp2);
273 Row[1][1] = (float)(-s*tmp1 + c*tmp2);
274 tmp1 = Row[2][0]; tmp2 = Row[2][1];
275 Row[2][0] = (float)( c*tmp1 + s*tmp2);
276 Row[2][1] = (float)(-s*tmp1 + c*tmp2);
278 TT_INLINE
void Scale(
float scale)
290 TT_INLINE
void Scale(
float x,
float y,
float z)
302 TT_INLINE
void Scale(Vector3 &scale)
304 Scale(scale.X, scale.Y, scale.Z);
306 TT_INLINE
void Pre_Rotate_X(
float theta)
312 tmp1 = Row[1][0]; tmp2 = Row[2][0];
313 Row[1][0] = (float)(c*tmp1 - s*tmp2);
314 Row[2][0] = (float)(s*tmp1 + c*tmp2);
315 tmp1 = Row[1][1]; tmp2 = Row[2][1];
316 Row[1][1] = (float)(c*tmp1 - s*tmp2);
317 Row[2][1] = (float)(s*tmp1 + c*tmp2);
318 tmp1 = Row[1][2]; tmp2 = Row[2][2];
319 Row[1][2] = (float)(c*tmp1 - s*tmp2);
320 Row[2][2] = (float)(s*tmp1 + c*tmp2);
321 tmp1 = Row[1][3]; tmp2 = Row[2][3];
322 Row[1][3] = (float)(c*tmp1 - s*tmp2);
323 Row[2][3] = (float)(s*tmp1 + c*tmp2);
325 TT_INLINE
void Pre_Rotate_Y(
float theta)
331 tmp1 = Row[0][0]; tmp2 = Row[2][0];
332 Row[0][0] = (float)( c*tmp1 + s*tmp2);
333 Row[2][0] = (float)(-s*tmp1 + c*tmp2);
334 tmp1 = Row[0][1]; tmp2 = Row[2][1];
335 Row[0][1] = (float)( c*tmp1 + s*tmp2);
336 Row[2][1] = (float)(-s*tmp1 + c*tmp2);
337 tmp1 = Row[0][2]; tmp2 = Row[2][2];
338 Row[0][2] = (float)( c*tmp1 + s*tmp2);
339 Row[2][2] = (float)(-s*tmp1 + c*tmp2);
340 tmp1 = Row[0][3]; tmp2 = Row[2][3];
341 Row[0][3] = (float)( c*tmp1 + s*tmp2);
342 Row[2][3] = (float)(-s*tmp1 + c*tmp2);
344 TT_INLINE
void Pre_Rotate_Z(
float theta)
350 tmp1 = Row[0][0]; tmp2 = Row[1][0];
351 Row[0][0] = (float)(c*tmp1 - s*tmp2);
352 Row[1][0] = (float)(s*tmp1 + c*tmp2);
353 tmp1 = Row[0][1]; tmp2 = Row[1][1];
354 Row[0][1] = (float)(c*tmp1 - s*tmp2);
355 Row[1][1] = (float)(s*tmp1 + c*tmp2);
356 tmp1 = Row[0][2]; tmp2 = Row[1][2];
357 Row[0][2] = (float)(c*tmp1 - s*tmp2);
358 Row[1][2] = (float)(s*tmp1 + c*tmp2);
359 tmp1 = Row[0][3]; tmp2 = Row[1][3];
360 Row[0][3] = (float)(c*tmp1 - s*tmp2);
361 Row[1][3] = (float)(s*tmp1 + c*tmp2);
363 TT_INLINE
void Pre_Rotate_X(
float s,
float c)
366 tmp1 = Row[1][0]; tmp2 = Row[2][0];
367 Row[1][0] = (float)(c*tmp1 - s*tmp2);
368 Row[2][0] = (float)(s*tmp1 + c*tmp2);
369 tmp1 = Row[1][1]; tmp2 = Row[2][1];
370 Row[1][1] = (float)(c*tmp1 - s*tmp2);
371 Row[2][1] = (float)(s*tmp1 + c*tmp2);
372 tmp1 = Row[1][2]; tmp2 = Row[2][2];
373 Row[1][2] = (float)(c*tmp1 - s*tmp2);
374 Row[2][2] = (float)(s*tmp1 + c*tmp2);
375 tmp1 = Row[1][3]; tmp2 = Row[2][3];
376 Row[1][3] = (float)(c*tmp1 - s*tmp2);
377 Row[2][3] = (float)(s*tmp1 + c*tmp2);
379 TT_INLINE
void Pre_Rotate_Y(
float s,
float c)
382 tmp1 = Row[0][0]; tmp2 = Row[2][0];
383 Row[0][0] = (float)( c*tmp1 + s*tmp2);
384 Row[2][0] = (float)(-s*tmp1 + c*tmp2);
385 tmp1 = Row[0][1]; tmp2 = Row[2][1];
386 Row[0][1] = (float)( c*tmp1 + s*tmp2);
387 Row[2][1] = (float)(-s*tmp1 + c*tmp2);
388 tmp1 = Row[0][2]; tmp2 = Row[2][2];
389 Row[0][2] = (float)( c*tmp1 + s*tmp2);
390 Row[2][2] = (float)(-s*tmp1 + c*tmp2);
391 tmp1 = Row[0][3]; tmp2 = Row[2][3];
392 Row[0][3] = (float)( c*tmp1 + s*tmp2);
393 Row[2][3] = (float)(-s*tmp1 + c*tmp2);
395 TT_INLINE
void Pre_Rotate_Z(
float s,
float c)
398 tmp1 = Row[0][0]; tmp2 = Row[1][0];
399 Row[0][0] = (float)(c*tmp1 - s*tmp2);
400 Row[1][0] = (float)(s*tmp1 + c*tmp2);
401 tmp1 = Row[0][1]; tmp2 = Row[1][1];
402 Row[0][1] = (float)(c*tmp1 - s*tmp2);
403 Row[1][1] = (float)(s*tmp1 + c*tmp2);
404 tmp1 = Row[0][2]; tmp2 = Row[1][2];
405 Row[0][2] = (float)(c*tmp1 - s*tmp2);
406 Row[1][2] = (float)(s*tmp1 + c*tmp2);
407 tmp1 = Row[0][3]; tmp2 = Row[1][3];
408 Row[0][3] = (float)(c*tmp1 - s*tmp2);
409 Row[1][3] = (float)(s*tmp1 + c*tmp2);
411 TT_INLINE
void In_Place_Pre_Rotate_X(
float theta)
417 tmp1 = Row[1][0]; tmp2 = Row[2][0];
418 Row[1][0] = (float)(c*tmp1 - s*tmp2);
419 Row[2][0] = (float)(s*tmp1 + c*tmp2);
420 tmp1 = Row[1][1]; tmp2 = Row[2][1];
421 Row[1][1] = (float)(c*tmp1 - s*tmp2);
422 Row[2][1] = (float)(s*tmp1 + c*tmp2);
423 tmp1 = Row[1][2]; tmp2 = Row[2][2];
424 Row[1][2] = (float)(c*tmp1 - s*tmp2);
425 Row[2][2] = (float)(s*tmp1 + c*tmp2);
427 TT_INLINE
void In_Place_Pre_Rotate_Y(
float theta)
433 tmp1 = Row[0][0]; tmp2 = Row[2][0];
434 Row[0][0] = (float)( c*tmp1 + s*tmp2);
435 Row[2][0] = (float)(-s*tmp1 + c*tmp2);
436 tmp1 = Row[0][1]; tmp2 = Row[2][1];
437 Row[0][1] = (float)( c*tmp1 + s*tmp2);
438 Row[2][1] = (float)(-s*tmp1 + c*tmp2);
439 tmp1 = Row[0][2]; tmp2 = Row[2][2];
440 Row[0][2] = (float)( c*tmp1 + s*tmp2);
441 Row[2][2] = (float)(-s*tmp1 + c*tmp2);
443 TT_INLINE
void In_Place_Pre_Rotate_Z(
float theta)
449 tmp1 = Row[0][0]; tmp2 = Row[1][0];
450 Row[0][0] = (float)(c*tmp1 - s*tmp2);
451 Row[1][0] = (float)(s*tmp1 + c*tmp2);
452 tmp1 = Row[0][1]; tmp2 = Row[1][1];
453 Row[0][1] = (float)(c*tmp1 - s*tmp2);
454 Row[1][1] = (float)(s*tmp1 + c*tmp2);
455 tmp1 = Row[0][2]; tmp2 = Row[1][2];
456 Row[0][2] = (float)(c*tmp1 - s*tmp2);
457 Row[1][2] = (float)(s*tmp1 + c*tmp2);
459 TT_INLINE
void In_Place_Pre_Rotate_X(
float s,
float c)
462 tmp1 = Row[1][0]; tmp2 = Row[2][0];
463 Row[1][0] = (float)(c*tmp1 - s*tmp2);
464 Row[2][0] = (float)(s*tmp1 + c*tmp2);
465 tmp1 = Row[1][1]; tmp2 = Row[2][1];
466 Row[1][1] = (float)(c*tmp1 - s*tmp2);
467 Row[2][1] = (float)(s*tmp1 + c*tmp2);
468 tmp1 = Row[1][2]; tmp2 = Row[2][2];
469 Row[1][2] = (float)(c*tmp1 - s*tmp2);
470 Row[2][2] = (float)(s*tmp1 + c*tmp2);
472 TT_INLINE
void In_Place_Pre_Rotate_Y(
float s,
float c)
475 tmp1 = Row[0][0]; tmp2 = Row[2][0];
476 Row[0][0] = (float)( c*tmp1 + s*tmp2);
477 Row[2][0] = (float)(-s*tmp1 + c*tmp2);
478 tmp1 = Row[0][1]; tmp2 = Row[2][1];
479 Row[0][1] = (float)( c*tmp1 + s*tmp2);
480 Row[2][1] = (float)(-s*tmp1 + c*tmp2);
481 tmp1 = Row[0][2]; tmp2 = Row[2][2];
482 Row[0][2] = (float)( c*tmp1 + s*tmp2);
483 Row[2][2] = (float)(-s*tmp1 + c*tmp2);
485 TT_INLINE
void In_Place_Pre_Rotate_Z(
float s,
float c)
488 tmp1 = Row[0][0]; tmp2 = Row[1][0];
489 Row[0][0] = (float)(c*tmp1 - s*tmp2);
490 Row[1][0] = (float)(s*tmp1 + c*tmp2);
491 tmp1 = Row[0][1]; tmp2 = Row[1][1];
492 Row[0][1] = (float)(c*tmp1 - s*tmp2);
493 Row[1][1] = (float)(s*tmp1 + c*tmp2);
494 tmp1 = Row[0][2]; tmp2 = Row[1][2];
495 Row[0][2] = (float)(c*tmp1 - s*tmp2);
496 Row[1][2] = (float)(s*tmp1 + c*tmp2);
499 int Is_Orthogonal(
void)
const;
500 Matrix3D& operator *= (
const Matrix3D& matrix);
501 Vector3 operator * (
const Vector3& vector)
const;
502 static void Transform_Vector(
const Matrix3D & A,
const Vector3 & in,Vector3 * out)
515 out->X = (A.Row[0][0] * v->X + A.Row[0][1] * v->Y + A.Row[0][2] * v->Z + A.Row[0][3]);
516 out->Y = (A.Row[1][0] * v->X + A.Row[1][1] * v->Y + A.Row[1][2] * v->Z + A.Row[1][3]);
517 out->Z = (A.Row[2][0] * v->X + A.Row[2][1] * v->Y + A.Row[2][2] * v->Z + A.Row[2][3]);
519 TT_INLINE Vector3 Get_X_Vector()
const {
return Vector3(Row[0][0], Row[1][0], Row[2][0]); }
520 TT_INLINE Vector3 Get_Y_Vector()
const {
return Vector3(Row[0][1], Row[1][1], Row[2][1]); }
521 TT_INLINE Vector3 Get_Z_Vector()
const {
return Vector3(Row[0][2], Row[1][2], Row[2][2]); }
522 TT_INLINE
void Get_X_Vector(Vector3 * set_x)
const { set_x->Set(Row[0][0], Row[1][0], Row[2][0]); }
523 TT_INLINE
void Get_Y_Vector(Vector3 * set_y)
const { set_y->Set(Row[0][1], Row[1][1], Row[2][1]); }
524 TT_INLINE
void Get_Z_Vector(Vector3 * set_z)
const { set_z->Set(Row[0][2], Row[1][2], Row[2][2]); }
525 void Get_Inverse(Matrix3D & set_inverse)
const;
526 void Copy_3x3_Matrix(
float matrix[3][3]);
527 void Transform_Min_Max_AABox(
const Vector3 & min,
const Vector3 & max,Vector3 * set_min,Vector3 * set_max)
const;
528 void Transform_Center_Extent_AABox(
const Vector3 & center,
const Vector3 & extent,Vector3 * set_center,Vector3 * set_extent)
const;
529 static void Multiply(
const Matrix3D &A,
const Matrix3D &B,Matrix3D * set_result);
530 static TT_INLINE
void Rotate_Vector(
const Matrix3D & A,
const Vector3 & in,Vector3 * out)
543 out->X = (A[0][0] * v->X + A[0][1] * v->Y + A[0][2] * v->Z);
544 out->Y = (A[1][0] * v->X + A[1][1] * v->Y + A[1][2] * v->Z);
545 out->Z = (A[2][0] * v->X + A[2][1] * v->Y + A[2][2] * v->Z);
547 static TT_INLINE
void Inverse_Transform_Vector(
const Matrix3D & A,
const Vector3 & in,Vector3 * out)
560 Vector3 diff(v->X - A[0][3], v->Y - A[1][3], v->Z - A[2][3]);
561 Matrix3D::Inverse_Rotate_Vector(A, diff, out);
563 static TT_INLINE
void Inverse_Rotate_Vector(
const Matrix3D & A,
const Vector3 & in,Vector3 * out)
576 out->X = (A[0][0] * v->X + A[1][0] * v->Y + A[2][0] * v->Z);
577 out->Y = (A[0][1] * v->X + A[1][1] * v->Y + A[2][1] * v->Z);
578 out->Z = (A[0][2] * v->X + A[1][2] * v->Y + A[2][2] * v->Z);
580 static Matrix3D Reflect_Plane(
const PlaneClass& _plane);
581 PlaneClass Transform_Plane(
const PlaneClass& _plane)
const;
582 static bool Solve_Linear_System(Matrix3D & system);
583 void Re_Orthogonalize(
void);
586TT_INLINE Matrix3D operator * (
const Matrix3D &A,
const Matrix3D &B)
589 float tmp1,tmp2,tmp3;
593 C[0][0] = (float)(A[0][0]*tmp1 + A[0][1]*tmp2 + A[0][2]*tmp3);
594 C[1][0] = (float)(A[1][0]*tmp1 + A[1][1]*tmp2 + A[1][2]*tmp3);
595 C[2][0] = (float)(A[2][0]*tmp1 + A[2][1]*tmp2 + A[2][2]*tmp3);
599 C[0][1] = (float)(A[0][0]*tmp1 + A[0][1]*tmp2 + A[0][2]*tmp3);
600 C[1][1] = (float)(A[1][0]*tmp1 + A[1][1]*tmp2 + A[1][2]*tmp3);
601 C[2][1] = (float)(A[2][0]*tmp1 + A[2][1]*tmp2 + A[2][2]*tmp3);
605 C[0][2] = (float)(A[0][0]*tmp1 + A[0][1]*tmp2 + A[0][2]*tmp3);
606 C[1][2] = (float)(A[1][0]*tmp1 + A[1][1]*tmp2 + A[1][2]*tmp3);
607 C[2][2] = (float)(A[2][0]*tmp1 + A[2][1]*tmp2 + A[2][2]*tmp3);
611 C[0][3] = (float)(A[0][0]*tmp1 + A[0][1]*tmp2 + A[0][2]*tmp3 + A[0][3]);
612 C[1][3] = (float)(A[1][0]*tmp1 + A[1][1]*tmp2 + A[1][2]*tmp3 + A[1][3]);
613 C[2][3] = (float)(A[2][0]*tmp1 + A[2][1]*tmp2 + A[2][2]*tmp3 + A[2][3]);
616TT_INLINE
bool operator == (
const Matrix3D &A,
const Matrix3D &B)
618 return (A[0].X == B[0].X && A[0].Y == B[0].Y && A[0].Z == B[0].Z && A[0].W == B[0].W
619 && A[1].X == B[1].X && A[1].Y == B[1].Y && A[1].Z == B[1].Z && A[1].W == B[1].W
620 && A[2].X == B[2].X && A[2].Y == B[2].Y && A[2].Z == B[2].Z && A[2].W == B[2].W);
623TT_INLINE
bool operator != (
const Matrix3D &A,
const Matrix3D &B)