Mercurial > fife-parpg
comparison engine/core/util/math/matrix.h @ 482:16c2b3ee59ce
* Merged the view performance branch back into trunk. fixes[ticket:419]
author | helios2000@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 29 Apr 2010 13:51:45 +0000 |
parents | 9ec572a5a944 |
children | 356634098bd9 |
comparison
equal
deleted
inserted
replaced
481:1f37adc9a685 | 482:16c2b3ee59ce |
---|---|
221 */ | 221 */ |
222 inline T& operator[] (int ind) { | 222 inline T& operator[] (int ind) { |
223 assert(ind > -1 && ind < 16); | 223 assert(ind > -1 && ind < 16); |
224 return m[ind]; | 224 return m[ind]; |
225 } | 225 } |
226 inline const T& operator[] (int ind) const { | |
227 assert(ind > -1 && ind < 16); | |
228 return m[ind]; | |
229 } | |
226 | 230 |
227 /** Apply the matrix dot product to this matrix | 231 /** Apply the matrix dot product to this matrix |
228 */ | 232 */ |
229 inline Matrix& mult3by3(const Matrix& mat) { | 233 inline Matrix& mult3by3(const Matrix& mat) { |
230 Matrix temp(*this); | 234 Matrix temp(*this); |
372 typedef Matrix<int> IntMatrix; | 376 typedef Matrix<int> IntMatrix; |
373 | 377 |
374 /** Print coords of the Matrix to a stream | 378 /** Print coords of the Matrix to a stream |
375 */ | 379 */ |
376 template<typename T> | 380 template<typename T> |
377 std::ostream& operator<<(std::ostream& os, Matrix<T>& m) { | 381 std::ostream& operator<<(std::ostream& os, const Matrix<T>& m) { |
382 | |
378 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" << \ |
379 "|" << m[1] << "," << m[5] << "," << m[9] << "," << m[13] << "|\n" << \ | 384 "|" << m[1] << "," << m[5] << "," << m[9] << "," << m[13] << "|\n" << \ |
380 "|" << m[2] << "," << m[6] << "," << m[10] << "," << m[14] << "|\n" << \ | 385 "|" << m[2] << "," << m[6] << "," << m[10] << "," << m[14] << "|\n" << \ |
381 "|" << m[3] << "," << m[7] << "," << m[11] << "," << m[15] << "|\n"; | 386 "|" << m[3] << "," << m[7] << "," << m[11] << "," << m[15] << "|\n"; |
382 } | 387 } |