parent
80032ddbcf
commit
872f23c5a9
5 changed files with 0 additions and 677 deletions
@ -1,60 +0,0 @@ |
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) |
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
// Created : 2007-09-21 |
|
||||||
// Updated : 2007-09-21 |
|
||||||
// Licence : This source is under MIT licence |
|
||||||
// File : glm/gtx/flexible_mix.inl |
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
|
|
||||||
namespace glm |
|
||||||
{ |
|
||||||
// mix |
|
||||||
template <typename T, typename U> |
|
||||||
inline T mixGTX(T x, T y, U a) |
|
||||||
{ |
|
||||||
//GLM_STATIC_ASSERT(detail::traits<U>::is_float); |
|
||||||
//return T(x * (U(1) - a) + y * a); |
|
||||||
return T(x + a * (y - x)); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T, typename U> |
|
||||||
inline detail::tvec2<T> mixGTX(const detail::tvec2<T>& x, const detail::tvec2<T>& y, U a) |
|
||||||
{ |
|
||||||
return detail::tvec2<T>(detail::tvec2<U>(x) * (U(1) - a) + detail::tvec2<U>(y) * a); |
|
||||||
//return x * (U(1) - a) + y * a; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T, typename U> |
|
||||||
inline detail::tvec3<T> mixGTX(const detail::tvec3<T>& x, const detail::tvec3<T>& y, U a) |
|
||||||
{ |
|
||||||
return detail::tvec3<T>(detail::tvec3<U>(x) * (U(1) - a) + detail::tvec3<U>(y) * a); |
|
||||||
//return x * (U(1) - a) + y * a; |
|
||||||
//return mix(x, y, tvec3<U>(a)); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T, typename U> |
|
||||||
inline detail::tvec4<T> mixGTX(const detail::tvec4<T>& x, const detail::tvec4<T>& y, U a) |
|
||||||
{ |
|
||||||
return detail::tvec4<T>(detail::tvec4<U>(x) * (U(1) - a) + detail::tvec4<U>(y) * a); |
|
||||||
//return x * (U(1) - a) + y * a; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T, typename U> |
|
||||||
inline detail::tvec2<T> mixGTX(const detail::tvec2<T>& x, const detail::tvec2<T>& y, const detail::tvec2<U>& a) |
|
||||||
{ |
|
||||||
return detail::tvec2<T>(detail::tvec2<U>(x) * (U(1) - a) + detail::tvec2<U>(y) * a); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T, typename U> |
|
||||||
inline detail::tvec3<T> mixGTX(const detail::tvec3<T>& x, const detail::tvec3<T>& y, const detail::tvec3<U>& a) |
|
||||||
{ |
|
||||||
return detail::tvec3<T>(detail::tvec3<U>(x) * (U(1) - a) + detail::tvec3<U>(y) * a); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T, typename U> |
|
||||||
inline detail::tvec4<T> mixGTX(const detail::tvec4<T>& x, const detail::tvec4<T>& y, const detail::tvec4<U>& a) |
|
||||||
{ |
|
||||||
return detail::tvec4<T>(detail::tvec4<U>(x) * (U(1) - a) + detail::tvec4<U>(y) * a); |
|
||||||
} |
|
||||||
} |
|
@ -1,405 +0,0 @@ |
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net) |
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
// Created : 2006-04-17 |
|
||||||
// Updated : 2006-04-17 |
|
||||||
// Licence : This source is under MIT licence |
|
||||||
// File : glm/gtx/mat4x3.inl |
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
|
|
||||||
namespace glm |
|
||||||
{ |
|
||||||
////////////////////////////////////////////////////////////// |
|
||||||
// Constructors |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>::_xmat4x3GTX() |
|
||||||
{ |
|
||||||
this->value[0] = tvec3<T>(1, 0, 0); |
|
||||||
this->value[1] = tvec3<T>(0, 1, 0); |
|
||||||
this->value[2] = tvec3<T>(0, 0, 1); |
|
||||||
this->value[3] = tvec3<T>(0, 0, 0); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>::_xmat4x3GTX(const T f) |
|
||||||
{ |
|
||||||
this->value[0] = tvec3<T>(f, 0, 0); |
|
||||||
this->value[1] = tvec3<T>(0, f, 0); |
|
||||||
this->value[2] = tvec3<T>(0, 0, f); |
|
||||||
this->value[3] = tvec3<T>(0, 0, 0); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>::_xmat4x3GTX |
|
||||||
( |
|
||||||
const T x0, const T y0, const T z0, |
|
||||||
const T x1, const T y1, const T z1, |
|
||||||
const T x2, const T y2, const T z2, |
|
||||||
const T x3, const T y3, const T z3 |
|
||||||
) |
|
||||||
{ |
|
||||||
this->value[0] = tvec3<T>(x0, y0, z0); |
|
||||||
this->value[1] = tvec3<T>(x1, y1, z1); |
|
||||||
this->value[2] = tvec3<T>(x2, y2, z2); |
|
||||||
this->value[3] = tvec3<T>(x3, y3, z3); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>::_xmat4x3GTX |
|
||||||
( |
|
||||||
const tvec3<T> & v0, |
|
||||||
const tvec3<T> & v1, |
|
||||||
const tvec3<T> & v2, |
|
||||||
const tvec3<T> & v3 |
|
||||||
) |
|
||||||
{ |
|
||||||
this->value[0] = v0; |
|
||||||
this->value[1] = v1; |
|
||||||
this->value[2] = v2; |
|
||||||
this->value[3] = v3; |
|
||||||
} |
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////// |
|
||||||
// Unary updatable operators |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator= (const _xmat4x3GTX<T>& m) |
|
||||||
{ |
|
||||||
this->value[0] = m[0]; |
|
||||||
this->value[1] = m[1]; |
|
||||||
this->value[2] = m[2]; |
|
||||||
this->value[3] = m[3]; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator+= (const T s) |
|
||||||
{ |
|
||||||
this->value[0] += s; |
|
||||||
this->value[1] += s; |
|
||||||
this->value[2] += s; |
|
||||||
this->value[3] += s; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator+= (const _xmat4x3GTX<T>& m) |
|
||||||
{ |
|
||||||
this->value[0] += m[0]; |
|
||||||
this->value[1] += m[1]; |
|
||||||
this->value[2] += m[2]; |
|
||||||
this->value[3] += m[3]; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator-= (const T s) |
|
||||||
{ |
|
||||||
this->value[0] -= s; |
|
||||||
this->value[1] -= s; |
|
||||||
this->value[2] -= s; |
|
||||||
this->value[3] -= s; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator-= (const _xmat4x3GTX<T>& m) |
|
||||||
{ |
|
||||||
this->value[0] -= m[0]; |
|
||||||
this->value[1] -= m[1]; |
|
||||||
this->value[2] -= m[2]; |
|
||||||
this->value[3] -= m[3]; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator*= (const T s) |
|
||||||
{ |
|
||||||
this->value[0] *= s; |
|
||||||
this->value[1] *= s; |
|
||||||
this->value[2] *= s; |
|
||||||
this->value[3] *= s; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator*= (const _xmat4x3GTX<T>& m) |
|
||||||
{ |
|
||||||
return (*this = *this * m); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> & _xmat4x3GTX<T>::operator/= (const T s) |
|
||||||
{ |
|
||||||
this->value[0] /= s; |
|
||||||
this->value[1] /= s; |
|
||||||
this->value[2] /= s; |
|
||||||
this->value[3] /= s; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
/* |
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator/= (const _xmat4x3GTX<T>& m) |
|
||||||
{ |
|
||||||
return (*this = *this / m); |
|
||||||
} |
|
||||||
*/ |
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator++ () |
|
||||||
{ |
|
||||||
++this->value[0]; |
|
||||||
++this->value[1]; |
|
||||||
++this->value[2]; |
|
||||||
++this->value[3]; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T>& _xmat4x3GTX<T>::operator-- () |
|
||||||
{ |
|
||||||
--this->value[0]; |
|
||||||
--this->value[1]; |
|
||||||
--this->value[2]; |
|
||||||
--this->value[3]; |
|
||||||
return *this; |
|
||||||
} |
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////// |
|
||||||
// Unary constant operators |
|
||||||
template <typename T> |
|
||||||
inline const _xmat4x3GTX<T> _xmat4x3GTX<T>::operator- () const |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
-this->value[0], |
|
||||||
-this->value[1], |
|
||||||
-this->value[2], |
|
||||||
-this->value[3]); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline const _xmat4x3GTX<T> _xmat4x3GTX<T>::operator-- (int n) const |
|
||||||
{ |
|
||||||
_xmat4x3GTX<T> m = *this; |
|
||||||
--m.value[0]; |
|
||||||
--m.value[1]; |
|
||||||
--m.value[2]; |
|
||||||
--m.value[3]; |
|
||||||
return m; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline const _xmat4x3GTX<T> _xmat4x3GTX<T>::operator++ (int n) const |
|
||||||
{ |
|
||||||
detail::tmat4x4<T> m = *this; |
|
||||||
++m.value[0]; |
|
||||||
++m.value[1]; |
|
||||||
++m.value[2]; |
|
||||||
++m.value[3]; |
|
||||||
return m; |
|
||||||
} |
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////// |
|
||||||
// Binary operators |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator+ (const _xmat4x3GTX<T>& m, const T s) |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
m[0] + s, |
|
||||||
m[1] + s, |
|
||||||
m[2] + s, |
|
||||||
m[3] + s); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator+ (const _xmat4x3GTX<T>& m1, const _xmat4x3GTX<T>& m2) |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
m1[0] + m2[0], |
|
||||||
m1[1] + m2[1], |
|
||||||
m1[2] + m2[2], |
|
||||||
m1[3] + m2[3]); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator- (const _xmat4x3GTX<T>& m, const T s) |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
m[0] - s, |
|
||||||
m[1] - s, |
|
||||||
m[2] - s, |
|
||||||
m[3] - s); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator- (const _xmat4x3GTX<T>& m1, const _xmat4x3GTX<T>& m2) |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
m1[0] - m2[0], |
|
||||||
m1[1] - m2[1], |
|
||||||
m1[2] - m2[2], |
|
||||||
m1[3] - m2[3]); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator* (const _xmat4x3GTX<T>& m, const T s) |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
m[0] * s, |
|
||||||
m[1] * s, |
|
||||||
m[2] * s, |
|
||||||
m[3] * s); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator* (const T s, const _xmat4x3GTX<T> & m) |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
m[0] * s, |
|
||||||
m[1] * s, |
|
||||||
m[2] * s, |
|
||||||
m[3] * s); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline tvec3<T> operator* (const _xmat4x3GTX<T>& m, const tvec4<T>& v) |
|
||||||
{ |
|
||||||
return tvec3<T>( |
|
||||||
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, |
|
||||||
m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, |
|
||||||
m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline tvec3<T> operator* (const tvec4<T>& v, const _xmat4x3GTX<T>& m) |
|
||||||
{ |
|
||||||
return tvec3<T>( |
|
||||||
m[0][0] * v.x + m[1][0] * v.y + m[2][0] * v.z + m[3][0] * v.w, |
|
||||||
m[0][1] * v.x + m[1][1] * v.y + m[2][1] * v.z + m[3][1] * v.w, |
|
||||||
m[0][2] * v.x + m[1][2] * v.y + m[2][2] * v.z + m[3][2] * v.w); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator* (const _xmat4x3GTX<T>& m1, const _xmat4x3GTX<T>& m2) |
|
||||||
{ |
|
||||||
const T SrcA00 = m1[0][0]; |
|
||||||
const T SrcA01 = m1[0][1]; |
|
||||||
const T SrcA02 = m1[0][2]; |
|
||||||
const T SrcA10 = m1[1][0]; |
|
||||||
const T SrcA11 = m1[1][1]; |
|
||||||
const T SrcA12 = m1[1][2]; |
|
||||||
const T SrcA20 = m1[2][0]; |
|
||||||
const T SrcA21 = m1[2][1]; |
|
||||||
const T SrcA22 = m1[2][2]; |
|
||||||
const T SrcA30 = m1[3][0]; |
|
||||||
const T SrcA31 = m1[3][1]; |
|
||||||
const T SrcA32 = m1[3][2]; |
|
||||||
|
|
||||||
const T SrcB00 = m2[0][0]; |
|
||||||
const T SrcB01 = m2[0][1]; |
|
||||||
const T SrcB02 = m2[0][2]; |
|
||||||
const T SrcB10 = m2[1][0]; |
|
||||||
const T SrcB11 = m2[1][1]; |
|
||||||
const T SrcB12 = m2[1][2]; |
|
||||||
const T SrcB20 = m2[2][0]; |
|
||||||
const T SrcB21 = m2[2][1]; |
|
||||||
const T SrcB22 = m2[2][2]; |
|
||||||
const T SrcB30 = m2[3][0]; |
|
||||||
const T SrcB31 = m2[3][1]; |
|
||||||
const T SrcB32 = m2[3][2]; |
|
||||||
|
|
||||||
_xmat4x3GTX<T> Result; |
|
||||||
Result[0][0] = SrcA00 * SrcB00 + SrcA10 * SrcB01 + SrcA20 * SrcB02; |
|
||||||
Result[0][1] = SrcA01 * SrcB00 + SrcA11 * SrcB01 + SrcA21 * SrcB02; |
|
||||||
Result[0][2] = SrcA02 * SrcB00 + SrcA12 * SrcB01 + SrcA22 * SrcB02; |
|
||||||
Result[1][0] = SrcA00 * SrcB10 + SrcA10 * SrcB11 + SrcA20 * SrcB12; |
|
||||||
Result[1][1] = SrcA01 * SrcB10 + SrcA11 * SrcB11 + SrcA21 * SrcB12; |
|
||||||
Result[1][2] = SrcA02 * SrcB10 + SrcA12 * SrcB11 + SrcA22 * SrcB12; |
|
||||||
Result[2][0] = SrcA00 * SrcB20 + SrcA10 * SrcB21 + SrcA20 * SrcB22; |
|
||||||
Result[2][1] = SrcA01 * SrcB20 + SrcA11 * SrcB21 + SrcA21 * SrcB22; |
|
||||||
Result[2][2] = SrcA02 * SrcB20 + SrcA12 * SrcB21 + SrcA22 * SrcB22; |
|
||||||
Result[3][0] = SrcA00 * SrcB30 + SrcA10 * SrcB31 + SrcA20 * SrcB32 + SrcA30; |
|
||||||
Result[3][1] = SrcA01 * SrcB30 + SrcA11 * SrcB31 + SrcA21 * SrcB32 + SrcA31; |
|
||||||
Result[3][2] = SrcA02 * SrcB30 + SrcA12 * SrcB31 + SrcA22 * SrcB32 + SrcA32; |
|
||||||
return Result; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator/ (const _xmat4x3GTX<T>& m, const T s) |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
m.value[0] / s, |
|
||||||
m.value[1] / s, |
|
||||||
m.value[2] / s, |
|
||||||
m.value[3] / s); |
|
||||||
} |
|
||||||
/* |
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator/ (const T s, const _xmat4x3GTX<T>& m) |
|
||||||
{ |
|
||||||
return _xmat4x3GTX<T>( |
|
||||||
s / m.value[0], |
|
||||||
s / m.value[1], |
|
||||||
s / m.value[2], |
|
||||||
s / m.value[3]); |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
tvec3<T> operator/ (const _xmat4x3GTX<T>& m, const tvec4<T>& v) |
|
||||||
{ |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
tvec3<T> operator/ (const tvec4<T>& v, const _xmat4x3GTX<T>& m) |
|
||||||
{ |
|
||||||
|
|
||||||
} |
|
||||||
*/ |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline _xmat4x3GTX<T> operator/ (const _xmat4x3GTX<T>& m1, const _xmat4x3GTX<T>& m2) |
|
||||||
{ |
|
||||||
T SubFactor01 = m2[2][1] * m2[3][2] - m2[3][1] * m2[2][2]; |
|
||||||
T SubFactor02 = m2[2][0] * m2[3][2] - m2[3][0] * m2[2][2]; |
|
||||||
T SubFactor03 = m2[2][0] * m2[3][1] - m2[3][0] * m2[2][1]; |
|
||||||
T SubFactor04 = m2[1][1] * m2[3][2] - m2[3][1] * m2[1][2]; |
|
||||||
T SubFactor05 = m2[1][0] * m2[3][2] - m2[3][0] * m2[1][2]; |
|
||||||
T SubFactor06 = m2[1][0] * m2[3][1] - m2[3][0] * m2[1][1]; |
|
||||||
T SubFactor07 = m2[1][1] * m2[2][2] - m2[2][1] * m2[1][2]; |
|
||||||
T SubFactor08 = m2[1][0] * m2[2][2] - m2[2][0] * m2[1][2]; |
|
||||||
T SubFactor09 = m2[1][0] * m2[2][1] - m2[2][0] * m2[1][1]; |
|
||||||
|
|
||||||
_xmat4x3GTX<T> Inverse( |
|
||||||
+ m2[1][3] * SubFactor01, |
|
||||||
- m2[1][3] * SubFactor02, |
|
||||||
+ m2[1][3] * SubFactor03, |
|
||||||
-(m2[1][0] * SubFactor01 - m2[1][1] * SubFactor02 + m2[1][2] * SubFactor03), |
|
||||||
|
|
||||||
- m2[0][3] * SubFactor01, |
|
||||||
+ m2[0][3] * SubFactor02, |
|
||||||
- m2[0][3] * SubFactor03, |
|
||||||
+(m2[0][0] * SubFactor02 - m2[0][1] * SubFactor02 + m2[0][2] * SubFactor03), |
|
||||||
|
|
||||||
+ m2[0][3] * SubFactor04, |
|
||||||
- m2[0][3] * SubFactor05, |
|
||||||
+ m2[0][3] * SubFactor06, |
|
||||||
-(m2[0][0] * SubFactor04 - m2[0][1] * SubFactor05 + m2[0][2] * SubFactor06), |
|
||||||
|
|
||||||
- m2[0][3] * SubFactor07, |
|
||||||
+ m2[0][3] * SubFactor08, |
|
||||||
- m2[0][3] * SubFactor09, |
|
||||||
+(m2[0][0] * SubFactor07 - m2[0][1] * SubFactor08 + m2[0][2] * SubFactor09)); |
|
||||||
|
|
||||||
T Determinant = m2[0][0] * Inverse[0][0] |
|
||||||
+ m2[0][1] * Inverse[1][0] |
|
||||||
+ m2[0][2] * Inverse[2][0] |
|
||||||
+ m2[0][3] * Inverse[3][0]; |
|
||||||
|
|
||||||
Inverse /= Determinant; |
|
||||||
|
|
||||||
return m1 * Inverse; |
|
||||||
} |
|
||||||
|
|
||||||
} //namespace glm |
|
@ -1,67 +0,0 @@ |
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net)
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Created : 2007-11-21
|
|
||||||
// Updated : 2007-11-21
|
|
||||||
// Licence : This source is under MIT License
|
|
||||||
// File : glm/gtx/statistics_operation.h
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Dependency:
|
|
||||||
// - GLM core
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef glm_gtx_statistics_operation |
|
||||||
#define glm_gtx_statistics_operation |
|
||||||
|
|
||||||
// Dependency:
|
|
||||||
#include "../glm.hpp" |
|
||||||
|
|
||||||
namespace glm |
|
||||||
{ |
|
||||||
template <typename T> T statDistanceGTX(const detail::tvec2<T>& v1, const detail::tvec2<T>& v2); |
|
||||||
template <typename T> T statDistanceGTX(const detail::tvec3<T>& v1, const detail::tvec3<T>& v2); |
|
||||||
template <typename T> T statDistanceGTX(const detail::tvec4<T>& v1, const detail::tvec4<T>& v2); |
|
||||||
|
|
||||||
template <typename T> T statDistanceGTX(const detail::tmat2x2<T>& m1, const detail::tmat2x2<T>& m2); |
|
||||||
template <typename T> T statDistanceGTX(const detail::tmat3x3<T>& m1, const detail::tmat3x3<T>& m2); |
|
||||||
template <typename T> T statDistanceGTX(const detail::tmat4x4<T>& m1, const detail::tmat4x4<T>& m2); |
|
||||||
|
|
||||||
template <typename T> T expectedValueGTX(const detail::tvec2<T>& v1, const detail::tvec2<T>& v2); |
|
||||||
template <typename T> T expectedValueGTX(const detail::tvec3<T>& v1, const detail::tvec3<T>& v2); |
|
||||||
template <typename T> T expectedValueGTX(const detail::tvec4<T>& v1, const detail::tvec4<T>& v2); |
|
||||||
|
|
||||||
template <typename T> T expectedValueGTX(const detail::tmat2x2<T>& m1, const detail::tmat2x2<T>& m2); |
|
||||||
template <typename T> T expectedValueGTX(const detail::tmat3x3<T>& m1, const detail::tmat3x3<T>& m2); |
|
||||||
template <typename T> T expectedValueGTX(const detail::tmat4x4<T>& m1, const detail::tmat4x4<T>& m2); |
|
||||||
|
|
||||||
template <typename T> T varianceGTX(const detail::tvec2<T>& v1, const detail::tvec2<T>& v2); |
|
||||||
template <typename T> T varianceGTX(const detail::tvec3<T>& v1, const detail::tvec3<T>& v2); |
|
||||||
template <typename T> T varianceGTX(const detail::tvec4<T>& v1, const detail::tvec4<T>& v2); |
|
||||||
|
|
||||||
template <typename T> T varianceGTX(const detail::tmat2x2<T>& m1, const detail::tmat2x2<T>& m2); |
|
||||||
template <typename T> T varianceGTX(const detail::tmat3x3<T>& m1, const detail::tmat3x3<T>& m2); |
|
||||||
template <typename T> T varianceGTX(const detail::tmat4x4<T>& m1, const detail::tmat4x4<T>& m2); |
|
||||||
|
|
||||||
template <typename T> T standardDevitionGTX(const detail::tvec2<T>& v1, const detail::tvec2<T>& v2); |
|
||||||
template <typename T> T standardDevitionGTX(const detail::tvec3<T>& v1, const detail::tvec3<T>& v2); |
|
||||||
template <typename T> T standardDevitionGTX(const detail::tvec4<T>& v1, const detail::tvec4<T>& v2); |
|
||||||
|
|
||||||
template <typename T> T standardDevitionGTX(const detail::tmat2x2<T>& m1, const detail::tmat2x2<T>& m2); |
|
||||||
template <typename T> T standardDevitionGTX(const detail::tmat3x3<T>& m1, const detail::tmat3x3<T>& m2); |
|
||||||
template <typename T> T standardDevitionGTX(const detail::tmat4x4<T>& m1, const detail::tmat4x4<T>& m2); |
|
||||||
|
|
||||||
namespace gtx |
|
||||||
{ |
|
||||||
//! GLM_GTX_statistics_operation extension: - Work in progress - Statistics functions
|
|
||||||
namespace statistics_operation |
|
||||||
{ |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
#include "statistics_operation.inl" |
|
||||||
|
|
||||||
namespace glm{using namespace gtx::statistics_operation;} |
|
||||||
|
|
||||||
#endif//glm_gtx_statistics_operation
|
|
@ -1,81 +0,0 @@ |
|||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2010 G-Truc Creation (www.g-truc.net) |
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
// Created : 2007-11-21 |
|
||||||
// Updated : 2007-11-21 |
|
||||||
// Licence : This source is under MIT License |
|
||||||
// File : glm/gtx/statistics_operator.inl |
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
// Dependency: |
|
||||||
// - GLM core |
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
||||||
|
|
||||||
#include <cassert> |
|
||||||
|
|
||||||
namespace glm |
|
||||||
{ |
|
||||||
//! Compute the sum of square of differences between each matrices paremeters |
|
||||||
template <typename T> |
|
||||||
inline T statDistanceGTX(const detail::tmat2x2<T>& m1, const detail::tmat2x2<T>& m2) |
|
||||||
{ |
|
||||||
T result = T(0); |
|
||||||
for(int j = 0; j < 2; ++j) |
|
||||||
for(int i = 0; i < 2; ++i) |
|
||||||
{ |
|
||||||
T diff = m1[j][i] - m2[j][i]; |
|
||||||
result += diff * diff; |
|
||||||
} |
|
||||||
return result; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline T statDistanceGTX(const detail::tmat3x3<T>& m1, const detail::tmat3x3<T>& m2) |
|
||||||
{ |
|
||||||
T result = T(0); |
|
||||||
for(int j = 0; j < 3; ++j) |
|
||||||
for(int i = 0; i < 3; ++i) |
|
||||||
{ |
|
||||||
T diff = m1[j][i] - m2[j][i]; |
|
||||||
result += diff * diff; |
|
||||||
} |
|
||||||
return result; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
inline T statDistanceGTX(const detail::tmat4x4<T>& m1, const detail::tmat4x4<T>& m2) |
|
||||||
{ |
|
||||||
T result = T(0); |
|
||||||
for(int j = 0; j < 4; ++j) |
|
||||||
for(int i = 0; i < 4; ++i) |
|
||||||
{ |
|
||||||
T diff = m1[j][i] - m2[j][i]; |
|
||||||
result += diff * diff; |
|
||||||
} |
|
||||||
return result; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
T expectedValueGTX(const detail::tmat4x4<T>& m) |
|
||||||
{ |
|
||||||
T result = T(0); |
|
||||||
for(int j = 0; j < 4; ++j) |
|
||||||
for(int i = 0; i < 4; ++i) |
|
||||||
result += m[j][i]; |
|
||||||
result *= T(0,0625); |
|
||||||
return result; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
T varianceGTX(const detail::tmat4x4<T>& m) |
|
||||||
{ |
|
||||||
T ExpectedValue = expectedValueGTX(m); |
|
||||||
T ExpectedValueOfSquaredMatrix = expectedValueGTX(matrixCompMult(m)); |
|
||||||
return ExpectedValueOfSquaredMatrix - ExpectedValue * ExpectedValue; |
|
||||||
} |
|
||||||
|
|
||||||
template <typename T> |
|
||||||
T standardDevitionGTX(const detail::tmat4x4<T>& m) |
|
||||||
{ |
|
||||||
return sqrt(varianceGTX(m)); |
|
||||||
} |
|
||||||
} |
|
@ -1,64 +0,0 @@ |
|||||||
#ifndef GLM_EXT_VIRTREV_GL_HPP |
|
||||||
#define GLM_EXT_VIRTREV_GL_HPP |
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)
|
|
||||||
// Virtrev SDK copyright matrem (matrem84.free.fr)
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Created : 2008-04-24
|
|
||||||
// Updated : 2008-10-07
|
|
||||||
// Licence : This source is under MIT License
|
|
||||||
// File : glm/ext/virtrev/gl.h
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Dependency:
|
|
||||||
// - GLM core
|
|
||||||
// - glew or glee or gl library header
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "../glm.hpp" |
|
||||||
|
|
||||||
#if !defined(GLM_DEPENDENCE) || !(GLM_DEPENDENCE & (GLM_DEPENDENCE_GLEW|GLM_DEPENDENCE_GLEE|GLM_DEPENDENCE_GL)) |
|
||||||
#error GLM_VIRTREV_gl requires OpenGL to build. GLM_DEPENDENCE doesn't define the dependence. |
|
||||||
#endif//GLM_DEPENDENCE
|
|
||||||
|
|
||||||
namespace glm |
|
||||||
{ |
|
||||||
namespace virtrev_glmext |
|
||||||
{ |
|
||||||
//! GLM_VIRTREV_gl extension: Vector & matrix integration with OpenGL.
|
|
||||||
namespace gl |
|
||||||
{ |
|
||||||
typedef detail::tvec2<GLfloat> gl_vec2; ///< vec2 for GLfloat OpenGL type
|
|
||||||
typedef detail::tvec3<GLfloat> gl_vec3; ///< vec3 for GLfloat OpenGL type
|
|
||||||
typedef detail::tvec4<GLfloat> gl_vec4; ///< vec4 for GLfloat OpenGL type
|
|
||||||
|
|
||||||
typedef detail::tvec2<GLshort> gl_svec2; ///< vec2 for GLshort OpenGL type
|
|
||||||
typedef detail::tvec3<GLshort> gl_svec3; ///< vec3 for GLshort OpenGL type
|
|
||||||
typedef detail::tvec4<GLshort> gl_svec4; ///< vec4 for GLshort OpenGL type
|
|
||||||
|
|
||||||
typedef detail::tvec2<GLint> gl_ivec2; ///< vec2 for GLint OpenGL type
|
|
||||||
typedef detail::tvec3<GLint> gl_ivec3; ///< vec3 for GLint OpenGL type
|
|
||||||
typedef detail::tvec4<GLint> gl_ivec4; ///< vec4 for GLint OpenGL type
|
|
||||||
|
|
||||||
typedef detail::tmat2x2<GLfloat> gl_mat2; ///< mat2x2 for GLfloat OpenGL type
|
|
||||||
typedef detail::tmat3x3<GLfloat> gl_mat3; ///< mat3x3 for GLfloat OpenGL type
|
|
||||||
typedef detail::tmat4x4<GLfloat> gl_mat4; ///< mat4x4 for GLfloat OpenGL type
|
|
||||||
|
|
||||||
typedef detail::tmat2x3<GLfloat> gl_mat2x3; ///< mat2x3 for GLfloat OpenGL type
|
|
||||||
typedef detail::tmat3x2<GLfloat> gl_mat3x2; ///< mat3x2 for GLfloat OpenGL type
|
|
||||||
typedef detail::tmat2x4<GLfloat> gl_mat2x4; ///< mat2x4 for GLfloat OpenGL type
|
|
||||||
typedef detail::tmat4x2<GLfloat> gl_mat4x2; ///< mat4x2 for GLfloat OpenGL type
|
|
||||||
typedef detail::tmat3x4<GLfloat> gl_mat3x4; ///< mat3x4 for GLfloat OpenGL type
|
|
||||||
typedef detail::tmat4x3<GLfloat> gl_mat4x3; ///< mat4x3 for GLfloat OpenGL type
|
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
#define GLM_VIRTREV_gl namespace glm::virtrev_glmext::gl |
|
||||||
#ifndef GLM_VIRTREV_GLOBAL |
|
||||||
namespace glm {using GLM_VIRTREV_gl;} |
|
||||||
#endif//GLM_VIRTREV_GLOBAL
|
|
||||||
|
|
||||||
#endif//GLM_EXT_VIRTREV_GL_HPP
|
|
||||||
|
|
Loading…
Reference in New Issue