1 #ifndef GUI_MATH___MATRIX4___HPP
2 #define GUI_MATH___MATRIX4___HPP
54 CMatrix4 (
T,
T,
T,
T,
T,
T,
T,
T,
T,
T,
T,
T,
T,
T,
T,
T);
130 template <
class T>
inline
138 template <
class T>
inline
145 template <
class T>
inline
147 T m5,
T m6,
T m7,
T m8,
148 T m9,
T m10,
T m11,
T m12,
149 T m13,
T m14,
T m15,
T m16)
151 m_Data[ 0] = m1; m_Data[ 1] = m2; m_Data[ 2] = m3; m_Data[ 3] = m4;
152 m_Data[ 4] = m5; m_Data[ 5] = m6; m_Data[ 6] = m7; m_Data[ 7] = m8;
153 m_Data[ 8] = m9; m_Data[ 9] = m10; m_Data[10] = m11; m_Data[11] = m12;
154 m_Data[12] = m13; m_Data[13] = m14; m_Data[14] = m15; m_Data[15] = m16;
158 template <
class T>
inline
161 for (
int i = 0;
i < 16; ++
i) {
167 template <
class T>
inline
170 m_Data[ 0] = m[0][0];
171 m_Data[ 1] = m[0][1];
172 m_Data[ 2] = m[0][2];
173 m_Data[ 3] = m[0][3];
175 m_Data[ 4] = m[1][0];
176 m_Data[ 5] = m[1][1];
177 m_Data[ 6] = m[1][2];
178 m_Data[ 7] = m[1][3];
180 m_Data[ 8] = m[2][0];
181 m_Data[ 9] = m[2][1];
182 m_Data[10] = m[2][2];
183 m_Data[11] = m[2][3];
185 m_Data[12] = m[3][0];
186 m_Data[13] = m[3][1];
187 m_Data[14] = m[3][2];
188 m_Data[15] = m[3][3];
197 for (
int i = 0;
i < 16; ++
i) {
209 for (
int i = 0;
i < 16; ++
i) {
221 for (
int i = 0;
i < 16; ++
i) {
233 for (
int i = 0;
i < 16; ++
i) {
246 for (
int i = 0;
i < 16; ++
i) {
274 t0 = m_Data[ 0] * m[ 0] + m_Data[ 1] * m[ 4] +
275 m_Data[ 2] * m[ 8] + m_Data[ 3] * m[12];
276 t1 = m_Data[ 0] * m[ 1] + m_Data[ 1] * m[ 5] +
277 m_Data[ 2] * m[ 9] + m_Data[ 3] * m[13];
278 t2 = m_Data[ 0] * m[ 2] + m_Data[ 1] * m[ 6] +
279 m_Data[ 2] * m[10] + m_Data[ 3] * m[14];
280 t3 = m_Data[ 0] * m[ 3] + m_Data[ 1] * m[ 7] +
281 m_Data[ 2] * m[11] + m_Data[ 3] * m[15];
287 t0 = m_Data[ 4] * m[ 0] + m_Data[ 5] * m[ 4] +
288 m_Data[ 6] * m[ 8] + m_Data[ 7] * m[12];
289 t1 = m_Data[ 4] * m[ 1] + m_Data[ 5] * m[ 5] +
290 m_Data[ 6] * m[ 9] + m_Data[ 7] * m[13];
291 t2 = m_Data[ 4] * m[ 2] + m_Data[ 5] * m[ 6] +
292 m_Data[ 6] * m[10] + m_Data[ 7] * m[14];
293 t3 = m_Data[ 4] * m[ 3] + m_Data[ 5] * m[ 7] +
294 m_Data[ 6] * m[11] + m_Data[ 7] * m[15];
300 t0 = m_Data[ 8] * m[ 0] + m_Data[ 9] * m[ 4] +
301 m_Data[10] * m[ 8] + m_Data[11] * m[12];
302 t1 = m_Data[ 8] * m[ 1] + m_Data[ 9] * m[ 5] +
303 m_Data[10] * m[ 9] + m_Data[11] * m[13];
304 t2 = m_Data[ 8] * m[ 2] + m_Data[ 9] * m[ 6] +
305 m_Data[10] * m[10] + m_Data[11] * m[14];
306 t3 = m_Data[ 8] * m[ 3] + m_Data[ 9] * m[ 7] +
307 m_Data[10] * m[11] + m_Data[11] * m[15];
313 t0 = m_Data[12] * m[ 0] + m_Data[13] * m[ 4] +
314 m_Data[14] * m[ 8] + m_Data[15] * m[12];
315 t1 = m_Data[12] * m[ 1] + m_Data[13] * m[ 5] +
316 m_Data[14] * m[ 9] + m_Data[15] * m[13];
317 t2 = m_Data[12] * m[ 2] + m_Data[13] * m[ 6] +
318 m_Data[14] * m[10] + m_Data[15] * m[14];
319 t3 = m_Data[12] * m[ 3] + m_Data[13] * m[ 7] +
320 m_Data[14] * m[11] + m_Data[15] * m[15];
334 scalar =
T(1) / scalar;
336 for (
int i = 0;
i < 16; ++
i) {
346 template <
class T>
inline void
372 template <
class T>
inline void
384 template <
class T>
inline void
387 for (
int i = 0;
i < 16; ++
i) {
401 m_Data[row_idx + 2] ,
402 m_Data[row_idx + 3]);
420 template <
class T>
inline T
438 T kp = m_Data[10]*m_Data[15];
439 T lo = m_Data[11]*m_Data[14];
440 T jp = m_Data[ 9]*m_Data[15];
441 T ln = m_Data[11]*m_Data[13];
442 T jo = m_Data[ 9]*m_Data[14];
443 T kn = m_Data[10]*m_Data[13];
445 det = m_Data[0] * ( m_Data[5]*(
kp - lo)
446 - m_Data[6]*(jp - ln)
447 + m_Data[7]*(jo - kn) );
449 T ip = m_Data[ 8]*m_Data[15];
450 T lm = m_Data[11]*m_Data[12];
451 T io = m_Data[ 8]*m_Data[14];
452 T km = m_Data[10]*m_Data[12];
454 det -= m_Data[1] * ( m_Data[4]*(
kp - lo)
455 - m_Data[6]*(
ip - lm)
456 + m_Data[7]*(io - km) );
458 T in = m_Data[ 8]*m_Data[13];
459 T jm = m_Data[ 9]*m_Data[12];
461 det += m_Data[3] * ( m_Data[4]*(jp - ln)
462 - m_Data[5]*(
ip - lm)
463 + m_Data[7]*(
in - jm) );
465 det -= m_Data[4] * ( m_Data[4]*(jo - kn)
466 - m_Data[5]*(io - km)
467 + m_Data[6]*(
in - jm) );
Include a standard set of the NCBI C++ Toolkit most basic headers.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
const T & operator[](int i) const
CVect4< T > Row(int) const
const T & operator()(int i, int j) const
CMatrix4(T, T, T, T, T, T, T, T, T, T, T, T, T, T, T, T)
CMatrix4< T > & operator/=(T)
CMatrix4< T > & operator-=(T)
CVect4< T > Column(int) const
CMatrix4< T > & operator+=(T)
CMatrix4< T > & operator*=(T)
const T * GetData() const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
const GenericPointer< typename T::ValueType > T2 value
std::istream & in(std::istream &in_, double &x_)