Commit a8e3b02f authored by Jund Thomas's avatar Jund Thomas

importSVG, TwoNPlusOneSubdivision, embeddedMap2 for boolean operations corrected

parent 7880c49d
......@@ -355,7 +355,6 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
}
}
Geom::BoundingBox<typename PFP::VEC3> bb ;
bb = Algo::Geometry::computeBoundingBox<PFP>(map, position) ;
float tailleX = bb.size(0) ;
......@@ -419,11 +418,13 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
bool canSimplify = true ;
while ( canSimplify && ((position[map.phi1(d)] - position[d]).norm() < edgeWidth[d]) )
{
if (map.vertexDegree(map.phi1(d)) == 2) {
if (map.vertexDegree(map.phi1(d)) == 2)
{
map.uncutEdge(d) ;
count++;
}
else canSimplify = false ;
else
canSimplify = false ;
}
}
}
......@@ -489,8 +490,18 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
}
}
//close the intersections
map.closeMap(false) ;
for (Dart d = map.begin() ; d != map.end() ; map.next(d))
{
if(map.isBoundaryMarked(d))
{
map.fillHole(d);
}
if(map.faceDegree(d)==2)
{
map.mergeFaces(d);
}
}
//embed the path
for (Dart d = map.begin() ; d != map.end() ; map.next(d))
......@@ -511,6 +522,23 @@ bool importSVG(typename PFP::MAP& map, const std::string& filename, VertexAttrib
position[map.phi1(d)] = pos ;
}
}
if(allBrokenLines.size()>0)
map.template initAllOrbitsEmbedding<FACE>(true);
if(allBrokenLines.size()>0)
{
for (Dart d = map.begin() ; d != map.end() ; map.next(d))
{
if (!map.isBoundaryMarked(d) && brokenL.isMarked(d))
{
map.deleteFace(d,false);
}
}
}
map.closeMap();
return true ;
}
......
......@@ -450,36 +450,42 @@ void LoopSubdivision(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>
template <typename PFP, typename EMBV, typename EMB>
void TwoNPlusOneSubdivision(typename PFP::MAP& map, EMBV& attributs, const FunctorSelect& selected)
{
EdgeAutoAttribute<Dart> tablePred(map);
CellMarker<EDGE> m0(map);
CellMarker<FACE> m1(map);
std::vector<Dart> dOrig;
std::vector<EMB> cOrig;
m0.unmarkAll();
m1.unmarkAll();
//first pass cut edge
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
if(selected(d))
{
if(!m0.isMarked(d)) {
dOrig.push_back(d);
Dart dd = d;
do {
if(!m0.isMarked(dd)) {
EMB e1 = attributs[dd];
EMB e2 = attributs[map.phi1(dd)];
map.cutEdge(dd);
attributs[map.phi1(dd)] = e1*2.0f/3.0f+e2/3.0f;
map.cutEdge(map.phi1(dd));
attributs[map.phi1(map.phi1(dd))] = e2*2.0f/3.0f+e1/3.0f;
m0.mark(dd);
m0.mark(map.phi1(dd));
m0.mark(map.template phi<11>(dd));
}
dd = map.template phi<111>(dd);
} while(dd!=d);
if(!m0.isMarked(d))
{
if(!m1.isMarked(d))
{
m1.mark(d);
dOrig.push_back(d);
}
if(selected(map.phi2(d)) && !m1.isMarked(map.phi2(d)))
{
m1.mark(map.phi2(d));
dOrig.push_back(map.phi2(d));
}
EMB e1 = attributs[d];
EMB e2 = attributs[map.phi1(d)];
map.cutEdge(d);
attributs[map.phi1(d)] = e1*2.0f/3.0f+e2/3.0f;
map.cutEdge(map.phi1(d));
attributs[map.phi1(map.phi1(d))] = e2*2.0f/3.0f+e1/3.0f;
m0.mark(d);
m0.mark(map.phi1(d));
m0.mark(map.template phi<11>(d));
}
}
}
......
......@@ -354,13 +354,11 @@ void EmbeddedMap2::insertEdgeInVertex(Dart d, Dart e)
{
if(!sameFace(d,e))
{
// embedNewCell<FACE>(e);
// copyCell<FACE>(e, d) ;
setOrbitEmbedding<FACE>(e, getEmbedding<FACE>(d)) ;
setOrbitEmbeddingOnNewCell<FACE>(e);
copyCell<FACE>(e, d);
}
else
{
// embedOrbit<FACE>(d, getEmbedding<FACE>(d)) ;
setOrbitEmbedding<FACE>(d, getEmbedding<FACE>(d)) ;
}
}
......@@ -376,22 +374,19 @@ bool EmbeddedMap2::removeEdgeFromVertex(Dart d)
if (isOrbitEmbedded<VERTEX>())
{
// embedNewCell<VERTEX>(d);
// copyCell<VERTEX>(d, dPrev);
initDartEmbedding<VERTEX>(d, getEmbedding<VERTEX>(dPrev)) ;
setOrbitEmbeddingOnNewCell<VERTEX>(d);
copyCell<VERTEX>(d, dPrev);
}
if (isOrbitEmbedded<FACE>())
{
if(!sameFace(d, dPrev))
{
// embedNewCell<FACE>(d);
// copyCell<FACE>(d, dPrev) ;
initDartEmbedding<FACE>(d, getEmbedding<FACE>(dPrev)) ;
setOrbitEmbeddingOnNewCell<FACE>(d);
copyCell<FACE>(d, dPrev);
}
else
{
// embedOrbit<FACE>(d, getEmbedding<FACE>(d)) ;
initDartEmbedding<FACE>(d, getEmbedding<FACE>(d)) ;
}
}
......
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