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