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 d33a3a60 authored by untereiner's avatar untereiner
Browse files

Merge cgogn:~kraemer/CGoGN

parents c02f8c6d 8d0fb6f4
...@@ -80,10 +80,10 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts) ...@@ -80,10 +80,10 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
FunctorSetEmb<typename PFP::MAP> fsetemb(map, VERTEX, em); FunctorSetEmb<typename PFP::MAP> fsetemb(map, VERTEX, em);
foreach_dart_of_orbit_in_parent<typename PFP::MAP>(&map, VERTEX, d, fsetemb) ; foreach_dart_of_orbit_in_parent<typename PFP::MAP>(&map, VERTEX, d, fsetemb) ;
m.mark(d) ; // mark on the fly to unmark on second loop
vecDartsPerVertex[em].push_back(d); // store incident darts for fast adjacency reconstruction vecDartsPerVertex[em].push_back(d); // store incident darts for fast adjacency reconstruction
d = map.phi1(d); d = map.phi1(d);
} }
m.markOrbit(ORIENTED_FACE, d); // mark on the fly to unmark on second loop
} }
} }
...@@ -106,11 +106,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts) ...@@ -106,11 +106,8 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
if (good_dart != NIL) if (good_dart != NIL)
{ {
if (good_dart == map.phi2(good_dart)) map.sewFaces(d, good_dart, false);
{ m.unmarkOrbit(EDGE, d);
map.sewFaces(d, good_dart, false);
m.unmarkOrbit(EDGE, d);
}
} }
else else
{ {
......
...@@ -140,6 +140,7 @@ void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSele ...@@ -140,6 +140,7 @@ void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSele
Dart e = map.cutEdge(d); Dart e = map.cutEdge(d);
// TODO trouver pourquoi lerp bug avec ECell // TODO trouver pourquoi lerp bug avec ECell
// attributs[m] = AttribOps::lerp<EMB,PFP>(attributs[d],attributs[f], 0.5); // attributs[m] = AttribOps::lerp<EMB,PFP>(attributs[d],attributs[f], 0.5);
attributs[e] = attributs[d]; attributs[e] = attributs[d];
attributs[e] += attributs[f]; attributs[e] += attributs[f];
attributs[e] *= 0.5; attributs[e] *= 0.5;
...@@ -194,17 +195,17 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func ...@@ -194,17 +195,17 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func
m0.mark(d); m0.mark(d);
l_verts.push_back(d); l_verts.push_back(d);
} }
if (!m0.isMarked(map.phi2(d))) Dart d2 = map.phi2(d);
if (!m0.isMarked(d2))
{ {
m0.mark(map.phi2(d)); m0.mark(d2);
l_verts.push_back(map.phi2(d)); l_verts.push_back(d2);
} }
Dart f = map.phi1(d); Dart f = map.phi1(d);
map.cutEdge(d); Dart e = map.cutEdge(d);
Dart e = map.phi1(d) ;
attributs[e] = attributs[d]; attributs[e] = attributs[d];
attributs[e] += attributs[f]; attributs[e] += attributs[f];
attributs[e] *= 0.5; attributs[e] *= 0.5;
...@@ -226,15 +227,16 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func ...@@ -226,15 +227,16 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func
// compute center skip darts of new vertices non embedded // compute center skip darts of new vertices non embedded
EMB center = AttribOps::zero<EMB,PFP>(); EMB center = AttribOps::zero<EMB,PFP>();
unsigned int count = 0 ; unsigned int count = 0 ;
mf.unmarkOrbit(FACE, d) ;
Dart it = d; Dart it = d;
do do
{ {
mf.unmark(it);
me.unmark(it);
me.unmark(map.phi1(it));
center += attributs[it]; center += attributs[it];
++count ; ++count ;
it = map.template phi<11>(it) ; me.unmarkOrbitInParent<typename PFP::MAP>(EDGE, it);
it = map.phi1(it) ;
me.unmarkOrbitInParent<typename PFP::MAP>(EDGE, it);
it = map.phi1(it) ;
} while(it != d) ; } while(it != d) ;
center /= double(count); center /= double(count);
Dart cf = quadranguleFace<PFP>(map, d); // quadrangule the face Dart cf = quadranguleFace<PFP>(map, d); // quadrangule the face
...@@ -247,13 +249,12 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func ...@@ -247,13 +249,12 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func
{ {
Dart x = *mid; Dart x = *mid;
// other side of the edge // other side of the edge
Dart y = map.phi2(x); if (!map.isBoundaryEdge(x))
if (y != x)
{ {
Dart f1 = map.phi_1(x); Dart f1 = map.phi_1(x);
Dart f2 = map.phi2(map.phi1(y)); Dart f2 = map.phi2(map.phi1(map.phi2(x)));
EMB temp = AttribOps::zero<EMB,PFP>(); EMB temp = AttribOps::zero<EMB,PFP>();
temp = attributs[f1]; temp = attributs[f1];
temp += attributs[f2]; // E' = (V0+V1+F1+F2)/4 temp += attributs[f2]; // E' = (V0+V1+F1+F2)/4
temp *= 0.25; temp *= 0.25;
attributs[x] *= 0.5; attributs[x] *= 0.5;
...@@ -352,9 +353,7 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -352,9 +353,7 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
} }
Dart f = map.phi1(d); Dart f = map.phi1(d);
Dart e = map.cutEdge(d);
map.cutEdge(d);
Dart e = map.phi1(d) ;
attributs[e] = attributs[d]; attributs[e] = attributs[d];
attributs[e] += attributs[f]; attributs[e] += attributs[f];
...@@ -382,7 +381,7 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -382,7 +381,7 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
temp = attributs[e1]; temp = attributs[e1];
e1 = map.phi_1(map.phi_1(dd)); e1 = map.phi_1(map.phi_1(dd));
temp += attributs[e1]; temp += attributs[e1];
temp *= 1.0/8.0; temp *= 1.0 / 8.0;
attributs[d] += temp; attributs[d] += temp;
} }
// else nothing to do point already in the middle of segment // else nothing to do point already in the middle of segment
...@@ -426,14 +425,8 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec ...@@ -426,14 +425,8 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
if (mv.isMarked(d)) if (mv.isMarked(d))
{ {
// unmark the darts of the face // unmark the darts of the face
Dart fit = d ; me.unmarkOrbit(FACE, d) ;
do mv.unmarkOrbit(FACE, d) ;
{
mv.unmark(fit) ;
me.unmark(fit) ;
me.unmark(map.phi_1(fit)) ;
fit = map.template phi<11>(fit) ;
} while(fit != d) ;
Dart dd = d; Dart dd = d;
Dart e = map.template phi<11>(dd) ; Dart e = map.template phi<11>(dd) ;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "Topology/generic/marker.h" #include "Topology/generic/marker.h"
#include "Topology/generic/genericmap.h" #include "Topology/generic/genericmap.h"
#include "Topology/generic/functor.h" #include "Topology/generic/functor.h"
#include "Utils/static_assert.h" #include "Utils/static_assert.h"
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "Topology/generic/marker.h" #include "Topology/generic/marker.h"
#include "Topology/generic/genericmap.h" #include "Topology/generic/genericmap.h"
#include "Topology/generic/functor.h" #include "Topology/generic/functor.h"
#include "Utils/static_assert.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -169,6 +170,20 @@ public: ...@@ -169,6 +170,20 @@ public:
* unmark all darts * unmark all darts
*/ */
virtual void unmarkAll() = 0 ; virtual void unmarkAll() = 0 ;
bool isAllUnmarked()
{
assert(m_map.getMarkerSet(DART, m_thread).testMark(m_mark));
AttributeMultiVector<Mark>* mark_vect = m_map.getMarkVector(DART, m_thread);
assert(mark_vect != NULL);
AttributeContainer& cont = m_map.getAttributeContainer(DART) ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
if(mark_vect->operator[](i).testMark(m_mark))
return false ;
return true ;
}
}; };
/** /**
...@@ -223,6 +238,8 @@ public: ...@@ -223,6 +238,8 @@ public:
~DartMarkerStore() ~DartMarkerStore()
{ {
unmarkAll() ; unmarkAll() ;
// assert(isAllUnmarked) ;
CGoGN_ASSERT(isAllUnmarked())
} }
protected: protected:
...@@ -280,7 +297,10 @@ public: ...@@ -280,7 +297,10 @@ public:
{} {}
~DartMarkerNoUnmark() ~DartMarkerNoUnmark()
{} {
// assert(isAllUnmarked) ;
CGoGN_ASSERT(isAllUnmarked())
}
protected: protected:
DartMarkerNoUnmark(const DartMarkerNoUnmark& dm) : DartMarkerGen(dm) DartMarkerNoUnmark(const DartMarkerNoUnmark& dm) : DartMarkerGen(dm)
......
...@@ -165,15 +165,11 @@ Dart GMap2::deleteVertex(Dart d) ...@@ -165,15 +165,11 @@ Dart GMap2::deleteVertex(Dart d)
Dart GMap2::cutEdge(Dart d) Dart GMap2::cutEdge(Dart d)
{ {
Dart e = phi2(d) ; Dart e = phi2(d) ;
beta2unsew(d) ;
beta2unsew(e) ;
Dart nd = GMap1::cutEdge(d) ; Dart nd = GMap1::cutEdge(d) ;
Dart ne = GMap1::cutEdge(e) ; Dart ne = GMap1::cutEdge(e) ;
beta2sew(d, beta0(ne)) ; beta2sew(nd, beta1(ne)) ;
beta2sew(beta0(d), ne) ; beta2sew(ne, beta1(nd)) ;
beta2sew(e, beta0(nd)) ;
beta2sew(beta0(e), nd) ;
return nd ; return nd ;
} }
...@@ -744,6 +740,8 @@ bool GMap2::check() ...@@ -744,6 +740,8 @@ bool GMap2::check()
CGoGNout << "Check: beta2 is not an involution" << CGoGNendl; CGoGNout << "Check: beta2 is not an involution" << CGoGNendl;
return false; return false;
} }
if(dd == d)
CGoGNout << "Check (warning): beta2 has fix points" << CGoGNendl;
} }
CGoGNout << "Check: topology ok" << CGoGNendl; CGoGNout << "Check: topology ok" << CGoGNendl;
......
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