Commit 8d0fb6f4 authored by Pierre Kraemer's avatar Pierre Kraemer

correctifs import + subdiv pour GMaps

parent 90151896
......@@ -80,10 +80,10 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts)
FunctorSetEmb<typename PFP::MAP> fsetemb(map, VERTEX, em);
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
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)
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
{
......
......@@ -140,6 +140,7 @@ void quadranguleFaces(typename PFP::MAP& map, EMBV& attributs, const FunctorSele
Dart e = map.cutEdge(d);
// TODO trouver pourquoi lerp bug avec ECell
// attributs[m] = AttribOps::lerp<EMB,PFP>(attributs[d],attributs[f], 0.5);
attributs[e] = attributs[d];
attributs[e] += attributs[f];
attributs[e] *= 0.5;
......@@ -194,17 +195,17 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func
m0.mark(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));
l_verts.push_back(map.phi2(d));
m0.mark(d2);
l_verts.push_back(d2);
}
Dart f = map.phi1(d);
map.cutEdge(d);
Dart e = map.phi1(d) ;
Dart e = map.cutEdge(d);
attributs[e] = attributs[d];
attributs[e] = attributs[d];
attributs[e] += attributs[f];
attributs[e] *= 0.5;
......@@ -226,15 +227,16 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func
// compute center skip darts of new vertices non embedded
EMB center = AttribOps::zero<EMB,PFP>();
unsigned int count = 0 ;
mf.unmarkOrbit(FACE, d) ;
Dart it = d;
do
{
mf.unmark(it);
me.unmark(it);
me.unmark(map.phi1(it));
center += attributs[it];
++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) ;
center /= double(count);
Dart cf = quadranguleFace<PFP>(map, d); // quadrangule the face
......@@ -247,13 +249,12 @@ void CatmullClarkSubdivision(typename PFP::MAP& map, EMBV& attributs, const Func
{
Dart x = *mid;
// other side of the edge
Dart y = map.phi2(x);
if (y != x)
if (!map.isBoundaryEdge(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>();
temp = attributs[f1];
temp = attributs[f1];
temp += attributs[f2]; // E' = (V0+V1+F1+F2)/4
temp *= 0.25;
attributs[x] *= 0.5;
......@@ -352,9 +353,7 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
}
Dart f = map.phi1(d);
map.cutEdge(d);
Dart e = map.phi1(d) ;
Dart e = map.cutEdge(d);
attributs[e] = attributs[d];
attributs[e] += attributs[f];
......@@ -382,7 +381,7 @@ void LoopSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelec
temp = attributs[e1];
e1 = map.phi_1(map.phi_1(dd));
temp += attributs[e1];
temp *= 1.0/8.0;
temp *= 1.0 / 8.0;
attributs[d] += temp;
}
// 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
if (mv.isMarked(d))
{
// unmark the darts of the face
Dart fit = d ;
do
{
mv.unmark(fit) ;
me.unmark(fit) ;
me.unmark(map.phi_1(fit)) ;
fit = map.template phi<11>(fit) ;
} while(fit != d) ;
me.unmarkOrbit(FACE, d) ;
mv.unmarkOrbit(FACE, d) ;
Dart dd = d;
Dart e = map.template phi<11>(dd) ;
......
......@@ -27,7 +27,6 @@
#include "Topology/generic/marker.h"
#include "Topology/generic/genericmap.h"
#include "Topology/generic/functor.h"
#include "Utils/static_assert.h"
......
......@@ -28,6 +28,7 @@
#include "Topology/generic/marker.h"
#include "Topology/generic/genericmap.h"
#include "Topology/generic/functor.h"
#include "Utils/static_assert.h"
namespace CGoGN
{
......@@ -169,6 +170,20 @@ public:
* unmark all darts
*/
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:
~DartMarkerStore()
{
unmarkAll() ;
// assert(isAllUnmarked) ;
CGoGN_ASSERT(isAllUnmarked())
}
protected:
......@@ -280,7 +297,10 @@ public:
{}
~DartMarkerNoUnmark()
{}
{
// assert(isAllUnmarked) ;
CGoGN_ASSERT(isAllUnmarked())
}
protected:
DartMarkerNoUnmark(const DartMarkerNoUnmark& dm) : DartMarkerGen(dm)
......
......@@ -165,15 +165,11 @@ Dart GMap2::deleteVertex(Dart d)
Dart GMap2::cutEdge(Dart d)
{
Dart e = phi2(d) ;
beta2unsew(d) ;
beta2unsew(e) ;
Dart nd = GMap1::cutEdge(d) ;
Dart ne = GMap1::cutEdge(e) ;
beta2sew(d, beta0(ne)) ;
beta2sew(beta0(d), ne) ;
beta2sew(e, beta0(nd)) ;
beta2sew(beta0(e), nd) ;
beta2sew(nd, beta1(ne)) ;
beta2sew(ne, beta1(nd)) ;
return nd ;
}
......@@ -744,6 +740,8 @@ bool GMap2::check()
CGoGNout << "Check: beta2 is not an involution" << CGoGNendl;
return false;
}
if(dd == d)
CGoGNout << "Check (warning): beta2 has fix points" << 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