modifications to compile with gcc
This commit is contained in:
parent
0fc829e2b8
commit
f73fa19346
|
@ -27,7 +27,11 @@
|
||||||
#ifndef __VCG_DECIMATION_COLLAPSE
|
#ifndef __VCG_DECIMATION_COLLAPSE
|
||||||
#define __VCG_DECIMATION_COLLAPSE
|
#define __VCG_DECIMATION_COLLAPSE
|
||||||
|
|
||||||
#include<vcg\complex\local_optimization.h>
|
#include<vcg/complex/local_optimization.h>
|
||||||
|
#include<vcg/simplex/tetrahedron/pos.h>
|
||||||
|
#include<vcg/complex/tetramesh/edge_collapse.h>
|
||||||
|
#include<vcg/space/point3.h>
|
||||||
|
|
||||||
|
|
||||||
struct FAIL{
|
struct FAIL{
|
||||||
static int VOL(){static int vol=0; return vol++;}
|
static int VOL(){static int vol=0; return vol++;}
|
||||||
|
@ -74,7 +78,7 @@ class TetraEdgeCollapse: public LocalOptimization<TETRA_MESH_TYPE>::LocModType
|
||||||
private:
|
private:
|
||||||
|
|
||||||
///the new point that substitute the edge
|
///the new point that substitute the edge
|
||||||
Point<3,ScalarType> _NewPoint;
|
Point3<ScalarType> _NewPoint;
|
||||||
///the pointer to edge collapser method
|
///the pointer to edge collapser method
|
||||||
vcg::tetra::EdgeCollapse<TETRA_MESH_TYPE> _EC;
|
vcg::tetra::EdgeCollapse<TETRA_MESH_TYPE> _EC;
|
||||||
///mark for up_dating
|
///mark for up_dating
|
||||||
|
@ -154,7 +158,7 @@ ScalarType _VolumePreservingError(PosType &pos,CoordType &new_point,int nsteps)
|
||||||
for (int i=0;i<nsteps;i++)
|
for (int i=0;i<nsteps;i++)
|
||||||
{
|
{
|
||||||
best_error=1000000.f;
|
best_error=1000000.f;
|
||||||
ScalarType alfatemp=step*((double)i);
|
ScalarType alfatemp=step*((ScalarType)i);
|
||||||
//CoordType g;
|
//CoordType g;
|
||||||
// g.Zero();
|
// g.Zero();
|
||||||
//g+=ve0->cP()*alfatemp;
|
//g+=ve0->cP()*alfatemp;
|
||||||
|
@ -238,7 +242,7 @@ public:
|
||||||
|
|
||||||
bool IsUpToDate(){
|
bool IsUpToDate(){
|
||||||
if (!pos.T()->IsD())
|
if (!pos.T()->IsD())
|
||||||
{
|
{
|
||||||
VertexType *v0=pos.T()->V(Tetra::VofE(pos.E(),0));
|
VertexType *v0=pos.T()->V(Tetra::VofE(pos.E(),0));
|
||||||
VertexType *v1=pos.T()->V(Tetra::VofE(pos.E(),1));
|
VertexType *v1=pos.T()->V(Tetra::VofE(pos.E(),1));
|
||||||
assert(!v0->IsD());
|
assert(!v0->IsD());
|
||||||
|
@ -247,13 +251,13 @@ public:
|
||||||
_Imark()>=v0->IMark() &&
|
_Imark()>=v0->IMark() &&
|
||||||
_Imark()>=v1->IMark()))
|
_Imark()>=v1->IMark()))
|
||||||
{
|
{
|
||||||
FAIL::OFD();
|
FAIL::OFD();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +269,6 @@ public:
|
||||||
static void Init(TETRA_MESH_TYPE &m,typename LocalOptimization<TETRA_MESH_TYPE>::HeapType& h_ret){
|
static void Init(TETRA_MESH_TYPE &m,typename LocalOptimization<TETRA_MESH_TYPE>::HeapType& h_ret){
|
||||||
h_ret.clear();
|
h_ret.clear();
|
||||||
typename TETRA_MESH_TYPE::TetraIterator ti;
|
typename TETRA_MESH_TYPE::TetraIterator ti;
|
||||||
int j;
|
|
||||||
for(ti = m.tetra.begin(); ti != m.tetra.end();++ti)
|
for(ti = m.tetra.begin(); ti != m.tetra.end();++ti)
|
||||||
if(!(*ti).IsD()){
|
if(!(*ti).IsD()){
|
||||||
(*ti).ComputeVolume();
|
(*ti).ComputeVolume();
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.11 2005/01/12 11:06:54 ganovelli
|
||||||
|
added InitVertexIMark
|
||||||
|
|
||||||
Revision 1.10 2004/10/11 17:44:07 ganovelli
|
Revision 1.10 2004/10/11 17:44:07 ganovelli
|
||||||
added include of color4
|
added include of color4
|
||||||
|
|
||||||
|
@ -179,7 +182,7 @@ class Tetramesh{
|
||||||
|
|
||||||
inline int MemUsed() const
|
inline int MemUsed() const
|
||||||
{
|
{
|
||||||
return sizeof(TMTYPE)+sizeof(VertexType)*vert.size()+sizeof(tetrahedron)*tetra.size()+sizeof(edge)*edges.size();
|
return sizeof(Tetramesh)+sizeof(VertexType)*vert.size()+sizeof(TetraType)*tetra.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear(){
|
void Clear(){
|
||||||
|
|
|
@ -271,7 +271,7 @@ static int _Collapse(PosType p,CoordType NewP)
|
||||||
}
|
}
|
||||||
|
|
||||||
//delting old tetrahedrons
|
//delting old tetrahedrons
|
||||||
vector<TetraType*>::iterator ti;
|
typename vector<TetraType*>::iterator ti;
|
||||||
for (ti=To_Del.begin();ti<To_Del.end();ti++)
|
for (ti=To_Del.begin();ti<To_Del.end();ti++)
|
||||||
(*ti)->SetD();
|
(*ti)->SetD();
|
||||||
|
|
||||||
|
@ -322,7 +322,7 @@ static bool isMarkedE(Edge E,char M)
|
||||||
EI=_EdgeMark().find(E);
|
EI=_EdgeMark().find(E);
|
||||||
if (EI==_EdgeMark().end())
|
if (EI==_EdgeMark().end())
|
||||||
return false;
|
return false;
|
||||||
else return ((*EI).second & M);
|
else return (((*EI).second & M)!=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void orMarkF(Face F,char M)
|
static void orMarkF(Face F,char M)
|
||||||
|
@ -341,7 +341,7 @@ static bool isMarkedF(Face F,char M)
|
||||||
FI=_FaceMark().find(F);
|
FI=_FaceMark().find(F);
|
||||||
if (FI==_FaceMark().end())
|
if (FI==_FaceMark().end())
|
||||||
return false;
|
return false;
|
||||||
else return ((*FI).second & M);
|
else return (((*FI).second & M)!=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -354,8 +354,8 @@ static bool _LinkConditionsF(PosType pos)
|
||||||
_EdgeMark().clear();
|
_EdgeMark().clear();
|
||||||
|
|
||||||
// Mark edges of ve0
|
// Mark edges of ve0
|
||||||
vector< TetraType *>::iterator ti=_Sets().v0.begin();
|
typename vector< TetraType *>::iterator ti=_Sets().v0.begin();
|
||||||
vector< char >::iterator en=_Sets().indexv0.begin();
|
typename vector< char >::iterator en=_Sets().indexv0.begin();
|
||||||
VertexType *v0=(*ti)->V(*en);
|
VertexType *v0=(*ti)->V(*en);
|
||||||
while (ti!=_Sets().v0.end())
|
while (ti!=_Sets().v0.end())
|
||||||
{
|
{
|
||||||
|
@ -444,8 +444,8 @@ static bool _LinkConditionsE(PosType pos)
|
||||||
_FaceMark().clear();
|
_FaceMark().clear();
|
||||||
|
|
||||||
// Mark edges of ve0
|
// Mark edges of ve0
|
||||||
vector< TetraType *>::iterator ti=_Sets().v0.begin();
|
typename vector< TetraType *>::iterator ti=_Sets().v0.begin();
|
||||||
vector< char >::iterator en=_Sets().indexv0.begin();
|
typename vector< char >::iterator en=_Sets().indexv0.begin();
|
||||||
while (ti!=_Sets().v0.end())
|
while (ti!=_Sets().v0.end())
|
||||||
{
|
{
|
||||||
//put dummy edge
|
//put dummy edge
|
||||||
|
@ -541,8 +541,8 @@ static bool _QuickConditions(PosType pos)
|
||||||
else /// look if the 2 other faces that don't share the vertex are external on not
|
else /// look if the 2 other faces that don't share the vertex are external on not
|
||||||
{
|
{
|
||||||
|
|
||||||
vector< TetraType *>::iterator ti=_Sets().E.begin();
|
typename vector< TetraType *>::iterator ti=_Sets().E.begin();
|
||||||
vector< char >::iterator en=_Sets().indexE.begin();
|
typename vector< char >::iterator en=_Sets().indexE.begin();
|
||||||
//mark them as intersection
|
//mark them as intersection
|
||||||
while (ti!=_Sets().E.end())
|
while (ti!=_Sets().E.end())
|
||||||
{
|
{
|
||||||
|
@ -586,7 +586,7 @@ static bool _LinkConditionsV()
|
||||||
VertexType *vt3;
|
VertexType *vt3;
|
||||||
|
|
||||||
|
|
||||||
vector< TetraType *>::iterator ti=_Sets().v0_U_v1.begin();
|
typename vector< TetraType *>::iterator ti=_Sets().v0_U_v1.begin();
|
||||||
|
|
||||||
//reset all link flags
|
//reset all link flags
|
||||||
while (ti!=_Sets().v0_U_v1.end())
|
while (ti!=_Sets().v0_U_v1.end())
|
||||||
|
@ -598,7 +598,7 @@ static bool _LinkConditionsV()
|
||||||
|
|
||||||
|
|
||||||
//also in the ones that appartain to the edge
|
//also in the ones that appartain to the edge
|
||||||
vector< char >::iterator en;
|
typename vector< char >::iterator en;
|
||||||
ti=_Sets().E.begin();
|
ti=_Sets().E.begin();
|
||||||
en=_Sets().indexE.begin();
|
en=_Sets().indexE.begin();
|
||||||
//reset all link flags for intersection and in the same
|
//reset all link flags for intersection and in the same
|
||||||
|
@ -705,7 +705,7 @@ static bool _FlipCondition(PosType pos,CoordType NewP)
|
||||||
CoordType oldpos0;
|
CoordType oldpos0;
|
||||||
CoordType oldpos1;
|
CoordType oldpos1;
|
||||||
|
|
||||||
vector< TetraType *>::iterator ti=_Sets().no_E.begin();
|
typename vector< TetraType *>::iterator ti=_Sets().no_E.begin();
|
||||||
|
|
||||||
//saving old position
|
//saving old position
|
||||||
oldpos0 = ve0->P();
|
oldpos0 = ve0->P();
|
||||||
|
@ -765,7 +765,7 @@ static void _InitTetrahedronValues(VertexType* v)
|
||||||
{
|
{
|
||||||
if (VTi.Vt()->V(i)->IsB())
|
if (VTi.Vt()->V(i)->IsB())
|
||||||
{
|
{
|
||||||
if (VertexType::HasNormal)
|
if (VertexType::HasNormal())
|
||||||
UpdateNormals::PerVertex(VTi.Vt()->V(i));
|
UpdateNormals::PerVertex(VTi.Vt()->V(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ static bool CheckPreconditions(PosType pos,CoordType NewP)
|
||||||
///return the sum of volumes of the union of stars on vertices (the original volume of tetrahedrons)
|
///return the sum of volumes of the union of stars on vertices (the original volume of tetrahedrons)
|
||||||
static ScalarType VolumeOriginal()
|
static ScalarType VolumeOriginal()
|
||||||
{
|
{
|
||||||
vector< TetraType *>::iterator ti=_Sets().v0_U_v1.begin();
|
typename vector< TetraType *>::iterator ti=_Sets().v0_U_v1.begin();
|
||||||
ScalarType vol=0;
|
ScalarType vol=0;
|
||||||
while (ti!=_Sets().v0_U_v1.end())
|
while (ti!=_Sets().v0_U_v1.end())
|
||||||
{
|
{
|
||||||
|
@ -867,7 +867,7 @@ static ScalarType VolumeSimulateCollapse(PosType Pos,CoordType &newP)
|
||||||
//move vertex that remain in the new position
|
//move vertex that remain in the new position
|
||||||
Vrem->P() = newP;
|
Vrem->P() = newP;
|
||||||
|
|
||||||
vector< TetraType *>::iterator ti=_Sets().no_E.begin();
|
typename vector< TetraType *>::iterator ti=_Sets().no_E.begin();
|
||||||
|
|
||||||
while (ti!=_Sets().no_E.end())
|
while (ti!=_Sets().no_E.end())
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.8 2004/10/28 00:54:34 cignoni
|
||||||
|
Better Doxygen documentation
|
||||||
|
|
||||||
Revision 1.7 2004/09/01 12:17:25 pietroni
|
Revision 1.7 2004/09/01 12:17:25 pietroni
|
||||||
minor changes to comply gcc compiler (typename's )
|
minor changes to comply gcc compiler (typename's )
|
||||||
|
|
||||||
|
@ -106,7 +109,6 @@ static void PerVertex(VertexType *v)
|
||||||
while (!VTi.End())
|
while (!VTi.End())
|
||||||
{
|
{
|
||||||
//take the tree faces on the vertex's tetrahedron
|
//take the tree faces on the vertex's tetrahedron
|
||||||
int f;
|
|
||||||
for (int j=0;j<3;j++)
|
for (int j=0;j<3;j++)
|
||||||
{
|
{
|
||||||
int f=Tetra::FofV(VTi.Vi(),j);
|
int f=Tetra::FofV(VTi.Vi(),j);
|
||||||
|
@ -118,7 +120,7 @@ static void PerVertex(VertexType *v)
|
||||||
}
|
}
|
||||||
++VTi;
|
++VTi;
|
||||||
}
|
}
|
||||||
Norm/=iter;
|
Norm/=(float)iter;
|
||||||
v->N()=Norm.Normalize();
|
v->N()=Norm.Normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -455,7 +455,7 @@ static void TestExternalVertex(VertexContainer &vert,TetraContainer &tetra)
|
||||||
|
|
||||||
typedef pair <VertexType*, bool> VertBoolPair;
|
typedef pair <VertexType*, bool> VertBoolPair;
|
||||||
map<VertexType*, bool> Inserted;
|
map<VertexType*, bool> Inserted;
|
||||||
map<VertexType*, bool>:: const_iterator MapIte;
|
typename map<VertexType*, bool>::iterator MapIte;
|
||||||
|
|
||||||
for (ti=tetra.begin();ti<tetra.end();ti++)
|
for (ti=tetra.begin();ti<tetra.end();ti++)
|
||||||
{
|
{
|
||||||
|
@ -657,8 +657,8 @@ static bool IsExternEdge(TetraType *t,int edge)
|
||||||
//now look if one face is no shared from other tetrahedron
|
//now look if one face is no shared from other tetrahedron
|
||||||
//2 instances of same face in vector means it is internal face
|
//2 instances of same face in vector means it is internal face
|
||||||
bool isExtern=false;
|
bool isExtern=false;
|
||||||
std::vector < _triV >::iterator TVIo;
|
typename std::vector < _triV >::iterator TVIo;
|
||||||
std::vector < _triV >::iterator TVIn;
|
typename std::vector < _triV >::iterator TVIn;
|
||||||
TVIo=Faces.begin();
|
TVIo=Faces.begin();
|
||||||
TVIn=Faces.begin();
|
TVIn=Faces.begin();
|
||||||
TVIn++;
|
TVIn++;
|
||||||
|
|
|
@ -31,6 +31,7 @@ Initial commit
|
||||||
#ifndef __VCG_TETRA_TRI_CONVERTER
|
#ifndef __VCG_TETRA_TRI_CONVERTER
|
||||||
#define __VCG_TETRA_TRI_CONVERTER
|
#define __VCG_TETRA_TRI_CONVERTER
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
#include<vcg/space/tetra3.h>
|
#include<vcg/space/tetra3.h>
|
||||||
namespace vcg {
|
namespace vcg {
|
||||||
namespace tetra {
|
namespace tetra {
|
||||||
|
@ -150,7 +151,7 @@ struct InsertedV{
|
||||||
void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim)
|
void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim)
|
||||||
{
|
{
|
||||||
vector<InsertedV > newVertices;
|
vector<InsertedV > newVertices;
|
||||||
|
typename vector<InsertedV>::iterator curr,next;
|
||||||
TriVertexIterator vi;
|
TriVertexIterator vi;
|
||||||
vector<TriVertexType*> redirect;
|
vector<TriVertexType*> redirect;
|
||||||
|
|
||||||
|
@ -166,7 +167,7 @@ void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim)
|
||||||
|
|
||||||
sort(newVertices.begin(),newVertices.end());
|
sort(newVertices.begin(),newVertices.end());
|
||||||
|
|
||||||
vector<InsertedV>::iterator curr,next;
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
curr = next = newVertices.begin();
|
curr = next = newVertices.begin();
|
||||||
while( next != newVertices.end()){
|
while( next != newVertices.end()){
|
||||||
|
@ -177,7 +178,7 @@ void ConvertCopy(TetraContainer &tetra,TriangleMeshType &trim)
|
||||||
next++;
|
next++;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<InsertedV>::iterator newE = unique(newVertices.begin(),newVertices.end());
|
typename vector<InsertedV>::iterator newE = unique(newVertices.begin(),newVertices.end());
|
||||||
for(curr = newVertices.begin();curr!= newE;++curr)
|
for(curr = newVertices.begin();curr!= newE;++curr)
|
||||||
trim.vert.push_back(*((*curr).v));
|
trim.vert.push_back(*((*curr).v));
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.13 2004/10/04 17:07:58 pietroni
|
||||||
|
changed Q() function
|
||||||
|
|
||||||
Revision 1.12 2004/09/01 12:18:39 pietroni
|
Revision 1.12 2004/09/01 12:18:39 pietroni
|
||||||
minor changes to comply gcc compiler (typename's )
|
minor changes to comply gcc compiler (typename's )
|
||||||
|
|
||||||
|
@ -67,7 +70,7 @@ Revision 1.1 2004/04/15 08:54:20 pietroni
|
||||||
#ifndef TETRA_TYPE
|
#ifndef TETRA_TYPE
|
||||||
#pragma message("\nYou should never directly include this file\_n")
|
#pragma message("\nYou should never directly include this file\_n")
|
||||||
#else
|
#else
|
||||||
#define NULL 0
|
|
||||||
#include<vcg/space/point3.h>
|
#include<vcg/space/point3.h>
|
||||||
#include<vcg/space/tetra3.h>
|
#include<vcg/space/tetra3.h>
|
||||||
|
|
||||||
|
@ -316,7 +319,7 @@ public:
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<4;i++)
|
for (i=0;i<4;i++)
|
||||||
if (T(i)==this)
|
if (TTp(i)==this)
|
||||||
{
|
{
|
||||||
V(Tetra::VofF(i,0))->SetB();
|
V(Tetra::VofF(i,0))->SetB();
|
||||||
V(Tetra::VofF(i,1))->SetB();
|
V(Tetra::VofF(i,1))->SetB();
|
||||||
|
@ -518,4 +521,4 @@ static bool HasVTAdjacency() {
|
||||||
};//end class
|
};//end class
|
||||||
|
|
||||||
}//end namespace
|
}//end namespace
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -212,9 +212,9 @@ public:
|
||||||
{
|
{
|
||||||
|
|
||||||
//take the absolute index of the tree edges of the faces
|
//take the absolute index of the tree edges of the faces
|
||||||
char e0=vcg::Tetra::EofF(fa,0);
|
char e0=vcg::Tetra::EofF(_f ,0);
|
||||||
char e1=vcg::Tetra::EofF(fa,1);
|
char e1=vcg::Tetra::EofF(_f ,1);
|
||||||
char e2=vcg::Tetra::EofF(fa,2);
|
char e2=vcg::Tetra::EofF(_f ,2);
|
||||||
//eliminate the same as himself
|
//eliminate the same as himself
|
||||||
if (e0==E())
|
if (e0==E())
|
||||||
{
|
{
|
||||||
|
@ -369,20 +369,21 @@ private:
|
||||||
MTTYPE *_t_initial;
|
MTTYPE *_t_initial;
|
||||||
short int _back;
|
short int _back;
|
||||||
public :
|
public :
|
||||||
|
typedef MTTYPE TetraType;
|
||||||
PosJump(const TetraType* tp,const int fap,const int ep,
|
PosJump(const TetraType* tp,const int fap,const int ep,
|
||||||
int vp){T()=tp;F()=fap;E()=ep;V()=vp;_t_initial=tp;_back=0;}
|
int vp){this->T()=tp;this->F()=fap;this->E()=ep;this->V()=vp;_t_initial=tp;_back=0;}
|
||||||
|
|
||||||
void NextT()
|
void NextT()
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
int cont=0;
|
int cont=0;
|
||||||
#endif
|
#endif
|
||||||
MTTYPE *tpred=T();
|
MTTYPE *tpred=this->T();
|
||||||
Pos<MTTYPE>::NextT();
|
Pos<MTTYPE>::NextT();
|
||||||
//external face
|
//external face
|
||||||
if (tpred==T())
|
if (tpred==this->T())
|
||||||
{
|
{
|
||||||
while (T()!=_t_initial)
|
while (this->T()!=_t_initial)
|
||||||
{
|
{
|
||||||
Pos<MTTYPE>::NextT();
|
Pos<MTTYPE>::NextT();
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -408,9 +409,9 @@ private:
|
||||||
bool _jump;
|
bool _jump;
|
||||||
bool _loop;
|
bool _loop;
|
||||||
public :
|
public :
|
||||||
|
typedef MTTYPE TetraType;
|
||||||
PosLoop(TetraType* tp,const int fap,const int ep,
|
PosLoop(TetraType* tp,const int fap,const int ep,
|
||||||
int vp){T()=tp;F()=fap;E()=ep;V()=vp;_t_initial=tp;_jump=false;_loop=false;}
|
int vp){this->T()=tp;this->F()=fap;this->E()=ep;this->V()=vp;_t_initial=tp;_jump=false;_loop=false;}
|
||||||
|
|
||||||
bool LoopEnd()
|
bool LoopEnd()
|
||||||
{
|
{
|
||||||
|
@ -431,34 +432,34 @@ PosLoop(TetraType* tp,const int fap,const int ep,
|
||||||
void NextT()
|
void NextT()
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
TetraType *t_old=T();
|
TetraType *t_old=this->T();
|
||||||
#endif
|
#endif
|
||||||
TetraType *tpred=T();
|
TetraType *tpred=this->T();
|
||||||
Pos<TetraType>::NextT();
|
Pos<TetraType>::NextT();
|
||||||
_loop=false;
|
_loop=false;
|
||||||
_jump=false;
|
_jump=false;
|
||||||
|
|
||||||
//external face
|
//external face
|
||||||
if (tpred==T())
|
if (tpred==this->T())
|
||||||
{
|
{
|
||||||
tpred=T();
|
tpred=this->T();
|
||||||
//jump next one
|
//jump next one
|
||||||
Pos<TetraType>::NextT();
|
Pos<TetraType>::NextT();
|
||||||
//find the next external face
|
//find the next external face
|
||||||
while (tpred!=T())
|
while (tpred!=this->T())
|
||||||
{
|
{
|
||||||
tpred=T();
|
tpred=this->T();
|
||||||
Pos<TetraType>::NextT();
|
Pos<TetraType>::NextT();
|
||||||
}
|
}
|
||||||
////reset right rotation sense
|
////reset right rotation sense
|
||||||
// Pos<TetraType>::NextT();
|
// Pos<TetraType>::NextT();
|
||||||
_jump=true;
|
_jump=true;
|
||||||
}
|
}
|
||||||
if (T()==_t_initial)
|
if (this->T()==_t_initial)
|
||||||
_loop=true;
|
_loop=true;
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
if (_loop==false)
|
if (_loop==false)
|
||||||
assert(t_old!=T());
|
assert(t_old!=this->T());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,4 +468,4 @@ PosLoop(TetraType* tp,const int fap,const int ep,
|
||||||
}//end namespace tetra
|
}//end namespace tetra
|
||||||
}//end namespace vcg
|
}//end namespace vcg
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
||||||
|
Revision 1.10 2005/11/29 16:20:33 pietroni
|
||||||
|
added IsInside() function
|
||||||
|
|
||||||
Revision 1.9 2004/10/13 12:45:51 cignoni
|
Revision 1.9 2004/10/13 12:45:51 cignoni
|
||||||
Better Doxygen documentation
|
Better Doxygen documentation
|
||||||
|
|
||||||
|
@ -360,14 +363,14 @@ ScalarType ComputeAspectRatio()
|
||||||
double a1=SolidAngle(1);
|
double a1=SolidAngle(1);
|
||||||
double a2=SolidAngle(2);
|
double a2=SolidAngle(2);
|
||||||
double a3=SolidAngle(3);
|
double a3=SolidAngle(3);
|
||||||
return (min(a0,min(a1,min(a2,a3))));
|
return (ScalarType)math::Min(a0,math::Min(a1,math::Min(a2,a3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
///return true of p is inside tetrahedron's volume
|
///return true of p is inside tetrahedron's volume
|
||||||
bool IsInside(const CoordType &p)
|
bool IsInside(const CoordType &p)
|
||||||
{
|
{
|
||||||
//bb control
|
//bb control
|
||||||
vcg::Box3<CoordType::ScalarType> bb;
|
vcg::Box3<typename CoordType::ScalarType> bb;
|
||||||
for (int i=0;i<4;i++)
|
for (int i=0;i<4;i++)
|
||||||
bb.Add(_v[i]);
|
bb.Add(_v[i]);
|
||||||
|
|
||||||
|
@ -440,7 +443,7 @@ ScalarType ComputeAspectRatio()
|
||||||
// compute and return the volume of a tetrahedron
|
// compute and return the volume of a tetrahedron
|
||||||
template<class TetraType>
|
template<class TetraType>
|
||||||
typename TetraType::ScalarType ComputeVolume( const TetraType & t){
|
typename TetraType::ScalarType ComputeVolume( const TetraType & t){
|
||||||
return (( 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the normal to the face face of the tetrahedron t
|
/// Returns the normal to the face face of the tetrahedron t
|
||||||
|
|
Loading…
Reference in New Issue