Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit c7005e0b authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

algos with Traversor + correct genericmap destructor

parent 7b39d3ef
......@@ -45,13 +45,9 @@ float computeHaussdorf(typename PFP::MAP& map, const typename PFP::TVEC3& origin
float dist_o = 0.0f ;
float dist_f = 0.0f ;
CellMarker mv(map, VERTEX) ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
TraversorV<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
if(select(d) && !mv.isMarked(d))
{
mv.mark(d);
const VEC3& posO = originalPosition[d] ;
const VEC3& posF = position2[d] ;
......@@ -59,10 +55,10 @@ float computeHaussdorf(typename PFP::MAP& map, const typename PFP::TVEC3& origin
float dv_f = std::numeric_limits<float>::max();
// just test the faces around the vertex => warning not real haussdorff distance!
Dart dd = d ;
do
Traversor2VF<typename PFP::MAP> tf(map, d) ;
for(Dart it = tf.begin(); it != tf.end(); it = tf.next())
{
Dart e = map.phi1(dd) ;
Dart e = map.phi1(it) ;
const VEC3& Bo = originalPosition[e] ;
const VEC3& Bf = position2[e] ;
e = map.phi1(e) ;
......@@ -75,16 +71,13 @@ float computeHaussdorf(typename PFP::MAP& map, const typename PFP::TVEC3& origin
d = Geom::squaredDistancePoint2Triangle(posF, posO, Bo, Co) ;
if(d < dv_f)
dv_f = d ;
dd = map.phi2(e) ;
} while(dd != d) ;
}
if(dv_o > dist_o)
dist_o = dv_o ;
if(dv_f > dist_f)
dist_f = dv_f ;
}
}
if (dist_f > dist_o)
return sqrtf(dist_f) ;
......@@ -100,13 +93,9 @@ void computeNoise(typename PFP::MAP& map, long amount, const typename PFP::TVEC3
srand(time(NULL)) ;
// apply noise on each vertex
CellMarker mv(map, VERTEX) ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
TraversorV<typename PFP::MAP> t(map, select) ;
for(Dart d = t.begin(); d != t.end(); d = t.next())
{
if(select(d) && !mv.isMarked(d))
{
mv.mark(d);
const VEC3& pos = position[d] ;
VEC3 norm = normal[d] ;
......@@ -120,27 +109,24 @@ void computeNoise(typename PFP::MAP& map, long amount, const typename PFP::TVEC3
float avEL = 0.0f ;
VEC3 td(0) ;
Dart dd = d ;
long nbE = 0 ;
do // turn around vertex and get each neighbor vertex
Traversor2VVaE<typename PFP::MAP> tav(map, d) ;
for(Dart it = tav.begin(); it != tav.end(); it = tav.next())
{
Dart e = map.phi2(dd) ;
const VEC3& p = position[e] ;
const VEC3& p = position[it] ;
VEC3 vec = p - pos ;
float el = vec.norm() ;
vec *= r2 ;
td += vec ;
avEL += el ;
nbE++ ;
dd = map.phi1(e) ;
} while (dd != d) ;
}
avEL /= float(nbE) ;
norm *= avEL * r1 ;
norm += td ;
position2[d] = pos + norm ;
}
}
}
} //namespace Filtering
......
......@@ -115,8 +115,6 @@ typename PFP::REAL computeCotanWeightEdge(
{
if(map.isBoundaryEdge(d))
{
Dart e = map.getEdgeInteriorDart(d) ;
const typename PFP::VEC3& p1 = position[d] ;
const typename PFP::VEC3& p2 = position[map.phi1(d)] ;
const typename PFP::VEC3& p3 = position[map.phi_1(d)] ;
......
......@@ -339,10 +339,10 @@ public:
*/
Dart findBoundaryVertex(Dart d);
/**
* if the edge of d is on the boundary, return the non-boundaryMarked dart of this edge
*/
bool getEdgeInteriorDart(Dart d) ;
// /**
// * if the edge of d is on the boundary, return the non-boundaryMarked dart of this edge
// */
// bool getEdgeInteriorDart(Dart d) ;
// TODO a mettre en algo
/**
......
......@@ -95,6 +95,11 @@ GenericMap::~GenericMap()
if(isOrbitEmbedded(i))
m_attribs[i].clear(true) ;
}
for(std::multimap<AttributeMultiVectorGen*, AttributeHandlerGen*>::iterator it = attributeHandlers.begin(); it != attributeHandlers.end(); ++it)
(*it).second->setInvalid() ;
attributeHandlers.clear() ;
if(m_attributes_registry_map)
{
delete m_attributes_registry_map;
......@@ -129,7 +134,6 @@ void GenericMap::clear(bool removeAttrib)
m_attribs[i].clear(false) ;
}
}
}
/****************************************
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment