Fixed some of the pull request code in order to merge it

Former-commit-id: 76d71f15b335535e7dfcaf986440a00e85e45c1b
This commit is contained in:
Lynix
2014-06-15 01:55:07 +02:00
parent 62daced765
commit eceabcd241
10 changed files with 56 additions and 48 deletions

View File

@@ -159,7 +159,7 @@ NzSphere<T> NzBox<T>::GetBoundingSphere() const
template<typename T>
NzVector3<T> NzBox<T>::GetCenter() const
{
return GetPosition() + F(0.5)*GetLengths();
return GetPosition() + GetLengths()/F(2.0);
}
template<typename T>
@@ -237,7 +237,7 @@ template<typename T>
T NzBox<T>::GetSquaredRadius() const
{
NzVector3<T> size(GetLengths());
size *= F(0.5); // La taille étant relative à la position (minimum) de la boite et non pas à son centre
size /= F(2.0); // La taille étant relative à la position (minimum) de la boite et non pas à son centre
return size.GetSquaredLength();
}
@@ -394,7 +394,7 @@ template<typename T>
NzBox<T>& NzBox<T>::Transform(const NzMatrix4<T>& matrix, bool applyTranslation)
{
NzVector3<T> center = matrix.Transform(GetCenter(), (applyTranslation) ? F(1.0) : F(0.0)); // Valeur multipliant la translation
NzVector3<T> halfSize = GetLengths() * F(0.5);
NzVector3<T> halfSize = GetLengths()/F(2.0);
halfSize.Set(std::fabs(matrix(0,0))*halfSize.x + std::fabs(matrix(1,0))*halfSize.y + std::fabs(matrix(2,0))*halfSize.z,
std::fabs(matrix(0,1))*halfSize.x + std::fabs(matrix(1,1))*halfSize.y + std::fabs(matrix(2,1))*halfSize.z,
@@ -465,6 +465,7 @@ NzBox<T>& NzBox<T>::operator*=(T scalar)
width *= scalar;
height *= scalar;
depth *= scalar;
return *this;
}
@@ -474,6 +475,7 @@ NzBox<T>& NzBox<T>::operator*=(const NzVector3<T>& vec)
width *= vec.x;
height *= vec.y;
depth *= vec.z;
return *this;
}