passed parameters by reference in many funcs and gcc cleaning

This commit is contained in:
Paolo Cignoni 2004-11-23 10:34:45 +00:00
parent 1d72b1f687
commit da6bf044f0
3 changed files with 26 additions and 14 deletions

View File

@ -22,6 +22,9 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.13 2004/10/25 16:28:32 ganovelli
pos to edge
Revision 1.12 2004/09/15 11:16:02 ganovelli Revision 1.12 2004/09/15 11:16:02 ganovelli
changed P() to cP() changed P() to cP()
@ -63,7 +66,8 @@ class TriEdgeCollapse: public LocalOptimization<TriMeshType>::LocModType , publi
{ {
public: public:
/// static data to gather statistical information about the reasons of collapse failures /// static data to gather statistical information about the reasons of collapse failures
struct FailStat { class FailStat {
public:
static int &Volume() {static int vol=0; return vol;} static int &Volume() {static int vol=0; return vol;}
static int &LinkConditionFace(){static int lkf=0; return lkf;} static int &LinkConditionFace(){static int lkf=0; return lkf;}
static int &LinkConditionEdge(){static int lke=0; return lke;} static int &LinkConditionEdge(){static int lke=0; return lke;}
@ -107,7 +111,7 @@ TriMeshType *mt;
inline TriEdgeCollapse() inline TriEdgeCollapse()
{} {}
///Constructor with postype ///Constructor with postype
inline TriEdgeCollapse(EdgeType p, int mark) inline TriEdgeCollapse(const EdgeType &p, int mark)
{ {
localMark = mark; localMark = mark;
pos=p; pos=p;
@ -149,18 +153,21 @@ public:
{ {
#ifdef __SAVE__LOG__ #ifdef __SAVE__LOG__
static FILE * co = fopen("col.txt","w"); static FILE * co = fopen("col.txt","w");
#endif __SAVE__LOG__ #endif //SAVE__LOG__
GlobalMark()++;int nn=0; GlobalMark()++;int nn=0;
VertexType *v[2]; VertexType *v[2];
v[0]= pos.V(0);v[1]=pos.V(1); v[0]= pos.V(0);v[1]=pos.V(1);
v[1]->IMark() = GlobalMark(); v[1]->IMark() = GlobalMark();
vcg::face::VFIterator<FaceType> vfi(v[1]->VFp(),v[1]->VFi()); // First loop around the remaining vertex to unmark visited flags
vcg::face::VFIterator<FaceType> vfi(v[1]->VFp(),v[1]->VFi());
while (!vfi.End()){ while (!vfi.End()){
vfi.F()->V1(vfi.I())->ClearV(); vfi.F()->V1(vfi.I())->ClearV();
vfi.F()->V2(vfi.I())->ClearV(); vfi.F()->V2(vfi.I())->ClearV();
++vfi; ++vfi;
} }
// Second Loop
vfi.F() = v[1]->VFp(); vfi.F() = v[1]->VFp();
vfi.I() = v[1]->VFi(); vfi.I() = v[1]->VFi();
while (!vfi.End()) while (!vfi.End())
@ -173,7 +180,7 @@ static FILE * co = fopen("col.txt","w");
#ifdef __SAVE__LOG__ #ifdef __SAVE__LOG__
fprintf(co,"%i %i \n",vfi.F()->V(vfi.I())-&*mt->vert.begin(), fprintf(co,"%i %i \n",vfi.F()->V(vfi.I())-&*mt->vert.begin(),
vfi.F()->V1(vfi.I())-&*mt->vert.begin()); vfi.F()->V1(vfi.I())-&*mt->vert.begin());
#endif __SAVE__LOG__ #endif //SAVE__LOG__
vfi.F()->V1(vfi.I())->SetV(); vfi.F()->V1(vfi.I())->SetV();
h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.F()->V(vfi.I()),vfi.F()->V1(vfi.I())),GlobalMark()))); h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.F()->V(vfi.I()),vfi.F()->V1(vfi.I())),GlobalMark())));
@ -188,7 +195,7 @@ static FILE * co = fopen("col.txt","w");
#ifdef __SAVE__LOG__ #ifdef __SAVE__LOG__
fprintf(co,"%i %i \n",vfi.F()->V(vfi.I())-&*mt->vert.begin(), fprintf(co,"%i %i \n",vfi.F()->V(vfi.I())-&*mt->vert.begin(),
vfi.F()->V2(vfi.I())-&*mt->vert.begin()); vfi.F()->V2(vfi.I())-&*mt->vert.begin());
#endif __SAVE__LOG__ #endif //SAVE__LOG__
vfi.F()->V2(vfi.I())->SetV(); vfi.F()->V2(vfi.I())->SetV();
h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.F()->V(vfi.I()),vfi.F()->V2(vfi.I())),GlobalMark()))); h_ret.push_back(HeapElem(new MYTYPE(EdgeType (vfi.F()->V(vfi.I()),vfi.F()->V2(vfi.I())),GlobalMark())));

View File

@ -24,6 +24,10 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.3 2004/10/25 07:07:56 ganovelli
A vcg.::Pos was used to implement the collapse type. CHanged
to vcg::Edge
Revision 1.2 2004/09/29 17:08:16 ganovelli Revision 1.2 2004/09/29 17:08:16 ganovelli
corrected error in -error (see localoptimization) corrected error in -error (see localoptimization)
@ -128,7 +132,7 @@ public:
// puntatori ai vertici che sono stati messi non-w per preservare il boundary // puntatori ai vertici che sono stati messi non-w per preservare il boundary
static std::vector<typename TriMeshType::VertexPointer> & WV(){static std::vector<typename TriMeshType::VertexPointer> _WV; return _WV;}; static std::vector<typename TriMeshType::VertexPointer> & WV(){static std::vector<typename TriMeshType::VertexPointer> _WV; return _WV;};
inline TriEdgeCollapseQuadric(EdgeType p, int i) inline TriEdgeCollapseQuadric(const EdgeType &p, int i)
//:TEC(p,i){} //:TEC(p,i){}
{ {
localMark = i; localMark = i;
@ -138,11 +142,10 @@ public:
inline bool IsFeasible(){ inline bool IsFeasible(){
bool res = (!Params().PreserveTopology || LinkConditions(pos) ); bool res = ( !Params().PreserveTopology || LinkConditions(pos) );
if(!res) if(!res) ++( TriEdgeCollapse< TriMeshType,MYTYPE>::FailStat::LinkConditionEdge() );
++FailStat::LinkConditionEdge(); return res;
return res; }
}
void Execute(TriMeshType &m) void Execute(TriMeshType &m)
{ {

View File

@ -22,6 +22,8 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
History History
$Log: not supported by cvs2svn $
****************************************************************************/ ****************************************************************************/
#ifndef __VCG_TETRA_TRI_COLLAPSE #ifndef __VCG_TETRA_TRI_COLLAPSE
@ -109,7 +111,7 @@ class EdgeCollapse
static VFIVec & AV01(){static VFIVec av01; return av01;} static VFIVec & AV01(){static VFIVec av01; return av01;}
void FindSets(EdgeType p) void FindSets(EdgeType &p)
{ {
VertexType * v0 = p.V(0); VertexType * v0 = p.V(0);
VertexType * v1 = p.V(1); VertexType * v1 = p.V(1);
@ -202,7 +204,7 @@ class EdgeCollapse
int DoCollapse(EdgeType & c, Point3<ScalarType> p) int DoCollapse(EdgeType & c, const Point3<ScalarType> &p)
{ {
FindSets(c); FindSets(c);
typename VFIVec::iterator i; typename VFIVec::iterator i;