diff --git a/include/Algo/Decimation/edgeSelector.h b/include/Algo/Decimation/edgeSelector.h index eed8a674b10a7bda46a994682b170637b3061ce0..63abb23a465162a8e61fc75fb0899286fc829cc8 100644 --- a/include/Algo/Decimation/edgeSelector.h +++ b/include/Algo/Decimation/edgeSelector.h @@ -379,14 +379,14 @@ public: if(!normal.isValid()) { normal = m.template addAttribute("normal") ; - Algo::Geometry::computeNormalVertices(m, pos, normal) ; + Algo::Surface::Geometry::computeNormalVertices(m, pos, normal) ; } edgeangle = m.template getAttribute("edgeangle") ; if(!edgeangle.isValid()) { edgeangle = m.template addAttribute("edgeangle") ; - Algo::Geometry::computeAnglesBetweenNormalsOnEdges(m, pos, edgeangle) ; + Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges(m, pos, edgeangle) ; } kmax = m.template getAttribute("kmax") ; @@ -403,7 +403,7 @@ public: Kmax = m.template addAttribute("Kmax") ; Kmin = m.template addAttribute("Kmin") ; Knormal = m.template addAttribute("Knormal") ; - Algo::Geometry::computeCurvatureVertices_NormalCycles(m, radius, pos, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; + Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles(m, radius, pos, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; } edgeInfo = m.template addAttribute("edgeInfo") ; @@ -467,7 +467,7 @@ public: if(!edgeangle.isValid()) { edgeangle = m.template addAttribute("edgeangle") ; - Algo::Geometry::computeAnglesBetweenNormalsOnEdges(m, pos, edgeangle) ; + Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges(m, pos, edgeangle) ; } edgeInfo = m.template addAttribute("edgeInfo") ; diff --git a/include/Algo/Decimation/edgeSelector.hpp b/include/Algo/Decimation/edgeSelector.hpp index 6e9a877682614ec7fcacf6c07079b1121b06ae2a..b26e52f1d1ca09b0f8d6e17c85c0071255ddc043 100644 --- a/include/Algo/Decimation/edgeSelector.hpp +++ b/include/Algo/Decimation/edgeSelector.hpp @@ -300,7 +300,7 @@ void EdgeSelector_Length::updateEdgeInfo(Dart d, bool recompute) template void EdgeSelector_Length::computeEdgeInfo(Dart d, EdgeInfo& einfo) { - VEC3 vec = Algo::Geometry::vectorOutOfDart(this->m_map, d, this->m_position) ; + VEC3 vec = Algo::Surface::Geometry::vectorOutOfDart(this->m_map, d, this->m_position) ; einfo.it = edges.insert(std::make_pair(vec.norm2(), d)) ; einfo.valid = true ; } @@ -989,7 +989,7 @@ void EdgeSelector_NormalArea::computeEdgeInfo(Dart d, EdgeInfo& einfo) template void EdgeSelector_NormalArea::computeEdgeMatrix(Dart d) { - const typename PFP::VEC3 e = Algo::Geometry::vectorOutOfDart(this->m_map, d, this->m_position) ; + const typename PFP::VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->m_map, d, this->m_position) ; edgeMatrix[d].identity(); edgeMatrix[d] *= e.norm2(); edgeMatrix[d] -= Geom::transposed_vectors_mult(e,e) ; @@ -1086,15 +1086,15 @@ void EdgeSelector_Curvature::updateAfterCollapse(Dart d2, Dart dd2) { typename PFP::MAP& m = this->m_map ; - normal[d2] = Algo::Geometry::vertexNormal(m, d2, this->m_position) ; - Algo::Geometry::computeCurvatureVertex_NormalCycles(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; + normal[d2] = Algo::Surface::Geometry::vertexNormal(m, d2, this->m_position) ; + Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Dart vit = d2 ; do { Dart nVert = m.phi1(vit) ; - normal[nVert] = Algo::Geometry::vertexNormal(m, nVert, this->m_position) ; - Algo::Geometry::computeCurvatureVertex_NormalCycles(m, nVert, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; + normal[nVert] = Algo::Surface::Geometry::vertexNormal(m, nVert, this->m_position) ; + Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles(m, nVert, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; updateEdgeInfo(m.phi1(vit), false) ; // must recompute some edge infos in the if(vit == d2 || vit == dd2) // neighborhood of the collapsed edge @@ -1193,8 +1193,8 @@ void EdgeSelector_Curvature::computeEdgeInfo(Dart d, EdgeInfo& einfo) this->m_position[newV] = m_positionApproximator->getApprox(d) ; // compute things on the coarse version of the mesh - normal[newV] = Algo::Geometry::vertexNormal(m, d2, this->m_position) ; - Algo::Geometry::computeCurvatureVertex_NormalCycles(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; + normal[newV] = Algo::Surface::Geometry::vertexNormal(m, d2, this->m_position) ; + Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; // VEC3 norm = normal[newV] ; REAL mCurv = (kmax[newV] + kmin[newV]) / REAL(2) ; @@ -1335,7 +1335,7 @@ void EdgeSelector_CurvatureTensor::updateAfterCollapse(Dart d2, Dart dd2) { if (!eMark.isMarked(dit2)) { - edgeangle[dit2] = Algo::Geometry::computeAngleBetweenNormalsOnEdge(m, dit2, this->m_position) ; + edgeangle[dit2] = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge(m, dit2, this->m_position) ; eMark.mark(dit2); } } @@ -1408,11 +1408,11 @@ void EdgeSelector_CurvatureTensor::computeEdgeInfo(Dart d, EdgeInfo& einfo) // compute tensor before collapse MATRIX tens1; - Algo::Selection::Collector_OneRing_AroundEdge col1 (m); + Algo::Surface::Selection::Collector_OneRing_AroundEdge col1 (m); col1.collectAll(d); col1.computeNormalCyclesTensor(this->m_position,edgeangle,tens1); // edgeangle is up to date here tens1 *= col1.computeArea(this->m_position); // mean tensor * area = integral of the tensor - Algo::Geometry::normalCycles_SortTensor(tens1); + Algo::Surface::Geometry::normalCycles_SortTensor(tens1); // temporary edge collapse Dart d2 = m.phi2(m.phi_1(d)) ; @@ -1423,11 +1423,11 @@ void EdgeSelector_CurvatureTensor::computeEdgeInfo(Dart d, EdgeInfo& einfo) // compute tensor after collapse MATRIX tens2; - Algo::Selection::Collector_OneRing col2 (m); + Algo::Surface::Selection::Collector_OneRing col2 (m); col2.collectAll(d); col2.computeNormalCyclesTensor(this->m_position,tens2); // edgeangle is not up to date here tens2 *= col2.computeArea(this->m_position); // mean tensor * area = integral of the tensor - Algo::Geometry::normalCycles_SortTensor(tens2); + Algo::Surface::Geometry::normalCycles_SortTensor(tens2); // vertex split to reset the initial connectivity and embeddings m.insertTrianglePair(d, d2, dd2) ; diff --git a/include/Algo/Geometry/curvature.h b/include/Algo/Geometry/curvature.h index 0e13de73d82c4cc6380b6791a91d0c394b3d59d5..ef8aefb94191c82cc61ea04e8b0f2875d84f18ca 100644 --- a/include/Algo/Geometry/curvature.h +++ b/include/Algo/Geometry/curvature.h @@ -181,7 +181,7 @@ void computeCurvatureVertex_NormalCycles_Projected( template void computeCurvatureVertices_NormalCycles( typename PFP::MAP& map, - Algo::Selection::Collector & neigh, + Algo::Surface::Selection::Collector & neigh, const VertexAttribute& position, const VertexAttribute& normal, const EdgeAttribute& edgeangle, @@ -196,7 +196,7 @@ template void computeCurvatureVertex_NormalCycles( typename PFP::MAP& map, Dart dart, - Algo::Selection::Collector & neigh, + Algo::Surface::Selection::Collector & neigh, const VertexAttribute& position, const VertexAttribute& normal, const EdgeAttribute& edgeangle, @@ -209,7 +209,7 @@ void computeCurvatureVertex_NormalCycles( template void computeCurvatureVertices_NormalCycles_Projected( typename PFP::MAP& map, - Algo::Selection::Collector & neigh, + Algo::Surface::Selection::Collector & neigh, const VertexAttribute& position, const VertexAttribute& normal, const EdgeAttribute& edgeangle, @@ -224,7 +224,7 @@ template void computeCurvatureVertex_NormalCycles_Projected( typename PFP::MAP& map, Dart dart, - Algo::Selection::Collector & neigh, + Algo::Surface::Selection::Collector & neigh, const VertexAttribute& position, const VertexAttribute& normal, const EdgeAttribute& edgeangle, diff --git a/include/Algo/Geometry/curvature.hpp b/include/Algo/Geometry/curvature.hpp index 0d79242f642848b3527fcd5b63b8cdef96fc108f..2ba42920d3b144e57ac8934c287a555b4c91996b 100644 --- a/include/Algo/Geometry/curvature.hpp +++ b/include/Algo/Geometry/curvature.hpp @@ -80,7 +80,7 @@ void computeCurvatureVertex_QuadraticFitting( VEC3 n = normal[dart] ; - MATRIX33 localFrame = Geometry::vertexLocalFrame(map, dart, position, n) ; + MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame(map, dart, position, n) ; MATRIX33 invLocalFrame ; localFrame.invert(invLocalFrame) ; diff --git a/include/Algo/Geometry/localFrame.h b/include/Algo/Geometry/localFrame.h index 0efb7ace0025d846a6031848e63871c92f77b22f..e6a8c39a85041d7fb37d175cf15aaa5564deab7e 100644 --- a/include/Algo/Geometry/localFrame.h +++ b/include/Algo/Geometry/localFrame.h @@ -44,8 +44,8 @@ namespace Geometry template void vertexLocalFrame(typename PFP::MAP& map, Dart d, const VertexAttribute& position, typename PFP::VEC3& X, typename PFP::VEC3& Y, typename PFP::VEC3& Z) { - Z = vertexNormal(map, d, position) ; - X = vectorOutOfDart(map, d, position) ; + Z = Algo::Surface::Geometry::vertexNormal(map, d, position) ; + X = Algo::Surface::Geometry::vectorOutOfDart(map, d, position) ; Y = Z ^ X ; Y.normalize() ; X = Y ^ Z ; @@ -70,7 +70,7 @@ template void vertexLocalFrame(typename PFP::MAP& map, Dart d, const VertexAttribute& position, typename PFP::VEC3& normal, typename PFP::VEC3& X, typename PFP::VEC3& Y, typename PFP::VEC3& Z) { Z = normal ; - X = vectorOutOfDart(map, d, position) ; + X = Algo::Surface::Geometry::vectorOutOfDart(map, d, position) ; Y = Z ^ X ; Y.normalize() ; X = Y ^ Z ; diff --git a/include/Algo/ProgressiveMesh/pmesh.h b/include/Algo/ProgressiveMesh/pmesh.h index 1af104956ce553ad904c0fd4fa258b44e113e3fa..3349fe0202e043460a31b4ab07b87739cfe55cd8 100644 --- a/include/Algo/ProgressiveMesh/pmesh.h +++ b/include/Algo/ProgressiveMesh/pmesh.h @@ -62,13 +62,13 @@ private: DartMarker& inactiveMarker ; SelectorUnmarked dartSelect ; - Algo::Decimation::EdgeSelector* m_selector ; - std::vector*> m_approximators ; - std::vector*> m_predictors ; + Algo::Surface::Decimation::EdgeSelector* m_selector ; + std::vector*> m_approximators ; + std::vector*> m_predictors ; std::vector*> m_splits ; unsigned int m_cur ; - Algo::Decimation::Approximator* m_positionApproximator ; + Algo::Surface::Decimation::Approximator* m_positionApproximator ; bool m_initOk ; @@ -77,12 +77,12 @@ private: std::vector originalDetailVectors ; bool quantizationInitialized, quantizationApplied ; - Quantization* q ; + Algo::PMesh::Quantization* q ; public: ProgressiveMesh( MAP& map, DartMarker& inactive, - Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a, + Algo::Surface::Decimation::SelectorType s, Algo::Surface::Decimation::ApproximatorType a, VertexAttribute& position ) ; ~ProgressiveMesh() ; @@ -92,9 +92,9 @@ public: void createPM(unsigned int percentWantedVertices) ; std::vector*>& splits() { return m_splits ; } - Algo::Decimation::EdgeSelector* selector() { return m_selector ; } - std::vector*>& approximators() { return m_approximators ; } - std::vector*>& predictors() { return m_predictors ; } + Algo::Surface::Decimation::EdgeSelector* selector() { return m_selector ; } + std::vector*>& approximators() { return m_approximators ; } + std::vector*>& predictors() { return m_predictors ; } void edgeCollapse(VSplit* vs) ; void vertexSplit(VSplit* vs) ; diff --git a/include/Algo/ProgressiveMesh/pmesh.hpp b/include/Algo/ProgressiveMesh/pmesh.hpp index e2948c0f163a9794f7f63bfe7d42d5e6c1137d8a..9a466e7caf185f18a4b360ac836f9860464e95a1 100644 --- a/include/Algo/ProgressiveMesh/pmesh.hpp +++ b/include/Algo/ProgressiveMesh/pmesh.hpp @@ -284,7 +284,7 @@ void ProgressiveMesh::refine() typename PFP::MATRIX33 invLocalFrame ; if(m_localFrameDetailVectors) { - typename PFP::MATRIX33 localFrame = Algo::Surface::Geometry::vertexLocalFrame(m_map, dd2, positionsTable) ; + typename PFP::MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame(m_map, dd2, positionsTable) ; localFrame.invert(invLocalFrame) ; } @@ -381,7 +381,7 @@ void ProgressiveMesh::localizeDetailVectors() { Dart d = m_splits[m_cur-1]->getEdge() ; Dart dd2 = m_splits[m_cur-1]->getRightEdge() ; - typename PFP::MATRIX33 localFrame = Algo::Surface::Geometry::vertexLocalFrame(m_map, dd2, positionsTable) ; + typename PFP::MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame(m_map, dd2, positionsTable) ; VEC3 det = m_positionApproximator->getDetail(d) ; det = localFrame * det ; m_positionApproximator->setDetail(d, det) ; @@ -412,7 +412,7 @@ void ProgressiveMesh::globalizeDetailVectors() { Dart d = m_splits[m_cur-1]->getEdge() ; Dart dd2 = m_splits[m_cur-1]->getRightEdge() ; - typename PFP::MATRIX33 localFrame = Algo::Surface::Geometry::vertexLocalFrame(m_map, dd2, positionsTable) ; + typename PFP::MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame(m_map, dd2, positionsTable) ; typename PFP::MATRIX33 invLocalFrame ; localFrame.invert(invLocalFrame) ; VEC3 det = m_positionApproximator->getDetail(d) ; @@ -436,7 +436,7 @@ void ProgressiveMesh::initQuantization() originalDetailVectors.resize(m_splits.size()) ; for(unsigned int i = 0; i < m_splits.size(); ++i) originalDetailVectors[i] = m_positionApproximator->getDetail(m_splits[i]->getEdge(),0) ; - q = new Quantization(originalDetailVectors) ; + q = new Algo::PMesh::Quantization(originalDetailVectors) ; quantizationInitialized = true ; CGoGNout << " Differential Entropy -> " << q->getDifferentialEntropy() << CGoGNendl ; } @@ -575,8 +575,7 @@ void ProgressiveMesh::calculCourbeDebitDistortion() } */ -} //namespace PMesh -} // Surface -} //namespace Algo -} -} //namespace CGoGN +} // namespace PMesh +} // namespace Surface +} // namespace Algo +} // namespace CGoGN diff --git a/include/Algo/Selection/collector.hpp b/include/Algo/Selection/collector.hpp index 1061e463cd0efe254d8a26f5377fb980a760481b..510ab613cb45061421701610a717d8ac8b15f890 100644 --- a/include/Algo/Selection/collector.hpp +++ b/include/Algo/Selection/collector.hpp @@ -150,7 +150,7 @@ typename PFP::REAL Collector_OneRing::computeArea(const VertexAttribute::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it) - area += Algo::Geometry::triangleArea(this->map, *it, pos); + area += Algo::Surface::Geometry::triangleArea(this->map, *it, pos); return area; } @@ -164,7 +164,7 @@ void Collector_OneRing::computeNormalCyclesTensor (const VertexAttribute::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) { - const VEC3 e = Algo::Geometry::vectorOutOfDart(this->map, *it, pos) ; + const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->map, *it, pos) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ; } @@ -180,8 +180,8 @@ void Collector_OneRing::computeNormalCyclesTensor (const VertexAttribute::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) { - const VEC3 e = Algo::Geometry::vectorOutOfDart(this->map, *it, pos) ; - const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge(this->map, *it, pos) ; + const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->map, *it, pos) ; + const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge(this->map, *it, pos) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ; } @@ -256,7 +256,7 @@ typename PFP::REAL Collector_OneRing_AroundEdge::computeArea(const VertexAt REAL area = 0; for (std::vector::const_iterator it = this->insideFaces.begin(); it != this->insideFaces.end(); ++it) - area += Algo::Geometry::triangleArea(this->map, *it, pos); + area += Algo::Surface::Geometry::triangleArea(this->map, *it, pos); return area; } @@ -270,7 +270,7 @@ void Collector_OneRing_AroundEdge::computeNormalCyclesTensor (const VertexA // collect edges inside the neighborhood for (std::vector::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) { - const VEC3 e = Algo::Geometry::vectorOutOfDart(this->map, *it, pos) ; + const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->map, *it, pos) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ; } @@ -286,8 +286,8 @@ void Collector_OneRing_AroundEdge::computeNormalCyclesTensor (const VertexA // collect edges inside the neighborhood for (std::vector::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) { - const VEC3 e = Algo::Geometry::vectorOutOfDart(this->map, *it, pos) ; - const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge(this->map, *it, pos) ; + const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->map, *it, pos) ; + const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge(this->map, *it, pos) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ; } @@ -433,14 +433,14 @@ typename PFP::REAL Collector_WithinSphere::computeArea(const VertexAttribut typename PFP::REAL alpha, beta; Geometry::intersectionSphereEdge(this->map, centerPosition, this->radius, *it, pos, alpha); Geometry::intersectionSphereEdge(this->map, centerPosition, this->radius, this->map.phi2(f), pos, beta); - area += (alpha+beta - alpha*beta) * Algo::Geometry::triangleArea(this->map, *it, pos); + area += (alpha+beta - alpha*beta) * Algo::Surface::Geometry::triangleArea(this->map, *it, pos); } else { // f and g are outside typename PFP::REAL alpha, beta; Geometry::intersectionSphereEdge(this->map, centerPosition, this->radius, *it, pos, alpha); Geometry::intersectionSphereEdge(this->map, centerPosition, this->radius, this->map.phi2(g), pos, beta); - area += alpha * beta * Algo::Geometry::triangleArea(this->map, *it, pos); + area += alpha * beta * Algo::Surface::Geometry::triangleArea(this->map, *it, pos); } } return area; @@ -456,15 +456,15 @@ void Collector_WithinSphere::computeNormalCyclesTensor (const VertexAttribu // collect edges inside the neighborhood for (std::vector::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) { - const VEC3 e = Algo::Geometry::vectorOutOfDart(this->map, *it, pos) ; + const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->map, *it, pos) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) ; } // collect edges crossing the neighborhood's border for (std::vector::const_iterator it = this->border.begin(); it != this->border.end(); ++it) { - const VEC3 e = Algo::Geometry::vectorOutOfDart(this->map, *it, pos) ; + const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->map, *it, pos) ; REAL alpha ; - Algo::Geometry::intersectionSphereEdge(this->map, centerPosition, radius, *it, pos, alpha) ; + Algo::Surface::Geometry::intersectionSphereEdge(this->map, centerPosition, radius, *it, pos, alpha) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle[*it] * (1 / e.norm()) * alpha ; } @@ -482,17 +482,17 @@ void Collector_WithinSphere::computeNormalCyclesTensor (const VertexAttribu // collect edges inside the neighborhood for (std::vector::const_iterator it = this->insideEdges.begin(); it != this->insideEdges.end(); ++it) { - const VEC3 e = Algo::Geometry::vectorOutOfDart(this->map, *it, pos) ; - const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge(this->map, *it, pos) ; + const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->map, *it, pos) ; + const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge(this->map, *it, pos) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) ; } // collect edges crossing the neighborhood's border for (std::vector::const_iterator it = this->border.begin(); it != this->border.end(); ++it) { - const VEC3 e = Algo::Geometry::vectorOutOfDart(this->map, *it, pos) ; + const VEC3 e = Algo::Surface::Geometry::vectorOutOfDart(this->map, *it, pos) ; REAL alpha ; - Algo::Geometry::intersectionSphereEdge(this->map, centerPosition, radius, *it, pos, alpha) ; - const REAL edgeangle = Algo::Geometry::computeAngleBetweenNormalsOnEdge(this->map, *it, pos) ; + Algo::Surface::Geometry::intersectionSphereEdge(this->map, centerPosition, radius, *it, pos, alpha) ; + const REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge(this->map, *it, pos) ; tensor += Geom::transposed_vectors_mult(e,e) * edgeangle * (1 / e.norm()) * alpha ; } diff --git a/include/Topology/generic/functor.h b/include/Topology/generic/functor.h index 2ed7718f1a5530e3320e443b177fc30e2e15926e..bb6d0cc32041cb767d0646cb2c7241d26d5f0ccd 100644 --- a/include/Topology/generic/functor.h +++ b/include/Topology/generic/functor.h @@ -120,6 +120,29 @@ inline SelectorOr operator||(const FunctorSelect& fs1, const FunctorSelect& fs2) return SelectorOr(fs1,fs2); } +template +class SelectorVertexBoundary : public FunctorSelect +{ +public: +protected: + MAP& m_map; +public: + SelectorVertexBoundary(MAP& m): m_map(m) {} + bool operator()(Dart d) const { return m_map.isBoundaryVertex(d); } + FunctorSelect* copy() const { return new SelectorVertexBoundary(m_map);} +}; + +template +class SelectorVertexNoBoundary : public FunctorSelect +{ +public: +protected: + MAP& m_map; +public: + SelectorVertexNoBoundary(MAP& m): m_map(m) {} + bool operator()(Dart d) const { return !m_map.isBoundaryVertex(d); } + FunctorSelect* copy() const { return new SelectorVertexNoBoundary(m_map);} +}; template class SelectorEdgeBoundary : public FunctorSelect diff --git a/src/Topology/map/map3.cpp b/src/Topology/map/map3.cpp index f74a411006b5f5973054b05dff721a935b8445bf..8a808014aa8037666eaf8a6eeb414720e3f7040e 100644 --- a/src/Topology/map/map3.cpp +++ b/src/Topology/map/map3.cpp @@ -1234,25 +1234,40 @@ unsigned int Map3::closeMap() void Map3::reverseOrientation() { + DartAttribute emb0(this, getEmbeddingAttributeVector()) ; + if(emb0.isValid()) + { + DartAttribute new_emb0 = addAttribute("new_EMB_0") ; + for(Dart d = begin(); d != end(); next(d)) + new_emb0[d] = emb0[phi1(d)] ; + + swapAttributes(emb0, new_emb0) ; + removeAttribute(new_emb0) ; + } + DartAttribute n_phi1 = getAttribute("phi1") ; + DartAttribute n_phi_1 = getAttribute("phi_1") ; + swapAttributes(n_phi1, n_phi_1) ; } void Map3::computeDual() { -// unsigned int count = 0; -// CellMarkerNoUnmark cv(*this); -// std::vector v; -// for(Dart d = begin(); d != end(); next(d)) -// { -// if(!cv.isMarked(d) && isBoundaryMarked3(d)) -// { -// ++count; -// v.push_back(d); -// cv.mark(d); -// } -// } -// -// std::cout << "boundary vertices : " << count << std::endl; + unsigned int count = 0; + CellMarkerNoUnmark cv(*this); + std::vector v; + for(Dart d = begin(); d != end(); next(d)) + { + if(!cv.isMarked(d) && isBoundaryMarked3(d)) + { + ++count; + v.push_back(d); + cv.mark(d); + } + } + + cv.unmarkAll(); + + std::cout << "boundary vertices : " << count << std::endl; DartAttribute old_phi1 = getAttribute("phi1") ; DartAttribute old_phi_1 = getAttribute("phi_1") ; @@ -1268,6 +1283,7 @@ void Map3::computeDual() new_phi1[d] = dd ; new_phi_1[dd] = d ; + //Dart ddd = phi3(phi_1(d)); Dart ddd = phi1(phi3(d)); new_phi2[d] = ddd; new_phi2[ddd] = d; @@ -1283,29 +1299,43 @@ void Map3::computeDual() swapEmbeddingContainers(VERTEX, VOLUME) ; -// for(std::vector::iterator it = v.begin() ; it != v.end() ; ++it) -// { -// boundaryUnmarkOrbit(*it); -// } -// -// for(std::vector::iterator it = v.begin() ; it != v.end() ; ++it) -// { -// deleteVolume(*it); -// } -// -// closeMap(); +// reverseOrientation(); - //boundary management - for(Dart d = begin(); d != end(); next(d)) - { - if(isBoundaryMarked3(d)) + for(std::vector::iterator it = v.begin() ; it != v.end() ; ++it) { - boundaryMarkOrbit(deleteVertex(phi1(d))); -// boundaryUnmarkOrbit(d); -// deleteVolume(d); + boundaryUnmarkOrbit(*it); } - } -// closeMap(); + + for(std::vector::iterator it = v.begin() ; it != v.end() ; ++it) + { + deleteVolume(*it); + } + +// std::cout << "boundary faces : " << closeMap() << std::endl; + +// //boundary management +// for(Dart d = begin(); d != end(); next(d)) +// { +// if(isBoundaryMarked3(d)) +// { +// //Dart dit = deleteVertex(phi3(d)); +// //deleteVolume(phi3(d)); +// //if(dit == NIL) +// //{ +// // std::cout << "ploooooooooooooooooooop" << std::endl; +// // return; +// //} +// //else +// //{ +// // std::cout << "gooooooooooooooooooooood" << std::endl; +// // boundaryMarkOrbit(dit); +// // return; +// //} +// //boundaryUnmarkOrbit(d); +// //deleteVolume(d); +// } +// } + } } // namespace CGoGN