Removed all references to the useless old vcg::math::Swap

This commit is contained in:
Paolo Cignoni 2013-07-26 07:01:21 +00:00
parent f9db54196b
commit 04268b170f
7 changed files with 280 additions and 282 deletions

View File

@ -90,6 +90,7 @@ Edited Comments and GPL license
#include <math.h>
#include <assert.h>
#include <limits>
#include <algorithm>
#ifdef __BORLANDC__
@ -153,15 +154,12 @@ namespace math {
}
}
template<class T> inline void Swap(T &a, T &b){
T tmp=a; a=b; b=tmp;
}
template<class T> inline void Sort(T &a, T &b){
if (a>b) Swap(a,b);
if (a>b) std::swap(a,b);
}
template<class T> inline void Sort(T &a, T &b, T &c){
if (a>b) Swap(a,b);
if (b>c) {Swap(b,c); if (a>b) Swap(a,b);}
if (a>b) std::swap(a,b);
if (b>c) {std::swap(b,c); if (a>b) std::swap(a,b);}
}
/* Some <math.h> files do not define M_PI... */

View File

@ -105,7 +105,7 @@ protected :
for (unsigned n = 1; n < l; ++n)
{
Swap(p0, p1);
std::swap(p0, p1);
p1 = legendre_next(n, p0, p1, x);
}
@ -134,7 +134,7 @@ protected :
while(n < l)
{
Swap(p_m_m, p_m_mplusone);
std::swap(p_m_m, p_m_mplusone);
p_m_mplusone = legendre_next(n, m, p_m_m, p_m_mplusone, cos_theta);
++n;
}

View File

@ -261,9 +261,9 @@ public:
/// Funzione per eseguire la trasposta della matrice
Matrix33 & Transpose()
{
math::Swap(a[1],a[3]);
math::Swap(a[2],a[6]);
math::Swap(a[5],a[7]);
std::swap(a[1],a[3]);
std::swap(a[2],a[6]);
std::swap(a[5],a[7]);
return *this;
}

View File

@ -661,7 +661,7 @@ template <class T> Point3<T> operator*(const Matrix44<T> &m, const Point3<T> &p)
template <class T> Matrix44<T> &Transpose(Matrix44<T> &m) {
for(int i = 1; i < 4; i++)
for(int j = 0; j < i; j++) {
math::Swap(m.ElementAt(i, j), m.ElementAt(j, i));
std::swap(m.ElementAt(i, j), m.ElementAt(j, i));
}
return m;
}

View File

@ -837,11 +837,11 @@ public:
int exp0,exp1,exp2,exp3;
frexp( double(k0), &exp0 );frexp( double(k1), &exp1 );
frexp( double(k2), &exp2 );frexp( double(k3), &exp3 );
if (exp0>exp1) { math::Swap(k0,k1); math::Swap(exp0,exp1); }
if (exp2>exp3) { math::Swap(k2,k3); math::Swap(exp2,exp3); }
if (exp0>exp2) { math::Swap(k0,k2); math::Swap(exp0,exp2); }
if (exp1>exp3) { math::Swap(k1,k3); math::Swap(exp1,exp3); }
if (exp2>exp3) { math::Swap(k2,k3); math::Swap(exp2,exp3); }
if (exp0>exp1) { std::swap(k0,k1); std::swap(exp0,exp1); }
if (exp2>exp3) { std::swap(k2,k3); std::swap(exp2,exp3); }
if (exp0>exp2) { std::swap(k0,k2); std::swap(exp0,exp2); }
if (exp1>exp3) { std::swap(k1,k3); std::swap(exp1,exp3); }
if (exp2>exp3) { std::swap(k2,k3); std::swap(exp2,exp3); }
return ( (k0 + k1) + k2 ) +k3; }
//@}

View File

@ -331,11 +331,11 @@ public:
frexp( double(k0), &exp0 );frexp( double(k1), &exp1 );
frexp( double(k2), &exp2 );frexp( double(k3), &exp3 );
if (exp0>exp1) { math::Swap(k0,k1); math::Swap(exp0,exp1); }
if (exp2>exp3) { math::Swap(k2,k3); math::Swap(exp2,exp3); }
if (exp0>exp2) { math::Swap(k0,k2); math::Swap(exp0,exp2); }
if (exp1>exp3) { math::Swap(k1,k3); math::Swap(exp1,exp3); }
if (exp2>exp3) { math::Swap(k2,k3); math::Swap(exp2,exp3); }
if (exp0>exp1) { std::swap(k0,k1); std::swap(exp0,exp1); }
if (exp2>exp3) { std::swap(k2,k3); std::swap(exp2,exp3); }
if (exp0>exp2) { std::swap(k0,k2); std::swap(exp0,exp2); }
if (exp1>exp3) { std::swap(k1,k3); std::swap(exp1,exp3); }
if (exp2>exp3) { std::swap(k2,k3); std::swap(exp2,exp3); }
return ( (k0 + k1) + k2 ) +k3;
}

View File

@ -117,11 +117,11 @@ public:
frexp( double(k0), &exp0 );frexp( double(k1), &exp1 );
frexp( double(k2), &exp2 );frexp( double(k3), &exp3 );
if (exp0>exp1) { math::Swap(k0,k1); math::Swap(exp0,exp1); }
if (exp2>exp3) { math::Swap(k2,k3); math::Swap(exp2,exp3); }
if (exp0>exp2) { math::Swap(k0,k2); math::Swap(exp0,exp2); }
if (exp1>exp3) { math::Swap(k1,k3); math::Swap(exp1,exp3); }
if (exp2>exp3) { math::Swap(k2,k3); math::Swap(exp2,exp3); }
if (exp0>exp1) { std::swap(k0,k1); std::swap(exp0,exp1); }
if (exp2>exp3) { std::swap(k2,k3); std::swap(exp2,exp3); }
if (exp0>exp2) { std::swap(k0,k2); std::swap(exp0,exp2); }
if (exp1>exp3) { std::swap(k1,k3); std::swap(exp1,exp3); }
if (exp2>exp3) { std::swap(k2,k3); std::swap(exp2,exp3); }
return ( (k0 + k1) + k2 ) +k3;
}