small updates
This commit is contained in:
parent
239dfce517
commit
25339718d9
|
@ -192,7 +192,7 @@ public:
|
||||||
if(!(*ti).IsD())
|
if(!(*ti).IsD())
|
||||||
for(int j = 0; j < 4; ++j)
|
for(int j = 0; j < 4; ++j)
|
||||||
{
|
{
|
||||||
if (tetrahedron::IsBorder(*fi,j)) (*ti).SetB(j);
|
if (tetrahedron::IsBorder(*ti,j)) (*ti).SetB(j);
|
||||||
else (*ti).ClearB(j);
|
else (*ti).ClearB(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,30 +44,6 @@ added
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
|
|
||||||
/*------------------------------------------------------------------*/
|
/*------------------------------------------------------------------*/
|
||||||
/*
|
|
||||||
The base class of all the recusive definition chain. It is just a container of the typenames of the various simplexes.
|
|
||||||
These typenames must be known form all the derived classes.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// template <class BVT, class BET, class BFT, class BTT>
|
|
||||||
// class TetraTypeHolder{
|
|
||||||
// public:
|
|
||||||
// typedef BVT VertexType;
|
|
||||||
// typedef typename VertexType::CoordType CoordType;
|
|
||||||
// typedef typename VertexType::ScalarType ScalarType;
|
|
||||||
// typedef BET EdgeType;
|
|
||||||
// typedef BFT FaceType;
|
|
||||||
// typedef BTT TetraType;
|
|
||||||
// typedef BVT *VertPointer;
|
|
||||||
// typedef BET *EdgePointer;
|
|
||||||
// typedef BFT *FacePointer;
|
|
||||||
// typedef BTT *TetraPointer;
|
|
||||||
// static void Name(std::vector<std::string> & name){}
|
|
||||||
|
|
||||||
|
|
||||||
// // prot
|
|
||||||
|
|
||||||
// };
|
|
||||||
|
|
||||||
// /* The base class form which we start to add our components.
|
// /* The base class form which we start to add our components.
|
||||||
// it has the empty definition for all the standard members (coords, color flags)
|
// it has the empty definition for all the standard members (coords, color flags)
|
||||||
|
@ -80,87 +56,14 @@ These typenames must be known form all the derived classes.
|
||||||
// we have to build the type a step a time (deriving from a single ancestor at a time).
|
// we have to build the type a step a time (deriving from a single ancestor at a time).
|
||||||
|
|
||||||
|
|
||||||
// */
|
|
||||||
// template <class BVT, class BET=DumET, class BFT=DumFT, class BTT=DumTT>
|
|
||||||
// class TetraBase: public tetra::EmptyCore<
|
|
||||||
// TetraTypeHolder <BVT, BET, BFT, BTT> > {
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// // Metaprogramming Core
|
|
||||||
|
|
||||||
// template <class BVT, class BET, class BFT,class BTT,
|
|
||||||
// template <typename> class A>
|
|
||||||
// class TetraArity1: public A<TetraBase<BVT,BET,BFT,BTT> > {};
|
|
||||||
|
|
||||||
// template <class BVT, class BET, typename BFT, class BTT,
|
|
||||||
// template <typename> class A, template <typename> class B>
|
|
||||||
// class TetraArity2: public B<TetraArity1<BVT,BET,BFT,BTT, A> > {};
|
|
||||||
|
|
||||||
// template <class BVT, class BET, typename BFT,class BTT,
|
|
||||||
// template <typename> class A, template <typename> class B,
|
|
||||||
// template <typename> class C >
|
|
||||||
// class TetraArity3: public C<TetraArity2<BVT,BET,BFT,BTT, A, B> > {};
|
|
||||||
|
|
||||||
// template <class BVT, class BET, typename BFT,class BTT,
|
|
||||||
// template <typename> class A, template <typename> class B,
|
|
||||||
// template <typename> class C, template <typename> class D>
|
|
||||||
// class TetraArity4: public D<TetraArity3<BVT,BET,BFT,BTT, A, B, C> > {};
|
|
||||||
|
|
||||||
// template <class BVT, class BET, typename BFT,class BTT,
|
|
||||||
// template <typename> class A, template <typename> class B,
|
|
||||||
// template <typename> class C, template <typename> class D,
|
|
||||||
// template <typename> class E >
|
|
||||||
// class TetraArity5: public E<TetraArity4<BVT,BET,BFT,BTT, A, B, C, D> > {};
|
|
||||||
|
|
||||||
// template <class BVT, class BET, typename BFT,class BTT,
|
|
||||||
// template <typename> class A, template <typename> class B,
|
|
||||||
// template <typename> class C, template <typename> class D,
|
|
||||||
// template <typename> class E, template <typename> class F >
|
|
||||||
// class TetraArity6: public F<TetraArity5<BVT,BET,BFT,BTT, A, B, C, D, E> > {};
|
|
||||||
|
|
||||||
// template <class BVT, class BET, typename BFT,class BTT,
|
|
||||||
// template <typename> class A, template <typename> class B,
|
|
||||||
// template <typename> class C, template <typename> class D,
|
|
||||||
// template <typename> class E, template <typename> class F,
|
|
||||||
// template <typename> class G >
|
|
||||||
// class TetraArity7: public G<TetraArity6<BVT,BET,BFT,BTT, A, B, C, D, E, F> > {};
|
|
||||||
|
|
||||||
// template <class BVT, class BET, typename BFT,class BTT,
|
|
||||||
// template <typename> class A, template <typename> class B,
|
|
||||||
// template <typename> class C, template <typename> class D,
|
|
||||||
// template <typename> class E, template <typename> class F,
|
|
||||||
// template <typename> class G, template <typename> class H >
|
|
||||||
// class TetraArity8: public H<TetraArity7<BVT,BET,BFT,BTT, A, B, C, D, E, F, G> > {};
|
|
||||||
|
|
||||||
// /* The Real Big Face class;
|
|
||||||
|
|
||||||
// The class __FaceArityMax__ is the one that is the Last to be derived,
|
|
||||||
// and therefore is the only one to know the real members
|
|
||||||
// (after the many overrides) so all the functions with common behaviour
|
|
||||||
// using the members defined in the various Empty/nonEmpty component classes
|
|
||||||
// MUST be defined here.
|
|
||||||
|
|
||||||
// I.e. IsD() that uses the overridden Flags() member must be defined here.
|
|
||||||
|
|
||||||
// */
|
|
||||||
|
|
||||||
// template <class BVT, class BET, typename BFT,class BTT,
|
|
||||||
// template <typename> class A, template <typename> class B,
|
|
||||||
// template <typename> class C, template <typename> class D,
|
|
||||||
// template <typename> class E, template <typename> class F,
|
|
||||||
// template <typename> class G, template <typename> class H,
|
|
||||||
// template <typename> class I >
|
|
||||||
// class TetraArityMax: public I<TetraArity8<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H> > {
|
|
||||||
|
|
||||||
|
|
||||||
template <class UserTypes>
|
template <class UserTypes>
|
||||||
class TetraTypeHolder: public UserTypes {
|
class TetraTypeHolder: public UserTypes {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
template <class LeftT>
|
template <class RightT>
|
||||||
void ImportData(const LeftT & ){}
|
void ImportData(const RightT & ){}
|
||||||
static void Name(std::vector<std::string> & /* name */){}
|
static void Name(std::vector<std::string> & /* name */){}
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,6 +112,7 @@ public:
|
||||||
BORDER1 = 0x00000080,
|
BORDER1 = 0x00000080,
|
||||||
BORDER2 = 0x00000100,
|
BORDER2 = 0x00000100,
|
||||||
BORDER3 = 0x00000200,
|
BORDER3 = 0x00000200,
|
||||||
|
BORDER0123 = BORDER0 | BORDER1 | BORDER2 | BORDER3,
|
||||||
// Crease _flags, it is assumed that FEATUREi = FEATURE0<<i
|
// Crease _flags, it is assumed that FEATUREi = FEATURE0<<i
|
||||||
// First user bit
|
// First user bit
|
||||||
USER0 = 0x00004000
|
USER0 = 0x00004000
|
||||||
|
@ -260,7 +164,7 @@ public:
|
||||||
void ClearV() {this->Flags() &= ~VISITED;}
|
void ClearV() {this->Flags() &= ~VISITED;}
|
||||||
|
|
||||||
/// This function checks if the face is selected
|
/// This function checks if the face is selected
|
||||||
bool IsB(int i) const {return (this->Flags() & (BORDER0<<i)) != 0;}
|
bool IsB(int i) const {return (this->cFlags() & (BORDER0<<i)) != 0;}
|
||||||
/// This function select the face
|
/// This function select the face
|
||||||
void SetB(int i) {this->Flags() |=(BORDER0<<i);}
|
void SetB(int i) {this->Flags() |=(BORDER0<<i);}
|
||||||
/// This funcion execute the inverse operation of SetS()
|
/// This funcion execute the inverse operation of SetS()
|
||||||
|
@ -345,30 +249,14 @@ TTAdj //topology: face face adj
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// template <class BVT, class BET, class BFT, class BTT,
|
|
||||||
// template <typename> class A = TetraDefaultDeriver, template <typename> class B = TetraDefaultDeriver,
|
|
||||||
// template <typename> class C = TetraDefaultDeriver, template <typename> class D = TetraDefaultDeriver,
|
|
||||||
// template <typename> class E = TetraDefaultDeriver, template <typename> class F = TetraDefaultDeriver,
|
|
||||||
// template <typename> class G = TetraDefaultDeriver, template <typename> class H = TetraDefaultDeriver,
|
|
||||||
// template <typename> class I = TetraDefaultDeriver >
|
|
||||||
// class TetraSimp3: public TetraArityMax<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H, I> {};
|
|
||||||
// class DumTT;
|
|
||||||
// template <class BVT, class BET, class BFT,
|
|
||||||
// template <typename> class A = TetraDefaultDeriver, template <typename> class B = TetraDefaultDeriver,
|
|
||||||
// template <typename> class C = TetraDefaultDeriver, template <typename> class D = TetraDefaultDeriver,
|
|
||||||
// template <typename> class E = TetraDefaultDeriver, template <typename> class F = TetraDefaultDeriver,
|
|
||||||
// template <typename> class G = TetraDefaultDeriver, template <typename> class H = TetraDefaultDeriver,
|
|
||||||
// template <typename> class I = TetraDefaultDeriver >
|
|
||||||
// class TetraSimp2: public TetraArityMax<BVT,BET,BFT,DumTT, A, B, C, D, E, F, G, H, I> {};
|
|
||||||
|
|
||||||
template <class UserTypes,
|
template <class UserTypes,
|
||||||
template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
|
template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
|
||||||
template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
|
template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
|
||||||
template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
|
template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
|
||||||
template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
|
template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
|
||||||
template <typename> class I = DefaultDeriver, template <typename> class J = DefaultDeriver,
|
template <typename> class I = DefaultDeriver, template <typename> class J = DefaultDeriver,
|
||||||
template <typename> class K = DefaultDeriver, template <typename> class L = DefaultDeriver>
|
template <typename> class K = DefaultDeriver, template <typename> class L = DefaultDeriver>
|
||||||
class TetraSimp: public TetraArityMax<UserTypes, A, B, C, D, E, F, G, H, I, J, K, L> {
|
class TetraSimp : public TetraArityMax<UserTypes, A, B, C, D, E, F, G, H, I, J, K, L> {
|
||||||
public: typedef AllTypes::ATetraType IAm; typedef UserTypes TypesPool;};
|
public: typedef AllTypes::ATetraType IAm; typedef UserTypes TypesPool;};
|
||||||
|
|
||||||
}// end namespace
|
}// end namespace
|
||||||
|
|
|
@ -37,100 +37,100 @@ added
|
||||||
#include <vcg/space/tetra3.h>
|
#include <vcg/space/tetra3.h>
|
||||||
|
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tetrahedron {
|
namespace tetrahedron {
|
||||||
/*
|
/*
|
||||||
Some naming Rules
|
Some naming Rules
|
||||||
All the Components that can be added to a tetra should be defined in the namespace tetra:
|
All the Components that can be added to a tetra should be defined in the namespace tetra:
|
||||||
*/
|
*/
|
||||||
template <class T> class EmptyCore : public T {
|
template <class T> class EmptyCore : public T {
|
||||||
public:
|
public:
|
||||||
//Empty vertexref
|
//Empty vertexref
|
||||||
inline typename T::VertexType * & V( const int j ) { assert(0); static typename T::VertexType *vp=0; return vp; }
|
inline typename T::VertexType * & V( const int j ) { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||||
inline typename T::VertexType * const & V( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
inline typename T::VertexType * const & V( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||||
inline typename T::VertexType * const cV( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
inline typename T::VertexType * const cV( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
|
||||||
inline typename T::CoordType & P( const int j ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
inline typename T::CoordType & P( const int j ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||||
inline const typename T::CoordType & P( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
inline const typename T::CoordType & P( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||||
inline const typename T::CoordType &cP( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
inline const typename T::CoordType &cP( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
|
||||||
|
|
||||||
static bool HasVertexRef() { return false; }
|
static bool HasVertexRef() { return false; }
|
||||||
static bool HasTVAdjacency() { return false; }
|
static bool HasTVAdjacency() { return false; }
|
||||||
|
|
||||||
// //Empty normals
|
// //Empty normals
|
||||||
// typedef typename T::VertexType::NormalType NormalType;
|
// typedef typename T::VertexType::NormalType NormalType;
|
||||||
// NormalType &N(const int & ){ static NormalType dummynormal(0, 0, 0); assert(0); return dummynormal; }
|
// NormalType &N(const int & ){ static NormalType dummynormal(0, 0, 0); assert(0); return dummynormal; }
|
||||||
// const NormalType cN(const int & ) const { static NormalType dummynormal(0, 0, 0); assert(0); return dummynormal; }
|
// const NormalType cN(const int & ) const { static NormalType dummynormal(0, 0, 0); assert(0); return dummynormal; }
|
||||||
|
|
||||||
// static bool HasFaceNormal() { return false; }
|
// static bool HasFaceNormal() { return false; }
|
||||||
// static bool HasFaceNormalOcc() { return false; }
|
// static bool HasFaceNormalOcc() { return false; }
|
||||||
|
|
||||||
//Empty color
|
//Empty color
|
||||||
typedef vcg::Color4b ColorType;
|
typedef vcg::Color4b ColorType;
|
||||||
ColorType &C() { static ColorType dummycolor(vcg::Color4b::White); assert(0); return dummycolor; }
|
ColorType &C() { static ColorType dummycolor(vcg::Color4b::White); assert(0); return dummycolor; }
|
||||||
ColorType cC() const { static ColorType dummycolor(vcg::Color4b::White); assert(0); return dummycolor; }
|
ColorType cC() const { static ColorType dummycolor(vcg::Color4b::White); assert(0); return dummycolor; }
|
||||||
|
|
||||||
static bool HasColor() { return false; }
|
static bool HasColor() { return false; }
|
||||||
static bool IsColorEnabled() { return T::TetraType::HasColor(); }
|
static bool IsColorEnabled() { return T::TetraType::HasColor(); }
|
||||||
|
|
||||||
//Empty Quality
|
//Empty Quality
|
||||||
typedef float QualityType;
|
typedef float QualityType;
|
||||||
typedef vcg::Point3f Quality3Type;
|
typedef vcg::Point3f Quality3Type;
|
||||||
QualityType &Q() { static QualityType dummyquality(0); assert(0); return dummyquality; }
|
QualityType &Q() { static QualityType dummyquality(0); assert(0); return dummyquality; }
|
||||||
QualityType cQ() const { static QualityType dummyquality(0); assert(0); return dummyquality; }
|
QualityType cQ() const { static QualityType dummyquality(0); assert(0); return dummyquality; }
|
||||||
Quality3Type &Q3() { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; }
|
Quality3Type &Q3() { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; }
|
||||||
Quality3Type cQ3() const { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; }
|
Quality3Type cQ3() const { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; }
|
||||||
|
|
||||||
static bool HasQuality() { return false; }
|
static bool HasQuality() { return false; }
|
||||||
static bool HasQuality3() { return false; }
|
static bool HasQuality3() { return false; }
|
||||||
inline bool IsQualityEnabled() const { return T::TetraType::HasQuality(); }
|
inline bool IsQualityEnabled() const { return T::TetraType::HasQuality(); }
|
||||||
inline bool IsQuality3Enabled() const { return T::TetraType::HasQuality3(); }
|
inline bool IsQuality3Enabled() const { return T::TetraType::HasQuality3(); }
|
||||||
|
|
||||||
//Empty flags
|
//Empty flags
|
||||||
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
|
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
|
||||||
int cFlags() const { return 0; }
|
int cFlags() const { return 0; }
|
||||||
|
|
||||||
static bool HasFlags() { return false; }
|
static bool HasFlags() { return false; }
|
||||||
static bool HasFlagsOcc() { return false; }
|
static bool HasFlagsOcc() { return false; }
|
||||||
|
|
||||||
//Empty IMark
|
//Empty IMark
|
||||||
typedef int MarkType;
|
typedef int MarkType;
|
||||||
|
|
||||||
inline void InitIMark() { }
|
inline void InitIMark() { }
|
||||||
inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
|
inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
|
||||||
inline int cIMark() const {return 0;}
|
inline int cIMark() const {return 0;}
|
||||||
|
|
||||||
static bool HasMark() { return false; }
|
static bool HasMark() { return false; }
|
||||||
static bool HasMarkOcc() { return false; }
|
static bool HasMarkOcc() { return false; }
|
||||||
|
|
||||||
//Empty Adjacency
|
//Empty Adjacency
|
||||||
typedef int VFAdjType;
|
typedef int VFAdjType;
|
||||||
typename T::TetraPointer & VTp ( const int ) { static typename T::TetraPointer tp=0; assert(0); return tp; }
|
typename T::TetraPointer & VTp ( const int ) { static typename T::TetraPointer tp=0; assert(0); return tp; }
|
||||||
typename T::TetraPointer const cVTp( const int ) const { static typename T::TetraPointer const tp=0; assert(0); return tp; }
|
typename T::TetraPointer const cVTp( const int ) const { static typename T::TetraPointer const tp=0; assert(0); return tp; }
|
||||||
|
|
||||||
typename T::TetraPointer & TTp ( const int ) { static typename T::TetraPointer tp=0; assert(0); return tp; }
|
typename T::TetraPointer & TTp ( const int ) { static typename T::TetraPointer tp=0; assert(0); return tp; }
|
||||||
typename T::TetraPointer const cTTp( const int ) const { static typename T::TetraPointer const tp=0; assert(0); return tp; }
|
typename T::TetraPointer const cTTp( const int ) const { static typename T::TetraPointer const tp=0; assert(0); return tp; }
|
||||||
|
|
||||||
char & VTi( const int j ) { static char z=0; assert(0); return z; }
|
char & VTi( const int j ) { static char z=0; assert(0); return z; }
|
||||||
char cVTi( const int j ) const { static char z=0; assert(0); return z; }
|
char cVTi( const int j ) const { static char z=0; assert(0); return z; }
|
||||||
char & TTi( const int j ) { static char z=0; assert(0); return z; }
|
char & TTi( const int j ) { static char z=0; assert(0); return z; }
|
||||||
char cTTi( const int j ) const { static char z=0; assert(0); return z; }
|
char cTTi( const int j ) const { static char z=0; assert(0); return z; }
|
||||||
|
|
||||||
bool IsVTInitialized(const int j) const {return static_cast<const typename T::TetraType *>(this)->cVTi(j)!=-1;}
|
bool IsVTInitialized(const int j) const {return static_cast<const typename T::TetraType *>(this)->cVTi(j)!=-1;}
|
||||||
void VTClear(int j) {
|
void VTClear(int j) {
|
||||||
if(IsVTInitialized(j)) {
|
if(IsVTInitialized(j)) {
|
||||||
static_cast<typename T::TetraPointer>(this)->VTp(j)=0;
|
static_cast<typename T::TetraPointer>(this)->VTp(j)=0;
|
||||||
static_cast<typename T::TetraPointer>(this)->VTi(j)=-1;
|
static_cast<typename T::TetraPointer>(this)->VTi(j)=-1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static bool HasVTAdjacency() { return false; }
|
static bool HasVTAdjacency() { return false; }
|
||||||
static bool HasTTAdjacency() { return false; }
|
static bool HasTTAdjacency() { return false; }
|
||||||
static bool HasTTAdjacencyOcc() { return false; }
|
static bool HasTTAdjacencyOcc() { return false; }
|
||||||
static bool HasVTAdjacencyOcc() { return false; }
|
static bool HasVTAdjacencyOcc() { return false; }
|
||||||
|
|
||||||
template <class RightValuteType>
|
template <class RightValuteType>
|
||||||
void ImportData(const RightValuteType & ) {}
|
void ImportData(const RightValuteType & ) {}
|
||||||
|
|
||||||
static void Name(std::vector<std::string> & name) { T::Name(name); }
|
static void Name(std::vector<std::string> & name) { T::Name(name); }
|
||||||
};
|
};
|
||||||
/*-------------------------- VERTEX ----------------------------------------*/
|
/*-------------------------- VERTEX ----------------------------------------*/
|
||||||
// template <class T> class EmptyVertexRef: public T {
|
// template <class T> class EmptyVertexRef: public T {
|
||||||
|
@ -149,13 +149,13 @@ public:
|
||||||
|
|
||||||
template <class T> class VertexRef: public T {
|
template <class T> class VertexRef: public T {
|
||||||
public:
|
public:
|
||||||
VertexRef(){
|
VertexRef(){
|
||||||
v[0]=0;
|
v[0]=0;
|
||||||
v[1]=0;
|
v[1]=0;
|
||||||
v[2]=0;
|
v[2]=0;
|
||||||
v[3]=0;
|
v[3]=0;
|
||||||
|
|
||||||
/******* vertex and faces indices scheme*********
|
/******* vertex and faces indices scheme*********
|
||||||
*
|
*
|
||||||
* /2\`
|
* /2\`
|
||||||
* / \ `
|
* / \ `
|
||||||
|
@ -166,67 +166,67 @@ public:
|
||||||
* /0___________1\'
|
* /0___________1\'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
findices[0][0] = 0; findices[0][1] = 1; findices[0][2] = 2;
|
findices[0][0] = 0; findices[0][1] = 1; findices[0][2] = 2;
|
||||||
findices[1][0] = 0; findices[1][1] = 3; findices[1][2] = 1;
|
findices[1][0] = 0; findices[1][1] = 3; findices[1][2] = 1;
|
||||||
findices[2][0] = 0; findices[2][1] = 2; findices[2][2] = 3;
|
findices[2][0] = 0; findices[2][1] = 2; findices[2][2] = 3;
|
||||||
findices[3][0] = 1; findices[3][1] = 3; findices[3][2] = 2;
|
findices[3][0] = 1; findices[3][1] = 3; findices[3][2] = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef typename T::VertexType::CoordType CoordType;
|
typedef typename T::VertexType::CoordType CoordType;
|
||||||
typedef typename T::VertexType::ScalarType ScalarType;
|
typedef typename T::VertexType::ScalarType ScalarType;
|
||||||
|
|
||||||
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 & V( const int j ) const { assert(j>=0 && j<4); return v[j]; }
|
inline typename T::VertexType * const & V( 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 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 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]; }
|
||||||
|
|
||||||
// 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 typename CoordType & P( const int j ) { assert(j>=0 && j<4); return v[j]->P(); }
|
||||||
inline const typename CoordType & P( const int j ) const { assert(j>=0 && j<4); return v[j]->cP(); }
|
inline const typename CoordType & P( const int j ) const { assert(j>=0 && j<4); return v[j]->cP(); }
|
||||||
inline const typename CoordType &cP( const int j ) const { assert(j>=0 && j<4); return v[j]->cP(); }
|
inline const typename CoordType &cP( const int j ) const { assert(j>=0 && j<4); return v[j]->cP(); }
|
||||||
|
|
||||||
/** 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.
|
||||||
*/
|
*/
|
||||||
inline typename T::VertexType * & V0( const int j ) { return V(j);}
|
inline typename T::VertexType * & V0( const int j ) { return V(j);}
|
||||||
inline typename T::VertexType * & V1( const int j ) { return V((j+1)%4);}
|
inline typename T::VertexType * & V1( const int j ) { return V((j+1)%4);}
|
||||||
inline typename T::VertexType * & V2( const int j ) { return V((j+2)%4);}
|
inline typename T::VertexType * & V2( const int j ) { return V((j+2)%4);}
|
||||||
inline typename T::VertexType * & V3( const int j ) { return V((j+3)%4);}
|
inline typename T::VertexType * & V3( const int j ) { return V((j+3)%4);}
|
||||||
inline const typename T::VertexType * const & V0( const int j ) const { return V(j);}
|
inline const typename T::VertexType * const & V0( const int j ) const { return V(j);}
|
||||||
inline const typename T::VertexType * const & V1( const int j ) const { return V((j+1)%4);}
|
inline const typename T::VertexType * const & V1( const int j ) const { return V((j+1)%4);}
|
||||||
inline const typename T::VertexType * const & V2( const int j ) const { return V((j+2)%4);}
|
inline const typename T::VertexType * const & V2( const int j ) const { return V((j+2)%4);}
|
||||||
inline const typename T::VertexType * const & V3( const int j ) const { return V((j+3)%4);}
|
inline const typename T::VertexType * const & V3( const int j ) const { return V((j+3)%4);}
|
||||||
inline const typename T::VertexType * const & cV0( const int j ) const { return cV(j);}
|
inline const typename T::VertexType * const & cV0( const int j ) const { return cV(j);}
|
||||||
inline const typename T::VertexType * const & cV1( const int j ) const { return cV((j+1)%4);}
|
inline const typename T::VertexType * const & cV1( const int j ) const { return cV((j+1)%4);}
|
||||||
inline const typename T::VertexType * const & cV2( const int j ) const { return cV((j+2)%4);}
|
inline const typename T::VertexType * const & cV2( const int j ) const { return cV((j+2)%4);}
|
||||||
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 typename CoordType &P0 (const int j) { return V(j)->P(); }
|
||||||
inline typename CoordType &P2 (const int j) { return V((j + 2) % 4)->P(); }
|
inline typename 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 typename 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 typename 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 typename 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 typename 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 typename 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 typename 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 typename 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 typename 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 typename 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 typename 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; }
|
||||||
|
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
|
||||||
|
|
||||||
template <class RightValueType>
|
template <class RightValueType>
|
||||||
void ImportData(const RightValueType & rTetra) { T::ImportData(rTetra); }
|
void ImportData(const RightValueType & rTetra) { T::ImportData(rTetra); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typename T::VertexType *v[4];
|
typename T::VertexType *v[4];
|
||||||
size_t findices[4][3];
|
size_t findices[4][3];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -285,45 +285,46 @@ public:
|
||||||
|
|
||||||
template <class T> class BitFlags: public T {
|
template <class T> class BitFlags: public T {
|
||||||
public:
|
public:
|
||||||
typedef int FlagType;
|
typedef int FlagType;
|
||||||
BitFlags(){_flags=0;}
|
BitFlags(){_flags=0;}
|
||||||
int &Flags() {return _flags; }
|
|
||||||
int cFlags() const {return _flags; }
|
|
||||||
|
|
||||||
template <class RightValueType>
|
inline int &Flags() {return _flags; }
|
||||||
void ImportData(const RightValueType & rightT){
|
inline int cFlags() const {return _flags; }
|
||||||
if(RightValueType::HasFlags())
|
|
||||||
Flags() = rightT.cFlags();
|
|
||||||
T::ImportData(rightT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool HasFlags() { return true; }
|
template <class RightValueType>
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
|
void ImportData(const RightValueType & rightT){
|
||||||
|
if(RightValueType::HasFlags())
|
||||||
|
Flags() = rightT.cFlags();
|
||||||
|
T::ImportData(rightT);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HasFlags() { return true; }
|
||||||
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _flags;
|
int _flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------- QUALITY ----------------------------------------*/
|
/*-------------------------- QUALITY ----------------------------------------*/
|
||||||
template <class A, class T> class Quality: public T {
|
template <class A, class T> class Quality: public T {
|
||||||
public:
|
public:
|
||||||
typedef A QualityType;
|
typedef A QualityType;
|
||||||
Quality():_quality(0) {}
|
Quality():_quality(0) {}
|
||||||
QualityType &Q() { return _quality; }
|
QualityType &Q() { return _quality; }
|
||||||
QualityType cQ() const { return _quality; }
|
QualityType cQ() const { return _quality; }
|
||||||
|
|
||||||
template <class RightValueType>
|
template <class RightValueType>
|
||||||
void ImportData(const RightValueType & rightT){
|
void ImportData(const RightValueType & rightT){
|
||||||
if(rightT.IsQualityEnabled())
|
if(rightT.IsQualityEnabled())
|
||||||
Q() = rightT.cQ();
|
Q() = rightT.cQ();
|
||||||
T::ImportData(rightT);
|
T::ImportData(rightT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HasQuality() { return true; }
|
static bool HasQuality() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));T::Name(name);}
|
||||||
private:
|
private:
|
||||||
QualityType _quality;
|
QualityType _quality;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T> class Qualityf: public Quality<float, T> {
|
template <class T> class Qualityf: public Quality<float, T> {
|
||||||
|
@ -336,19 +337,19 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::s
|
||||||
/*-------------------------- Quality3 ----------------------------------*/
|
/*-------------------------- Quality3 ----------------------------------*/
|
||||||
template <class A, class T> class Quality3: public T {
|
template <class A, class T> class Quality3: public T {
|
||||||
public:
|
public:
|
||||||
typedef vcg::Point3<A> Quality3Type;
|
typedef vcg::Point3<A> Quality3Type;
|
||||||
Quality3Type &Q3() { return _quality; }
|
Quality3Type &Q3() { return _quality; }
|
||||||
Quality3Type cQ3() const { return _quality; }
|
Quality3Type cQ3() const { return _quality; }
|
||||||
template <class RightValueType>
|
template <class RightValueType>
|
||||||
void ImportData(const RightValueType & rightT){
|
void ImportData(const RightValueType & rightT){
|
||||||
if(rightT.IsQuality3Enabled()) Q3() = rightT.cQ3();
|
if(rightT.IsQuality3Enabled()) Q3() = rightT.cQ3();
|
||||||
T::ImportData(rightT);
|
T::ImportData(rightT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HasQuality3() { return true; }
|
static bool HasQuality3() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality3"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality3"));T::Name(name);}
|
||||||
private:
|
private:
|
||||||
Quality3Type _quality;
|
Quality3Type _quality;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T> class Quality3f: public Quality3<float, T> {
|
template <class T> class Quality3f: public Quality3<float, T> {
|
||||||
|
@ -361,21 +362,21 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::s
|
||||||
/*-------------------------- COLOR ----------------------------------------*/
|
/*-------------------------- COLOR ----------------------------------------*/
|
||||||
template <class A, class T> class Color: public T {
|
template <class A, class T> class Color: public T {
|
||||||
public:
|
public:
|
||||||
typedef A ColorType;
|
typedef A ColorType;
|
||||||
Color():_color(vcg::Color4b::White) {}
|
Color():_color(vcg::Color4b::White) {}
|
||||||
ColorType &C() { return _color; }
|
ColorType &C() { return _color; }
|
||||||
ColorType cC() const { return _color; }
|
ColorType cC() const { return _color; }
|
||||||
template <class RightValueType>
|
template <class RightValueType>
|
||||||
void ImportData(const RightValueType & rightT){
|
void ImportData(const RightValueType & rightT){
|
||||||
if(rightT.IsColorEnabled()) C() = rightT.cC();
|
if(rightT.IsColorEnabled()) C() = rightT.cC();
|
||||||
T::ImportData(rightT);
|
T::ImportData(rightT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HasColor() { return true; }
|
static bool HasColor() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ColorType _color;
|
ColorType _color;
|
||||||
};
|
};
|
||||||
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/
|
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/
|
||||||
|
|
||||||
|
@ -393,22 +394,22 @@ private:
|
||||||
|
|
||||||
template <class T> class Mark: public T {
|
template <class T> class Mark: public T {
|
||||||
public:
|
public:
|
||||||
static bool HasMark() { return true; }
|
static bool HasMark() { return true; }
|
||||||
static bool HasMarkOcc() { return false; }
|
static bool HasMarkOcc() { return false; }
|
||||||
inline void InitIMark() { _imark = 0; }
|
inline void InitIMark() { _imark = 0; }
|
||||||
inline int & IMark() { return _imark;}
|
inline int & IMark() { return _imark;}
|
||||||
inline int cIMark() const {return _imark;}
|
inline int cIMark() const {return _imark;}
|
||||||
|
|
||||||
template <class RightValueType>
|
template <class RightValueType>
|
||||||
void ImportData(const RightValueType & rightT){
|
void ImportData(const RightValueType & rightT){
|
||||||
if(rightT.IsMarkEnabled()) IMark() = rightT.cIMark();
|
if(rightT.IsMarkEnabled()) IMark() = rightT.cIMark();
|
||||||
T::ImportData(rightT);
|
T::ImportData(rightT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _imark;
|
int _imark;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -432,73 +433,73 @@ public:
|
||||||
|
|
||||||
template <class T> class VTAdj: public T {
|
template <class T> class VTAdj: public T {
|
||||||
public:
|
public:
|
||||||
VTAdj() {
|
VTAdj() {
|
||||||
_vtp[0]=0;
|
_vtp[0]=0;
|
||||||
_vtp[1]=0;
|
_vtp[1]=0;
|
||||||
_vtp[2]=0;
|
_vtp[2]=0;
|
||||||
_vtp[3]=0;
|
_vtp[3]=0;
|
||||||
_vti[0]=-1;
|
_vti[0]=-1;
|
||||||
_vti[1]=-1;
|
_vti[1]=-1;
|
||||||
_vti[2]=-1;
|
_vti[2]=-1;
|
||||||
_vti[3]=-1;
|
_vti[3]=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
typename T::TetraPointer & VTp( const int j ) { assert( j >= 0 && j < 4 ); return _vtp[j]; }
|
typename T::TetraPointer & VTp( const int j ) { assert( j >= 0 && j < 4 ); return _vtp[j]; }
|
||||||
typename T::TetraPointer const VTp( const int j ) const { assert( j >= 0 && j < 4 ); return _vtp[j]; }
|
typename T::TetraPointer const VTp( const int j ) const { assert( j >= 0 && j < 4 ); return _vtp[j]; }
|
||||||
typename T::TetraPointer const cVTp( const int j ) const { assert( j >= 0 && j < 4 ); return _vtp[j]; }
|
typename T::TetraPointer const cVTp( const int j ) const { assert( j >= 0 && j < 4 ); return _vtp[j]; }
|
||||||
|
|
||||||
char & VTi( const int j ) { return _vti[j]; }
|
char & VTi( const int j ) { return _vti[j]; }
|
||||||
const char & cVTi( const int j ) const { return _vti[j]; }
|
const char & cVTi( const int j ) const { return _vti[j]; }
|
||||||
|
|
||||||
static bool HasVTAdjacency() { return true; }
|
static bool HasVTAdjacency() { return true; }
|
||||||
static bool HasVTAdjacencyOcc() { return false; }
|
static bool HasVTAdjacencyOcc() { return false; }
|
||||||
|
|
||||||
static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); }
|
static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); }
|
||||||
|
|
||||||
template <class RightValueType>
|
template <class RightValueType>
|
||||||
void ImportData(const RightValueType & rightT){T::ImportData(rightT);}
|
void ImportData(const RightValueType & rightT){T::ImportData(rightT);}
|
||||||
private:
|
private:
|
||||||
typename T::TetraPointer _vtp[4];
|
typename T::TetraPointer _vtp[4];
|
||||||
char _vti[4];
|
char _vti[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*----------------------------- TTADJ ------------------------------*/
|
/*----------------------------- TTADJ ------------------------------*/
|
||||||
|
|
||||||
template <class T> class TTAdj: public T {
|
template <class T> class TTAdj: public T {
|
||||||
public:
|
public:
|
||||||
TTAdj(){
|
TTAdj(){
|
||||||
_ttp[0]=0;
|
_ttp[0]=0;
|
||||||
_ttp[1]=0;
|
_ttp[1]=0;
|
||||||
_ttp[2]=0;
|
_ttp[2]=0;
|
||||||
_ttp[3]=0;
|
_ttp[3]=0;
|
||||||
}
|
}
|
||||||
typename T::TetraPointer &TTp(const int j) { assert(j>=0 && j<4); return _ttp[j]; }
|
typename T::TetraPointer &TTp(const int j) { assert(j>=0 && j<4); return _ttp[j]; }
|
||||||
typename T::TetraPointer const TTp(const int j) const { assert(j>=0 && j<4); return _ttp[j]; }
|
typename T::TetraPointer const TTp(const int j) const { assert(j>=0 && j<4); return _ttp[j]; }
|
||||||
typename T::TetraPointer const cTTp(const int j) const { assert(j>=0 && j<4); return _ttp[j]; }
|
typename T::TetraPointer const cTTp(const int j) const { assert(j>=0 && j<4); return _ttp[j]; }
|
||||||
char &TTi(const int j) { return _tti[j]; }
|
char &TTi(const int j) { return _tti[j]; }
|
||||||
const char &cTTi(const int j) const { return _tti[j]; }
|
const char &cTTi(const int j) const { return _tti[j]; }
|
||||||
|
|
||||||
typename T::TetraPointer &TTp1( const int j ) { return TTp((j+1)%4);}
|
typename T::TetraPointer &TTp1( const int j ) { return TTp((j+1)%4);}
|
||||||
typename T::TetraPointer &TTp2( const int j ) { return TTp((j+2)%4);}
|
typename T::TetraPointer &TTp2( const int j ) { return TTp((j+2)%4);}
|
||||||
typename T::TetraPointer &TTp3( const int j ) { return TTp((j+3)%4);}
|
typename T::TetraPointer &TTp3( const int j ) { return TTp((j+3)%4);}
|
||||||
typename T::TetraPointer const TTp1( const int j ) const { return TTp((j+1)%4);}
|
typename T::TetraPointer const TTp1( const int j ) const { return TTp((j+1)%4);}
|
||||||
typename T::TetraPointer const TTp2( const int j ) const { return TTp((j+2)%4);}
|
typename T::TetraPointer const TTp2( const int j ) const { return TTp((j+2)%4);}
|
||||||
typename T::TetraPointer const TTp3( const int j ) const { return TTp((j+3)%4);}
|
typename T::TetraPointer const TTp3( const int j ) const { return TTp((j+3)%4);}
|
||||||
|
|
||||||
bool IsBorderF(const int & i) const { assert( (i>=0) && (i < 4)); { return TTp(i) == this;}}
|
bool IsBorderF(const int & i) const { assert( (i>=0) && (i < 4)); { return TTp(i) == this;}}
|
||||||
|
|
||||||
static bool HasTTAdjacency() { return true; }
|
static bool HasTTAdjacency() { return true; }
|
||||||
static bool HasTTAdjacencyOcc() { return false; }
|
static bool HasTTAdjacencyOcc() { return false; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("TTAdj"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("TTAdj"));T::Name(name);}
|
||||||
|
|
||||||
template <class RightValueType>
|
template <class RightValueType>
|
||||||
void ImportData(const RightValueType & rightT){T::ImportData(rightT);}
|
void ImportData(const RightValueType & rightT){T::ImportData(rightT);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typename T::TetraPointer _ttp[4] ;
|
typename T::TetraPointer _ttp[4] ;
|
||||||
char _tti[4] ;
|
char _tti[4] ;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace vert
|
} // end namespace vert
|
||||||
}// end namespace vcg
|
}// end namespace vcg
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,6 +42,52 @@ inline bool IsBorder(TetraType const & t, const int j )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class TetraMesh, class TriMesh>
|
||||||
|
inline void TriMeshFromBorder(TetraMesh & tetramesh, TriMesh & trimesh)
|
||||||
|
{
|
||||||
|
RequireTTAdjacency(tetramesh);
|
||||||
|
tri::UpdateTopology<TetraMesh>::TetraTetra(tetramesh);
|
||||||
|
|
||||||
|
trimesh.Clear();
|
||||||
|
|
||||||
|
std::vector<TriMesh::VertexPointer> verts;
|
||||||
|
std::vector<TriMesh::FacePointer> faces;
|
||||||
|
|
||||||
|
ForEachTetra(tetramesh, [&] (TetraMesh::TetraType & t) {
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
if (IsBorder(t, i))
|
||||||
|
{
|
||||||
|
verts.push_back(t.V(Tetra::VofF(i, 0)));
|
||||||
|
verts.push_back(t.V(Tetra::VofF(i, 1)));
|
||||||
|
verts.push_back(t.V(Tetra::VofF(i, 2)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
TriMesh::VertexIterator vi = tri::Allocator<TriMesh>::AddVertices(trimesh, verts.size());
|
||||||
|
TriMesh::FaceIterator fi = tri::Allocator<TriMesh>::AddFaces(trimesh, verts.size() / 3);
|
||||||
|
|
||||||
|
for (int i = 0; i < verts.size(); i += 3)
|
||||||
|
{
|
||||||
|
fi->Alloc(3);
|
||||||
|
|
||||||
|
vi->P() = verts[i + 0]->P();
|
||||||
|
fi->V(0) = &*vi;
|
||||||
|
++vi;
|
||||||
|
|
||||||
|
vi->P() = verts[i + 1]->P();
|
||||||
|
fi->V(1) = &*vi;
|
||||||
|
++vi;
|
||||||
|
|
||||||
|
vi->P() = verts[i + 2]->P();
|
||||||
|
fi->V(2) = &*vi;
|
||||||
|
++vi;
|
||||||
|
|
||||||
|
++fi;
|
||||||
|
}
|
||||||
|
|
||||||
|
tri::Clean<TriMesh>::RemoveDuplicateVertex(trimesh);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue