minor changes to comply gcc compiler
This commit is contained in:
parent
061c49ab5e
commit
825c3b9a0c
|
@ -74,10 +74,14 @@ namespace vcg
|
||||||
class ExtendedMarchingCubes
|
class ExtendedMarchingCubes
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
#else
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
typedef unsigned __int64 size_t;
|
typedef unsigned __int64 size_t;
|
||||||
#else
|
#else
|
||||||
typedef _W64 unsigned int size_t;
|
typedef _W64 unsigned int size_t;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
typedef typename vcg::tri::Allocator< TRIMESH_TYPE > AllocatorType;
|
typedef typename vcg::tri::Allocator< TRIMESH_TYPE > AllocatorType;
|
||||||
typedef typename TRIMESH_TYPE::ScalarType ScalarType;
|
typedef typename TRIMESH_TYPE::ScalarType ScalarType;
|
||||||
|
|
|
@ -67,10 +67,14 @@ namespace vcg
|
||||||
public:
|
public:
|
||||||
enum Dimension {X, Y, Z};
|
enum Dimension {X, Y, Z};
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
#else
|
||||||
#ifdef _WIN64
|
#ifdef _WIN64
|
||||||
typedef unsigned __int64 size_t;
|
typedef unsigned __int64 size_t;
|
||||||
#else
|
#else
|
||||||
typedef _W64 unsigned int size_t;
|
typedef _W64 unsigned int size_t;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
typedef typename vcg::tri::Allocator< TRIMESH_TYPE > AllocatorType;
|
typedef typename vcg::tri::Allocator< TRIMESH_TYPE > AllocatorType;
|
||||||
typedef typename TRIMESH_TYPE::ScalarType ScalarType;
|
typedef typename TRIMESH_TYPE::ScalarType ScalarType;
|
||||||
|
|
|
@ -5,6 +5,18 @@ namespace vcg
|
||||||
/** \addtogroup math */
|
/** \addtogroup math */
|
||||||
/* @{ */
|
/* @{ */
|
||||||
|
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
template< typename TYPE >
|
||||||
|
static void JacobiRotate(Matrix44<TYPE> &A, TYPE s, TYPE tau, int i,int j,int k,int l)
|
||||||
|
{
|
||||||
|
TYPE g=A[i][j];
|
||||||
|
TYPE h=A[k][l];
|
||||||
|
A[i][j]=g-s*(h+g*tau);
|
||||||
|
A[k][l]=h+s*(g-h*tau);
|
||||||
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Computes all eigenvalues and eigenvectors of a real symmetric matrix .
|
* Computes all eigenvalues and eigenvectors of a real symmetric matrix .
|
||||||
* On output, elements of the input matrix above the diagonal are destroyed.
|
* On output, elements of the input matrix above the diagonal are destroyed.
|
||||||
|
@ -97,18 +109,33 @@ namespace vcg
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
|
||||||
*
|
// Computes (a^2 + b^2)^(1/2) without destructive underflow or overflow.
|
||||||
*/
|
template <typename TYPE>
|
||||||
template< typename TYPE >
|
inline static TYPE pythagora(TYPE a, TYPE b)
|
||||||
void JacobiRotate(Matrix44<TYPE> &A, TYPE s, TYPE tau, int i,int j,int k,int l)
|
|
||||||
{
|
{
|
||||||
TYPE g=A[i][j];
|
TYPE abs_a = fabs(a);
|
||||||
TYPE h=A[k][l];
|
TYPE abs_b = fabs(b);
|
||||||
A[i][j]=g-s*(h+g*tau);
|
if (abs_a > abs_b)
|
||||||
A[k][l]=h+s*(g-h*tau);
|
return abs_a*sqrt(1.0+sqr(abs_b/abs_a));
|
||||||
|
else
|
||||||
|
return (abs_b == 0.0 ? 0.0 : abs_b*sqrt(1.0+sqr(abs_a/abs_b)));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
inline static TYPE sign(TYPE a, TYPE b)
|
||||||
|
{
|
||||||
|
return (b >= 0.0 ? fabs(a) : -fabs(a));
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename TYPE>
|
||||||
|
inline static TYPE sqr(TYPE a)
|
||||||
|
{
|
||||||
|
TYPE sqr_arg = a;
|
||||||
|
return (sqr_arg == 0 ? 0 : sqr_arg*sqr_arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Given a matrix <I>A<SUB>m×n</SUB></I>, this routine computes its singular value decomposition,
|
* Given a matrix <I>A<SUB>m×n</SUB></I>, this routine computes its singular value decomposition,
|
||||||
* i.e. <I>A=U·W·V<SUP>T</SUP></I>. The matrix <I>A</I> will be destroyed!
|
* i.e. <I>A=U·W·V<SUP>T</SUP></I>. The matrix <I>A</I> will be destroyed!
|
||||||
|
@ -149,7 +176,7 @@ namespace vcg
|
||||||
s += A[k][i]*A[k][i];
|
s += A[k][i]*A[k][i];
|
||||||
}
|
}
|
||||||
f=A[i][i];
|
f=A[i][i];
|
||||||
g = -vcg::sign<double>( sqrt(s), f );
|
g = -sign<double>( sqrt(s), f );
|
||||||
h = f*g - s;
|
h = f*g - s;
|
||||||
A[i][i]=f-g;
|
A[i][i]=f-g;
|
||||||
for (j=l; j<n; j++)
|
for (j=l; j<n; j++)
|
||||||
|
@ -178,7 +205,7 @@ namespace vcg
|
||||||
s += A[i][k]*A[i][k];
|
s += A[i][k]*A[i][k];
|
||||||
}
|
}
|
||||||
f = A[i][l];
|
f = A[i][l];
|
||||||
g = -vcg::sign<double>(sqrt(s),f);
|
g = -sign<double>(sqrt(s),f);
|
||||||
h = f*g - s;
|
h = f*g - s;
|
||||||
A[i][l] = f-g;
|
A[i][l] = f-g;
|
||||||
for (k=l; k<n; k++)
|
for (k=l; k<n; k++)
|
||||||
|
@ -278,7 +305,7 @@ namespace vcg
|
||||||
if ((double)(fabs(f)+anorm) == anorm)
|
if ((double)(fabs(f)+anorm) == anorm)
|
||||||
break;
|
break;
|
||||||
g = W[i];
|
g = W[i];
|
||||||
h = pythagora< double >(f,g);
|
h = pythagora<double>(f,g);
|
||||||
W[i] = h;
|
W[i] = h;
|
||||||
h = 1.0/h;
|
h = 1.0/h;
|
||||||
c = g*h;
|
c = g*h;
|
||||||
|
@ -407,30 +434,5 @@ namespace vcg
|
||||||
delete []tmp;
|
delete []tmp;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Computes (a^2 + b^2)^(1/2) without destructive underflow or overflow.
|
|
||||||
template <typename TYPE>
|
|
||||||
inline TYPE pythagora(TYPE a, TYPE b)
|
|
||||||
{
|
|
||||||
TYPE abs_a = fabs(a);
|
|
||||||
TYPE abs_b = fabs(b);
|
|
||||||
if (abs_a > abs_b)
|
|
||||||
return abs_a*sqrt(1.0+sqr(abs_b/abs_a));
|
|
||||||
else
|
|
||||||
return (abs_b == 0.0 ? 0.0 : abs_b*sqrt(1.0+sqr(abs_a/abs_b)));
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename TYPE>
|
|
||||||
inline TYPE sign(TYPE a, TYPE b)
|
|
||||||
{
|
|
||||||
return (b >= 0.0 ? fabs(a) : -fabs(a));
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename TYPE>
|
|
||||||
inline TYPE sqr(TYPE a)
|
|
||||||
{
|
|
||||||
TYPE sqr_arg = a;
|
|
||||||
return (sqr_arg == 0 ? 0 : sqr_arg*sqr_arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*! @} */
|
/*! @} */
|
||||||
}; // end of namespace
|
}; // end of namespace
|
Loading…
Reference in New Issue