Added a RequirePerVertexMark to the init function of the collapse framework.
This commit is contained in:
parent
7b31a05a99
commit
f2d3ff160c
|
@ -49,12 +49,12 @@ public:
|
|||
/// static data to gather statistical information about the reasons of collapse failures
|
||||
class FailStat {
|
||||
public:
|
||||
static int &Volume() {static int vol=0; return vol;}
|
||||
static int &LinkConditionFace(){static int lkf=0; return lkf;}
|
||||
static int &LinkConditionEdge(){static int lke=0; return lke;}
|
||||
static int &LinkConditionVert(){static int lkv=0; return lkv;}
|
||||
static int &OutOfDate() {static int ofd=0; return ofd;}
|
||||
static int &Border() {static int bor=0; return bor;}
|
||||
static int &Volume() {static int vol=0; return vol;}
|
||||
static int &LinkConditionFace(){static int lkf=0; return lkf;}
|
||||
static int &LinkConditionEdge(){static int lke=0; return lke;}
|
||||
static int &LinkConditionVert(){static int lkv=0; return lkv;}
|
||||
static int &OutOfDate() {static int ofd=0; return ofd;}
|
||||
static int &Border() {static int bor=0; return bor;}
|
||||
static void Init()
|
||||
{
|
||||
Volume() =0;
|
||||
|
@ -72,35 +72,35 @@ protected:
|
|||
typedef typename FaceType::VertexType::CoordType CoordType;
|
||||
typedef typename TriMeshType::VertexType::ScalarType ScalarType;
|
||||
typedef typename LocalOptimization<TriMeshType>::HeapElem HeapElem;
|
||||
typedef typename LocalOptimization<TriMeshType>::HeapType HeapType;
|
||||
typedef typename LocalOptimization<TriMeshType>::HeapType HeapType;
|
||||
|
||||
TriMeshType *mt;
|
||||
///the pair to collapse
|
||||
///the pair to collapse
|
||||
VertexPair pos;
|
||||
|
||||
///mark for up_dating
|
||||
static int& GlobalMark(){ static int im=0; return im;}
|
||||
///mark for up_dating
|
||||
static int& GlobalMark(){ static int im=0; return im;}
|
||||
|
||||
///mark for up_dating
|
||||
int localMark;
|
||||
///mark for up_dating
|
||||
int localMark;
|
||||
|
||||
/// priority in the heap
|
||||
ScalarType _priority;
|
||||
/// priority in the heap
|
||||
ScalarType _priority;
|
||||
|
||||
public:
|
||||
/// Default Constructor
|
||||
inline TriEdgeCollapse()
|
||||
{}
|
||||
///Constructor with postype
|
||||
public:
|
||||
/// Default Constructor
|
||||
inline TriEdgeCollapse()
|
||||
{}
|
||||
///Constructor with postype
|
||||
inline TriEdgeCollapse(const VertexPair &p, int mark, BaseParameterClass *pp)
|
||||
{
|
||||
localMark = mark;
|
||||
pos=p;
|
||||
{
|
||||
localMark = mark;
|
||||
pos=p;
|
||||
_priority = ComputePriority(pp);
|
||||
}
|
||||
}
|
||||
|
||||
~TriEdgeCollapse()
|
||||
{}
|
||||
~TriEdgeCollapse()
|
||||
{}
|
||||
|
||||
private:
|
||||
|
||||
|
@ -109,12 +109,12 @@ public:
|
|||
|
||||
inline ScalarType ComputePriority(BaseParameterClass *)
|
||||
{
|
||||
_priority = Distance(pos.V(0)->cP(),pos.V(1)->cP());
|
||||
_priority = Distance(pos.V(0)->cP(),pos.V(1)->cP());
|
||||
return _priority;
|
||||
}
|
||||
|
||||
virtual const char *Info(TriMeshType &m) {
|
||||
mt = &m;
|
||||
mt = &m;
|
||||
static char buf[60];
|
||||
sprintf(buf,"%i -> %i %g\n", int(pos.V(0)-&m.vert[0]), int(pos.V(1)-&m.vert[0]),-_priority);
|
||||
return buf;
|
||||
|
@ -190,28 +190,29 @@ public:
|
|||
|
||||
inline bool IsFeasible(BaseParameterClass *){
|
||||
return EdgeCollapser<TriMeshType,VertexPair>::LinkConditions(pos);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool IsUpToDate() const
|
||||
{
|
||||
VertexType *v0=pos.cV(0);
|
||||
VertexType *v1=pos.cV(1);
|
||||
if( v0->IsD() || v1->IsD() ||
|
||||
localMark < v0->IMark() ||
|
||||
localMark < v1->IMark() )
|
||||
{
|
||||
++FailStat::OutOfDate();
|
||||
return false;
|
||||
if( v0->IsD() || v1->IsD() ||
|
||||
localMark < v0->IMark() ||
|
||||
localMark < v1->IMark() )
|
||||
{
|
||||
++FailStat::OutOfDate();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ScalarType Priority() const {
|
||||
return _priority;
|
||||
virtual ScalarType Priority() const {
|
||||
return _priority;
|
||||
}
|
||||
|
||||
static void Init(TriMeshType &m, HeapType &h_ret, BaseParameterClass *pp)
|
||||
{
|
||||
vcg::tri::RequirePerVertexMark(m);
|
||||
vcg::tri::UpdateTopology<TriMeshType>::VertexFace(m);
|
||||
h_ret.clear();
|
||||
typename TriMeshType::FaceIterator fi;
|
||||
|
@ -225,7 +226,7 @@ public:
|
|||
//printf("Inserting in heap coll %3i ->%3i %f\n",p.V()-&m.vert[0],p.VFlip()-&m.vert[0],h_ret.back().locModPtr->Priority());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
}//end namespace tri
|
||||
|
|
Loading…
Reference in New Issue