From 9cb5f9c5b8ad53bd67de8b6c5d18bdfc96cc6d33 Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Wed, 30 Apr 2014 16:30:38 +0200 Subject: [PATCH] cell typing in map2 functions --- Apps/Tuto/Traversals/traverse_neighbours.cpp | 26 ++-- SCHNApps/include/cellSelector.h | 6 +- include/Algo/Render/GL2/mapRender.h | 6 +- include/Algo/Render/GL2/mapRender.hpp | 69 +++++----- .../generic/traversor/traversorCell.h | 28 +--- include/Topology/map/map2.h | 112 +++++++-------- include/Topology/map/map2.hpp | 128 ++++++++++-------- 7 files changed, 186 insertions(+), 189 deletions(-) diff --git a/Apps/Tuto/Traversals/traverse_neighbours.cpp b/Apps/Tuto/Traversals/traverse_neighbours.cpp index e00f116a..50919b1d 100644 --- a/Apps/Tuto/Traversals/traverse_neighbours.cpp +++ b/Apps/Tuto/Traversals/traverse_neighbours.cpp @@ -59,10 +59,14 @@ int main() // easy way to find the central vertex of the grid Vertex v; -// findCell(VERTEX,v,MAP,myMap, position[v] == VEC3(0,0,0) ); - find_cell(myMap,v, [&](Vertex v) + foreach_cell_until(myMap, [&] (Vertex it) { - return position[v] == VEC3(0,0,0); + if (position[it] == VEC3(0,0,0)) + { + v = it; + return true; + } + return false; }); // must test of find ok (if not v.dart is NIL) @@ -73,14 +77,14 @@ int main() // WITH TRAVERSORS: // find incident faces to vertex - Traversor2VF trvf(myMap,v.dart); + Traversor2VF trvf(myMap, v.dart); for (Dart e = trvf.begin(); e != trvf.end(); e = trvf.next()) { std::cout << "Face of dart "< trvvaf(myMap,v.dart); + Traversor2VVaF trvvaf(myMap, v.dart); for (Dart e = trvvaf.begin(); e != trvvaf.end(); e = trvvaf.next()) { std::cout << "vertex of dart "<(myMap,v,[&](Face f) + // find faces incident to vertex v + foreach_incident2(myMap, v, [&](Face f) { - std::cout << "Face of dart "<(myMap,v,[&](Vertex x) + // find vertices adjacent to vertex v thru a face + foreach_adjacent2(myMap, v, [&](Vertex x) { - std::cout << "vertex of dart "<& mex) = 0; + virtual void setMutuallyExclusiveSet(const QList& mex) = 0; signals: void selectedCellsChanged(); diff --git a/include/Algo/Render/GL2/mapRender.h b/include/Algo/Render/GL2/mapRender.h index 6f97109c..59034144 100644 --- a/include/Algo/Render/GL2/mapRender.h +++ b/include/Algo/Render/GL2/mapRender.h @@ -151,10 +151,10 @@ protected: * @param tableIndices the indices table */ template - void addTri(typename PFP::MAP& map, Dart d, std::vector& tableIndices) ; + void addTri(typename PFP::MAP& map, Face f, std::vector& tableIndices) ; template - inline void addEarTri(typename PFP::MAP& map, Dart d, std::vector& tableIndices, const VertexAttribute* position); + inline void addEarTri(typename PFP::MAP& map, Face f, std::vector& tableIndices, const VertexAttribute* position); template float computeEarAngle(const typename PFP::VEC3& P1, const typename PFP::VEC3& P2, const typename PFP::VEC3& P3, const typename PFP::VEC3& normalPoly); @@ -166,7 +166,7 @@ protected: void recompute2Ears(const VertexAttribute& position, VertexPoly* vp, const typename PFP::VEC3& normalPoly, VPMS& ears, bool convex); template - bool inTriangle(const VEC3& P, const VEC3& normal, const VEC3& Ta, const VEC3& Tb, const VEC3& Tc); + bool inTriangle(const VEC3& P, const VEC3& normal, const VEC3& Ta, const VEC3& Tb, const VEC3& Tc); public: /** diff --git a/include/Algo/Render/GL2/mapRender.hpp b/include/Algo/Render/GL2/mapRender.hpp index 1fa6f8e2..f674894f 100644 --- a/include/Algo/Render/GL2/mapRender.hpp +++ b/include/Algo/Render/GL2/mapRender.hpp @@ -180,7 +180,7 @@ bool MapRender::computeEarIntersection(const VertexAttribute -inline void MapRender::addEarTri(typename PFP::MAP& map, Dart d, std::vector& tableIndices, const VertexAttribute* pos) +inline void MapRender::addEarTri(typename PFP::MAP& map, Face f, std::vector& tableIndices, const VertexAttribute* pos) { typedef typename PFP::VEC3 VEC3; @@ -190,24 +190,24 @@ inline void MapRender::addEarTri(typename PFP::MAP& map, Dart d, std::vector& position = *pos ; // compute normal to polygon - VEC3 normalPoly = Algo::Surface::Geometry::newellNormal(map, d, position); + VEC3 normalPoly = Algo::Surface::Geometry::newellNormal(map, f, position); // first pass create polygon in chained list with angle computation VertexPoly* vpp = NULL; VertexPoly* prem = NULL; unsigned int nbv = 0; unsigned int nbe = 0; - Dart a = d; - Dart b = map.phi1(a); - Dart c = map.phi1(b); + Vertex a = f.dart; + Vertex b = map.phi1(a); + Vertex c = map.phi1(b); do { - VEC3 P1 = position[map.template getEmbedding(a)]; - VEC3 P2 = position[map.template getEmbedding(b)]; - VEC3 P3 = position[map.template getEmbedding(c)]; + VEC3 P1 = position[map.getEmbedding(a)]; + VEC3 P2 = position[map.getEmbedding(b)]; + VEC3 P3 = position[map.getEmbedding(c)]; float val = computeEarAngle(P1, P2, P3, normalPoly); - VertexPoly* vp = new VertexPoly(map.template getEmbedding(b), val, (P3-P1).norm2(), vpp); + VertexPoly* vp = new VertexPoly(map.getEmbedding(b), val, (P3-P1).norm2(), vpp); if (vp->value < 5.0f) nbe++; @@ -218,7 +218,7 @@ inline void MapRender::addEarTri(typename PFP::MAP& map, Dart d, std::vectorear = ears.insert(vpp); vpp = vpp->next; @@ -237,9 +237,9 @@ inline void MapRender::addEarTri(typename PFP::MAP& map, Dart d, std::vectorvalue <5.0f) + if (vpp->value < 5.0f) computeEarIntersection(position, vpp, normalPoly); vpp->ear = ears.insert(vpp); vpp = vpp->next; @@ -248,7 +248,7 @@ inline void MapRender::addEarTri(typename PFP::MAP& map, Dart d, std::vector3) + while (nbv > 3) { // take best (and valid!) ear VPMS::iterator be_it = ears.begin(); // best ear @@ -259,14 +259,14 @@ inline void MapRender::addEarTri(typename PFP::MAP& map, Dart d, std::vectorprev->id); nbv--; - if (nbv>3) // do not recompute if only one triangle left + if (nbv > 3) // do not recompute if only one triangle left { //remove ears and two sided ears ears.erase(be_it); // from map of ears ears.erase(be->next->ear); ears.erase(be->prev->ear); be = VertexPoly::erase(be); // and remove ear vertex from polygon - recompute2Ears(position,be,normalPoly,ears,convex); + recompute2Ears(position, be, normalPoly, ears, convex); convex = (*(ears.rbegin()))->value < 5.0f; } else // finish (no need to update ears) @@ -286,21 +286,21 @@ inline void MapRender::addEarTri(typename PFP::MAP& map, Dart d, std::vector -inline void MapRender::addTri(typename PFP::MAP& map, Dart d, std::vector& tableIndices) +inline void MapRender::addTri(typename PFP::MAP& map, Face f, std::vector& tableIndices) { - Dart a = d; - Dart b = map.phi1(a); - Dart c = map.phi1(b); + Vertex a = f.dart; + Vertex b = map.phi1(a); + Vertex c = map.phi1(b); // loop to cut a polygon in triangle on the fly (works only with convex faces) do { - tableIndices.push_back(map.template getEmbedding(d)); - tableIndices.push_back(map.template getEmbedding(b)); - tableIndices.push_back(map.template getEmbedding(c)); + tableIndices.push_back(map.getEmbedding(a)); + tableIndices.push_back(map.getEmbedding(b)); + tableIndices.push_back(map.getEmbedding(c)); b = c; c = map.phi1(b); - } while (c != d); + } while (c.dart != a.dart); } template @@ -308,27 +308,22 @@ void MapRender::initTriangles(typename PFP::MAP& map, std::vector& table { tableIndices.reserve(4 * map.getNbDarts() / 3); -// TraversorF trav(map, thread); - if(position == NULL) { -// for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) -// foreachCellMT(VERTEX,d,typename PFP::MAP,map,thread) - foreach_cell(map, [&] (Vertex v) + foreach_cell(map, [&] (Face f) { - addTri(map, v, tableIndices); - },false,thread); + addTri(map, f, tableIndices); + }, false, thread); } else { -// for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) - foreach_cell(map, [&] (Vertex v) + foreach_cell(map, [&] (Face f) { - if(map.faceDegree(v) == 3) - addTri(map, v, tableIndices); + if(map.faceDegree(f) == 3) + addTri(map, f, tableIndices); else - addEarTri(map, v, tableIndices, position); - },false,thread); + addEarTri(map, f, tableIndices, position); + }, false, thread); } } diff --git a/include/Topology/generic/traversor/traversorCell.h b/include/Topology/generic/traversor/traversorCell.h index dd0fa62d..3f37a901 100644 --- a/include/Topology/generic/traversor/traversorCell.h +++ b/include/Topology/generic/traversor/traversorCell.h @@ -65,19 +65,6 @@ public: inline Cell next() ; inline void skip(Cell c); - - inline void apply(std::function)> f) - { - for (Cell c = begin(), e = end(); c.dart != e.dart; c = next()) - if (f(c)) - return; - } - - inline void apply(std::function)> f) - { - for (Cell c = begin(), e = end(); c.dart != e.dart; c = next()) - f(c); - } } ; @@ -86,23 +73,22 @@ template inline void foreach_cell(const MAP& map, FUNC f, bool forceDartMarker = false, unsigned int thread = 0) { TraversorCell trav(map, forceDartMarker, thread); - trav.apply(f); + for (Cell c = trav.begin(), e = trav.end(); c.dart != e.dart; c = trav.next()) + f(c); } -template -inline void find_cell(const MAP& map, Cell c, std::function)> cond, bool forceDartMarker = false, unsigned int thread = 0) +template +inline void foreach_cell_until(const MAP& map, FUNC f, bool forceDartMarker = false, unsigned int thread = 0) { TraversorCell trav(map, forceDartMarker, thread); - c = trav.begin(); - Cell e = trav.end(); - while ((c.dart != e.dart) && (!cond(c))) - c = trav.next(); + for (Cell c = trav.begin(), e = trav.end(); c.dart != e.dart; c = trav.next()) + if (!f(c)) + break; } - template class TraversorV : public TraversorCell { diff --git a/include/Topology/map/map2.h b/include/Topology/map/map2.h index 063f6b34..aa17e09b 100644 --- a/include/Topology/map/map2.h +++ b/include/Topology/map/map2.h @@ -309,110 +309,110 @@ public: *************************************************************************/ //@{ - //! Test if dart d and e belong to the same oriented vertex - /*! @param d a dart - * @param e a dart + //! Test if vertices v1 and v2 represent the same oriented vertex + /*! @param v1 a vertex + * @param v2 a vertex */ - bool sameOrientedVertex(Dart d, Dart e) const; + bool sameOrientedVertex(Vertex v1, Vertex v2) const; - //! Test if dart d and e belong to the same vertex - /*! @param d a dart - * @param e a dart + //! Test if vertices v1 and v2 represent the same vertex + /*! @param v1 a vertex + * @param v2 a vertex */ - bool sameVertex(Dart d, Dart e) const; + bool sameVertex(Vertex v1, Vertex v2) const; - //! Compute the number of edges of the vertex of d - /*! @param d a dart + //! Compute the number of edges of the vertex v + /*! @param v a vertex */ - unsigned int vertexDegree(Dart d) const; + unsigned int vertexDegree(Vertex v) const; - //! Check number of edges of the vertex of d with given parameter - /*! @param d a dart + //! Check number of edges of the vertex v with given parameter + /*! @param v a vertex * @param vd degree to compare with - * @return negative/null/positive if vertex degree is less/equal/greater than given degree + * @return negative/null/positive if vertex degree is less/equal/greater than given degree */ - int checkVertexDegree(Dart d, unsigned int vd) const; + int checkVertexDegree(Vertex v, unsigned int vd) const; - //! Tell if the vertex of d is on the boundary of the map - /*! @param d a dart + //! Tell if the vertex v is on the boundary of the map + /*! @param v a vertex */ - bool isBoundaryVertex(Dart d) const; + bool isBoundaryVertex(Vertex v) const; /** - * find the dart of vertex that belong to the boundary + * find the dart of vertex v that belongs to the boundary * return NIL if the vertex is not on the boundary */ - Dart findBoundaryEdgeOfVertex(Dart d) const; + Dart findBoundaryEdgeOfVertex(Vertex v) const; - //! Test if dart d and e belong to the same edge - /*! @param d a dart - * @param e a dart + //! Test if edges e1 and e2 represent the same edge + /*! @param e1 an edge + * @param e2 an edge */ - bool sameEdge(Dart d, Dart e) const; + bool sameEdge(Edge e1, Edge e2) const; /** - * tell if the edge of d is on the boundary of the map + * tell if the edge e is on the boundary of the map */ - bool isBoundaryEdge(Dart d) const; + bool isBoundaryEdge(Edge e) const; - //! Test if dart d and e belong to the same oriented face - /*! @param d a dart - * @param e a dart + //! Test if faces f1 and f2 represent the same oriented face + /*! @param f1 a face + * @param f2 a face */ - bool sameOrientedFace(Dart d, Dart e) const; + bool sameOrientedFace(Face f1, Face f2) const; - //! Test if dart d and e belong to the same face - /*! @param d a dart - * @param e a dart + //! Test if faces f1 and f2 represent the same face + /*! @param f1 a face + * @param f2 a face */ - bool sameFace(Dart d, Dart e) const; + bool sameFace(Face f1, Face f2) const; /** - * compute the number of edges of the face of d + * compute the number of edges of the face f */ - unsigned int faceDegree(Dart d) const; + unsigned int faceDegree(Face f) const; - //! Check number of edges of the face of d with given parameter - /*! @param d a dart - * @param vd degree to compare with - * @return negative/null/positive if vertex degree is less/equal/greater than given degree + //! Check number of edges of the face f with given parameter + /*! @param f a face + * @param fd degree to compare with + * @return negative/null/positive if face degree is less/equal/greater than given degree */ - int checkFaceDegree(Dart d, unsigned int le) const; + int checkFaceDegree(Face f, unsigned int fd) const; /** - * tell if the face of d is on the boundary of the map + * tell if the face f is incident to the boundary of the map */ - bool isBoundaryFace(Dart d) const; + bool isFaceIncidentToBoundary(Face f) const; /** - * find the dart of edge that belong to the boundary - * return NIL if the face is not on the boundary + * find the dart of face f that belongs to the boundary + * return NIL if the face is not incident to the boundary */ - Dart findBoundaryEdgeOfFace(Dart d) const; + Dart findBoundaryEdgeOfFace(Face f) const; - //! Test if dart d and e belong to the same oriented volume + //! Test if volumes v1 and v2 represent the same oriented volume /*! @param d a dart * @param e a dart */ - bool sameOrientedVolume(Dart d, Dart e) const; + bool sameOrientedVolume(Vol v1, Vol v2) const; - //! Test if dart d and e belong to the same volume + //! Test if volumes v1 and v2 represent the same volume /*! @param d a dart * @param e a dart */ - bool sameVolume(Dart d, Dart e) const; + bool sameVolume(Vol v1, Vol v2) const; - //! Compute the number of faces in the volume of d + //! Compute the number of faces in the volume v /*! @param d a dart */ - unsigned int volumeDegree(Dart d) const; + unsigned int volumeDegree(Vol v) const; - //! Check number of faces of the volume of d with given parameter - /*! @param d a dart + //! Check number of faces of the volume v with given parameter + /*! @param v a volume * @param vd degree to compare with - * @return negative/null/positive if volume degree is less/equal/greater than given degree + * @return negative/null/positive if volume degree is less/equal/greater than given degree */ - int checkVolumeDegree(Dart d, unsigned int volDeg)const; + int checkVolumeDegree(Vol v, unsigned int vd) const; // TODO a mettre en algo /** diff --git a/include/Topology/map/map2.hpp b/include/Topology/map/map2.hpp index 614bdd51..49b9accb 100644 --- a/include/Topology/map/map2.hpp +++ b/include/Topology/map/map2.hpp @@ -537,7 +537,7 @@ void Map2::extractTrianglePair(Dart d) { Dart e = phi2(d) ; - assert(!isBoundaryFace(d) && !isBoundaryFace(e)) ; + assert(!isFaceIncidentToBoundary(d) && !isFaceIncidentToBoundary(e)) ; assert(faceDegree(d) == 3 && faceDegree(e) == 3) ; Dart d1 = phi2(this->phi1(d)) ; @@ -577,7 +577,7 @@ bool Map2::mergeVolumes(Dart d, Dart e, bool deleteFace) { assert(!this->template isBoundaryMarked<2>(d) && !this->template isBoundaryMarked<2>(e)) ; - if (isBoundaryFace(d) || isBoundaryFace(e)) + if (isFaceIncidentToBoundary(d) || isFaceIncidentToBoundary(e)) return false; // First traversal of both faces to check the face sizes @@ -653,157 +653,158 @@ void Map2::splitSurface(std::vector& vd, bool firstSideClosed, b *************************************************************************/ template -bool Map2::sameOrientedVertex(Dart d, Dart e) const +bool Map2::sameOrientedVertex(Vertex v1, Vertex v2) const { - Dart it = d; // Foreach dart dNext in the vertex of d + Dart it = v1.dart; // Foreach dart in vertex v1 do { - if (it == e) // Test equality with e + if (it == v2.dart) // Test equality with v2 return true; it = phi2(this->phi_1(it)); - } while (it != d); + } while (it != v1.dart); return false; // None is equal to e => vertices are distinct } template -inline bool Map2::sameVertex(Dart d, Dart e) const +inline bool Map2::sameVertex(Vertex v1, Vertex v2) const { - return sameOrientedVertex(d, e) ; + return sameOrientedVertex(v1, v2) ; } template -unsigned int Map2::vertexDegree(Dart d) const +unsigned int Map2::vertexDegree(Vertex v) const { unsigned int count = 0 ; - Dart it = d ; + Dart it = v.dart ; do { ++count ; it = phi2(this->phi_1(it)) ; - } while (it != d) ; + } while (it != v.dart) ; return count ; } template -int Map2::checkVertexDegree(Dart d, unsigned int vd) const +int Map2::checkVertexDegree(Vertex v, unsigned int vd) const { unsigned int count = 0 ; - Dart it = d ; + Dart it = v.dart ; do { ++count ; it = phi2(this->phi_1(it)) ; - } while ((count <= vd) && (it != d)) ; + } while ((count <= vd) && (it != v.dart)) ; return count - vd; } template -bool Map2::isBoundaryVertex(Dart d) const +bool Map2::isBoundaryVertex(Vertex v) const { - Dart it = d ; + Dart it = v.dart ; do { if (this->template isBoundaryMarked<2>(it)) return true ; it = phi2(this->phi_1(it)) ; - } while (it != d) ; + } while (it != v.dart) ; return false ; } template -Dart Map2::findBoundaryEdgeOfVertex(Dart d) const +Dart Map2::findBoundaryEdgeOfVertex(Vertex v) const { - Dart it = d ; + Dart it = v.dart ; do { if (this->template isBoundaryMarked<2>(it)) return it ; it = phi2(this->phi_1(it)) ; - } while (it != d) ; + } while (it != v.dart) ; return NIL ; } template -inline bool Map2::sameEdge(Dart d, Dart e) const +inline bool Map2::sameEdge(Edge e1, Edge e2) const { - return d == e || phi2(d) == e ; + return e1.dart == e2.dart || phi2(e1.dart) == e2.dart ; } template -inline bool Map2::isBoundaryEdge(Dart d) const +inline bool Map2::isBoundaryEdge(Edge e) const { - return this->template isBoundaryMarked<2>(d) || this->template isBoundaryMarked<2>(phi2(d)); + return this->template isBoundaryMarked<2>(e.dart) || this->template isBoundaryMarked<2>(phi2(e.dart)); } template -inline bool Map2::sameOrientedFace(Dart d, Dart e) const +inline bool Map2::sameOrientedFace(Face f1, Face f2) const { - return ParentMap::sameCycle(d, e) ; + return ParentMap::sameCycle(f1, f2) ; } template -inline bool Map2::sameFace(Dart d, Dart e) const +inline bool Map2::sameFace(Face f1, Face f2) const { - return sameOrientedFace(d, e) ; + return sameOrientedFace(f1, f2) ; } template -inline unsigned int Map2::faceDegree(Dart d) const +inline unsigned int Map2::faceDegree(Face f) const { - return ParentMap::cycleDegree(d) ; + return ParentMap::cycleDegree(f) ; } template -inline int Map2::checkFaceDegree(Dart d, unsigned int le) const +inline int Map2::checkFaceDegree(Face f, unsigned int fd) const { - return ParentMap::checkCycleDegree(d,le) ; + return ParentMap::checkCycleDegree(f, fd) ; } template -bool Map2::isBoundaryFace(Dart d) const +bool Map2::isFaceIncidentToBoundary(Face f) const { - Dart it = d ; + Dart it = f.dart ; do { if (this->template isBoundaryMarked<2>(phi2(it))) return true ; it = this->phi1(it) ; - } while (it != d) ; + } while (it != f.dart) ; return false ; } template -Dart Map2::findBoundaryEdgeOfFace(Dart d) const +Dart Map2::findBoundaryEdgeOfFace(Face f) const { - Dart it = d ; + Dart it = f.dart ; do { if (this->template isBoundaryMarked<2>(phi2(it))) return phi2(it) ; it = this->phi1(it) ; - } while (it != d) ; + } while (it != f.dart) ; return NIL ; } template -bool Map2::sameOrientedVolume(Dart d, Dart e) const +bool Map2::sameOrientedVolume(Vol v1, Vol v2) const { DartMarkerStore mark(*this); // Lock a marker - std::list visitedFaces; // Faces that are traversed - visitedFaces.push_back(d); // Start with the face of d + std::list visitedFaces; // Faces that are traversed + visitedFaces.push_back(v1.dart); // Start with a face of v1 std::list::iterator face; // For every face added to the list for (face = visitedFaces.begin(); face != visitedFaces.end(); ++face) { - if (!this->template isBoundaryMarked<2>(*face) && !mark.isMarked(*face)) // Face has not been visited yet + // Face has not been visited yet + if (!this->template isBoundaryMarked<2>(*face) && !mark.isMarked(*face)) { Dart it = *face ; do { - if(it == e) + if(it == v2.dart) return true; mark.mark(it); // Mark @@ -818,21 +819,20 @@ bool Map2::sameOrientedVolume(Dart d, Dart e) const } template -inline bool Map2::sameVolume(Dart d, Dart e) const +inline bool Map2::sameVolume(Vol v1, Vol v2) const { - return sameOrientedVolume(d, e) ; + return sameOrientedVolume(v1, v2) ; } template -unsigned int Map2::volumeDegree(Dart d) const +unsigned int Map2::volumeDegree(Vol v) const { unsigned int count = 0; DartMarkerStore mark(*this); // Lock a marker std::vector visitedFaces; // Faces that are traversed visitedFaces.reserve(16); - visitedFaces.push_back(d); // Start with the face of d - std::vector::iterator face; + visitedFaces.push_back(v.dart); // Start with a face of v // For every face added to the list for (unsigned int i = 0; i != visitedFaces.size(); ++i) @@ -857,14 +857,14 @@ unsigned int Map2::volumeDegree(Dart d) const } template -int Map2::checkVolumeDegree(Dart d, unsigned int volDeg) const +int Map2::checkVolumeDegree(Vol v, unsigned int vd) const { unsigned int count = 0; DartMarkerStore mark(*this); // Lock a marker std::vector visitedFaces; // Faces that are traversed visitedFaces.reserve(16); - visitedFaces.push_back(d); // Start with the face of d + visitedFaces.push_back(v.dart); // Start with a face of v // For every face added to the list for (unsigned int i = 0; i != visitedFaces.size(); ++i) @@ -883,23 +883,35 @@ int Map2::checkVolumeDegree(Dart d, unsigned int volDeg) const it = this->phi1(it); } while(it != df); } - if (count > volDeg) + if (count > vd) break; } - return count - volDeg; + return count - vd; } template bool Map2::isTriangular() const { - TraversorF > t(*this) ; - for(Dart d = t.begin(); d != t.end(); d = t.next()) + bool tri = true; + foreach_cell_until(this, [&] (Face f) { - if(faceDegree(d) != 3) - return false ; - } - return true ; + if (this->faceDegree(f) != 3) + { + tri = false; + return false; + } + return true; + }); + return tri; + +// TraversorF > t(*this) ; +// for(Dart d = t.begin(); d != t.end(); d = t.next()) +// { +// if(faceDegree(d) != 3) +// return false ; +// } +// return true ; } template -- GitLab