fix typename errors

This commit is contained in:
T.Alderighi 2018-05-11 11:42:45 +02:00
parent f8ff736074
commit 02bfeb2f67
2 changed files with 358 additions and 345 deletions

View File

@ -178,11 +178,11 @@ public:
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<4); return v[j]; } inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<4); return v[j]; }
inline typename T::VertexType * const cV( const int j ) const { assert(j>=0 && j<4); return v[j]; } inline typename T::VertexType * const cV( const int j ) const { assert(j>=0 && j<4); return v[j]; }
inline typename size_t const cFtoVi (const int f, const int j) const { assert(f >= 0 && f < 4); assert(j >= 0 && j < 3); return findices[f][j]; } inline size_t const cFtoVi (const int f, const int j) const { assert(f >= 0 && f < 4); assert(j >= 0 && j < 3); return findices[f][j]; }
// Shortcut for tetra points // Shortcut for tetra points
inline typename CoordType & P( const int j ) { assert(j>=0 && j<4); return v[j]->P(); } inline CoordType & P( const int j ) { assert(j>=0 && j<4); return v[j]->P(); }
inline const typename CoordType &cP( const int j ) const { assert(j>=0 && j<4); return v[j]->P(); } inline const CoordType &cP( const int j ) const { assert(j>=0 && j<4); return v[j]->P(); }
/** Return the pointer to the ((j+1)%4)-th vertex of the tetra. /** Return the pointer to the ((j+1)%4)-th vertex of the tetra.
@param j Index of the face vertex. @param j Index of the face vertex.
@ -201,18 +201,18 @@ public:
inline const typename T::VertexType * const & cV3( const int j ) const { return cV((j+3)%4);} inline const typename T::VertexType * const & cV3( const int j ) const { return cV((j+3)%4);}
/// Shortcut to get vertex values /// Shortcut to get vertex values
inline typename CoordType &P0 (const int j) { return V(j)->P(); } inline CoordType &P0 (const int j) { return V(j)->P(); }
inline typename CoordType &P2 (const int j) { return V((j + 2) % 4)->P(); } inline CoordType &P2 (const int j) { return V((j + 2) % 4)->P(); }
inline typename CoordType &P3 (const int j) { return V((j + 3) % 4)->P(); } inline CoordType &P3 (const int j) { return V((j + 3) % 4)->P(); }
inline typename CoordType &P1 (const int j) { return V((j + 1) % 4)->P(); } inline CoordType &P1 (const int j) { return V((j + 1) % 4)->P(); }
inline const typename CoordType &P0 (const int j) const { return V(j)->P(); } inline const CoordType &P0 (const int j) const { return V(j)->P(); }
inline const typename CoordType &P1 (const int j) const { return V((j + 1) % 4)->P(); } inline const CoordType &P1 (const int j) const { return V((j + 1) % 4)->P(); }
inline const typename CoordType &P2 (const int j) const { return V((j + 2) % 4)->P(); } inline const CoordType &P2 (const int j) const { return V((j + 2) % 4)->P(); }
inline const typename CoordType &P3 (const int j) const { return V((j + 3) % 4)->P(); } inline const CoordType &P3 (const int j) const { return V((j + 3) % 4)->P(); }
inline const typename CoordType &cP0(const int j) const { return cV(j)->P(); } inline const CoordType &cP0(const int j) const { return cV(j)->P(); }
inline const typename CoordType &cP1(const int j) const { return cV((j + 1) % 4)->P(); } inline const CoordType &cP1(const int j) const { return cV((j + 1) % 4)->P(); }
inline const typename CoordType &cP2(const int j) const { return cV((j + 2) % 4)->P(); } inline const CoordType &cP2(const int j) const { return cV((j + 2) % 4)->P(); }
inline const typename CoordType &cP3(const int j) const { return cV((j + 3) % 4)->P(); } inline const CoordType &cP3(const int j) const { return cV((j + 3) % 4)->P(); }
static bool HasVertexRef() { return true; } static bool HasVertexRef() { return true; }
static bool HasTVAdjacency() { return true; } static bool HasTVAdjacency() { return true; }

View File

@ -127,7 +127,8 @@ Initial commit
#include <algorithm> #include <algorithm>
namespace vcg { namespace vcg
{
/** \addtogroup space */ /** \addtogroup space */
/*@{*/ /*@{*/
/** /**
@ -138,12 +139,11 @@ namespace vcg {
class Tetra class Tetra
{ {
public: public:
//Tatrahedron Functions to retrieve information about relation between faces of tetrahedron(faces,adges,vertices). //Tatrahedron Functions to retrieve information about relation between faces of tetrahedron(faces,adges,vertices).
static int VofE(const int &indexE, const int &indexV) static int VofE(const int &indexE, const int &indexV)
{ assert ((indexE<6)&&(indexV<2)); {
assert((indexE < 6) && (indexV < 2));
static int edgevert[6][2] = {{0, 1}, static int edgevert[6][2] = {{0, 1},
{0, 2}, {0, 2},
{0, 3}, {0, 3},
@ -154,7 +154,8 @@ public:
} }
static int VofF(const int &indexF, const int &indexV) static int VofF(const int &indexF, const int &indexV)
{ assert ((indexF<4)&&(indexV<3)); {
assert((indexF < 4) && (indexV < 3));
static int facevert[4][3] = {{0, 1, 2}, static int facevert[4][3] = {{0, 1, 2},
{0, 3, 1}, {0, 3, 1},
{0, 2, 3}, {0, 2, 3},
@ -173,12 +174,12 @@ public:
} }
static int EofF(const int &indexF, const int &indexE) static int EofF(const int &indexF, const int &indexE)
{ assert ((indexF<4)&&(indexE<3)); {
assert((indexF < 4) && (indexE < 3));
static int faceedge[4][3] = {{0, 3, 1}, static int faceedge[4][3] = {{0, 3, 1},
{2, 4, 0}, {2, 4, 0},
{1, 5, 2}, {1, 5, 2},
{4,5,3} {4, 5, 3}};
};
return faceedge[indexF][indexE]; return faceedge[indexF][indexE];
} }
@ -193,7 +194,8 @@ public:
} }
static int FofE(const int &indexE, const int &indexSide) static int FofE(const int &indexE, const int &indexSide)
{ assert ((indexE<6)&&(indexSide<2)); {
assert((indexE < 6) && (indexSide < 2));
static int edgeface[6][2] = {{0, 1}, static int edgeface[6][2] = {{0, 1},
{0, 2}, {0, 2},
{1, 2}, {1, 2},
@ -223,18 +225,25 @@ static int VofFFF(const int &indexF0,const int &indexF1,const int &indexF2)
assert((indexF2 < 4) && (indexF2 >= 0)); assert((indexF2 < 4) && (indexF2 >= 0));
static int facesvert[4][4][4] = { static int facesvert[4][4][4] = {
{//0 {//0
{-1,-1,-1,-1},{-1,-1,0,1},{-1,0,-1,2},{-1,1,2,-1} {-1, -1, -1, -1},
}, {-1, -1, 0, 1},
{-1, 0, -1, 2},
{-1, 1, 2, -1}},
{//1 {//1
{-1,-1,0,1},{-1,-1,-1,-1},{0,-1,-1,3},{1,-1,3,-1} {-1, -1, 0, 1},
}, {-1, -1, -1, -1},
{0, -1, -1, 3},
{1, -1, 3, -1}},
{//2 {//2
{-1,0,-1,2},{0,-1,-1,3},{-1,-1,-1,-1},{2,3,-1,-1} {-1, 0, -1, 2},
}, {0, -1, -1, 3},
{-1, -1, -1, -1},
{2, 3, -1, -1}},
{//3 {//3
{-1,1,2,-1},{1,-1,3,-1},{2,3,-1,-1},{-1,-1,-1,-1} {-1, 1, 2, -1},
} {1, -1, 3, -1},
}; {2, 3, -1, -1},
{-1, -1, -1, -1}}};
return facesvert[indexF0][indexF1][indexF2]; return facesvert[indexF0][indexF1][indexF2];
} }
@ -270,18 +279,25 @@ assert ((indexV2<4)&&(indexV2>=0));
static int verticesface[4][4][4] = { static int verticesface[4][4][4] = {
{//0 {//0
{-1,-1,-1,-1},{-1,-1,0,1},{-1,0,-1,2},{-1,1,2,-1} {-1, -1, -1, -1},
}, {-1, -1, 0, 1},
{-1, 0, -1, 2},
{-1, 1, 2, -1}},
{//1 {//1
{-1,-1,0,1},{-1,-1,-1,-1},{0,-1,-1,3},{1,-1,3,-1} {-1, -1, 0, 1},
}, {-1, -1, -1, -1},
{0, -1, -1, 3},
{1, -1, 3, -1}},
{//2 {//2
{-1,0,-1,2},{0,-1,-1,3},{-1,-1,-1,-1},{2,3,-1,-1} {-1, 0, -1, 2},
}, {0, -1, -1, 3},
{-1, -1, -1, -1},
{2, 3, -1, -1}},
{//3 {//3
{-1,1,2,-1},{1,-1,3,-1},{2,3,-1,-1},{-1,-1,-1,-1} {-1, 1, 2, -1},
} {1, -1, 3, -1},
}; {2, 3, -1, -1},
{-1, -1, -1, -1}}};
return verticesface[indexV0][indexV1][indexV2]; return verticesface[indexV0][indexV1][indexV2];
} }
@ -303,12 +319,13 @@ static int FofEE(const int &indexE0,const int &indexE1)
template <class TetraType> template <class TetraType>
static Point3<typename TetraType::ScalarType> Barycenter(const TetraType &t) static Point3<typename TetraType::ScalarType> Barycenter(const TetraType &t)
{ {
return ((t.cP(0)+t.cP(1)+t.cP(2)+t.cP(3))/(TetraType::ScalarType) 4.0); return ((t.cP(0) + t.cP(1) + t.cP(2) + t.cP(3)) / (typename TetraType::ScalarType)4.0);
} }
// compute and return the volume of a tetrahedron // compute and return the volume of a tetrahedron
template <class TetraType> template <class TetraType>
static typename TetraType::ScalarType ComputeVolume( const TetraType & t){ static typename TetraType::ScalarType ComputeVolume(const TetraType &t)
{
return (typename TetraType::ScalarType)(((t.cP(2) - t.cP(0)) ^ (t.cP(1) - t.cP(0))) * (t.cP(3) - t.cP(0)) / 6.0); return (typename TetraType::ScalarType)(((t.cP(2) - t.cP(0)) ^ (t.cP(1) - t.cP(0))) * (t.cP(3) - t.cP(0)) / 6.0);
} }
@ -340,15 +357,15 @@ static typename TetraType::ScalarType DihedralAngle (const TetraType & t, const
CoordType n1 = ((p2 - p0) ^ (p1 - p0)).normalized(); CoordType n1 = ((p2 - p0) ^ (p1 - p0)).normalized();
return M_PI - double(acos(n0 * n1)); return M_PI - double(acos(n0 * n1));
}; };
template <class TetraType> template <class TetraType>
static typename TetraType::ScalarType SolidAngle(const TetraType &t, const size_t vidx) static typename TetraType::ScalarType SolidAngle(const TetraType &t, const size_t vidx)
{ {
TetraType::ScalarType a0 = DihedralAngle(t, Tetra::EofV(vidx, 0)); typedef typename TetraType::ScalarType ScalarType;
TetraType::ScalarType a1 = DihedralAngle(t, Tetra::EofV(vidx, 1)); ScalarType a0 = DihedralAngle(t, Tetra::EofV(vidx, 0));
TetraType::ScalarType a2 = DihedralAngle(t, Tetra::EofV(vidx, 2)); ScalarType a1 = DihedralAngle(t, Tetra::EofV(vidx, 1));
ScalarType a2 = DihedralAngle(t, Tetra::EofV(vidx, 2));
return (a0 + a1 + a2) - M_PI; return (a0 + a1 + a2) - M_PI;
}; };
@ -356,10 +373,11 @@ static typename TetraType::ScalarType SolidAngle (const TetraType & t, const siz
template <class TetraType> template <class TetraType>
static typename TetraType::ScalarType AspectRatio(const TetraType &t) static typename TetraType::ScalarType AspectRatio(const TetraType &t)
{ {
TetraType::ScalarType a0 = SolidAngle(t, 0); typedef typename TetraType::ScalarType ScalarType;
TetraType::ScalarType a1 = SolidAngle(t, 1); ScalarType a0 = SolidAngle(t, 0);
TetraType::ScalarType a2 = SolidAngle(t, 2); ScalarType a1 = SolidAngle(t, 1);
TetraType::ScalarType a3 = SolidAngle(t, 3); ScalarType a2 = SolidAngle(t, 2);
ScalarType a3 = SolidAngle(t, 3);
return std::min(a0, std::min(a1, std::min(a2, a3))); return std::min(a0, std::min(a1, std::min(a2, a3)));
} }
@ -385,7 +403,6 @@ private:
CoordType _v[4]; CoordType _v[4];
public: public:
/// Shortcut per accedere ai punti delle facce /// Shortcut per accedere ai punti delle facce
inline CoordType &P(const int j) { return _v[j]; } inline CoordType &P(const int j) { return _v[j]; }
inline CoordType const &cP(const int j) const { return _v[j]; } inline CoordType const &cP(const int j) const { return _v[j]; }
@ -548,15 +565,11 @@ ScalarType ComputeAspectRatio()
b = Barycentric.V(1); b = Barycentric.V(1);
d = Barycentric.V(2); d = Barycentric.V(2);
c = 1 - (a + b + d); c = 1 - (a + b + d);
} }
}; //end Class }; //end Class
/*@}*/ /*@}*/
} // end namespace } // namespace vcg
#endif #endif