Mercurial > fife-parpg
comparison engine/core/util/math/matrix.h @ 621:356634098bd9
* Removed the image chunking size variable from engine settings.
* Replaced the existing define of PI and added some math related static const variables
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 01 Oct 2010 14:09:47 +0000 |
parents | 16c2b3ee59ce |
children | 07b1cf8e92b5 |
comparison
equal
deleted
inserted
replaced
620:853d25234671 | 621:356634098bd9 |
---|---|
116 register T mag = sqrt(magSqr); | 116 register T mag = sqrt(magSqr); |
117 x/=mag; | 117 x/=mag; |
118 y/=mag; | 118 y/=mag; |
119 z/=mag; | 119 z/=mag; |
120 } | 120 } |
121 T c = cos(angle*M_PI/180); | 121 T c = cos(angle*DBL_PI/180); |
122 T s = sin(angle*M_PI/180); | 122 T s = sin(angle*DBL_PI/180); |
123 m0 = x*x*(1-c)+c; | 123 m0 = x*x*(1-c)+c; |
124 m1 = y*x*(1-c)+z*s; | 124 m1 = y*x*(1-c)+z*s; |
125 m2 = z*x*(1-c)-y*s; | 125 m2 = z*x*(1-c)-y*s; |
126 m3 = 0; | 126 m3 = 0; |
127 | 127 |
377 | 377 |
378 /** Print coords of the Matrix to a stream | 378 /** Print coords of the Matrix to a stream |
379 */ | 379 */ |
380 template<typename T> | 380 template<typename T> |
381 std::ostream& operator<<(std::ostream& os, const Matrix<T>& m) { | 381 std::ostream& operator<<(std::ostream& os, const Matrix<T>& m) { |
382 | 382 |
383 return os << "\n|" << m[0] << "," << m[4] << "," << m[8] << "," << m[12] << "|\n" << \ | 383 return os << "\n|" << m[0] << "," << m[4] << "," << m[8] << "," << m[12] << "|\n" << \ |
384 "|" << m[1] << "," << m[5] << "," << m[9] << "," << m[13] << "|\n" << \ | 384 "|" << m[1] << "," << m[5] << "," << m[9] << "," << m[13] << "|\n" << \ |
385 "|" << m[2] << "," << m[6] << "," << m[10] << "," << m[14] << "|\n" << \ | 385 "|" << m[2] << "," << m[6] << "," << m[10] << "," << m[14] << "|\n" << \ |
386 "|" << m[3] << "," << m[7] << "," << m[11] << "," << m[15] << "|\n"; | 386 "|" << m[3] << "," << m[7] << "," << m[11] << "," << m[15] << "|\n"; |
387 } | 387 } |