From 8ed7b2efc6ffea6954d33dad2197283dd5fdbd1f Mon Sep 17 00:00:00 2001 From: El Hadi Moussi Date: Wed, 7 Aug 2024 09:36:39 +0200 Subject: [PATCH] Add MainDirections to Nodes --- src/ShapeRecogn/NodeCurvatureCalculator.cxx | 4 ++++ src/ShapeRecogn/Nodes.cxx | 12 ++++++++++++ src/ShapeRecogn/Nodes.hxx | 3 +++ 3 files changed, 19 insertions(+) diff --git a/src/ShapeRecogn/NodeCurvatureCalculator.cxx b/src/ShapeRecogn/NodeCurvatureCalculator.cxx index 22fda87ae..ae4238629 100644 --- a/src/ShapeRecogn/NodeCurvatureCalculator.cxx +++ b/src/ShapeRecogn/NodeCurvatureCalculator.cxx @@ -82,6 +82,7 @@ void NodeCurvatureCalculator::computeCurvatures(double tol) nodes->kdiff0.resize(nbNodes); nodes->primitives.resize(nbNodes); nodes->weakDirections.resize(3 * nbNodes); + nodes->mainDirections.resize(3 * nbNodes); for (mcIdType nodeId = 0; nodeId < nbNodes; nodeId++) computeCurvatures(nodeId, tol); } @@ -152,7 +153,10 @@ void NodeCurvatureCalculator::computeCurvatures(mcIdType nodeId, double tol) nodes->k2[nodeId] = k2; nodes->kdiff0[nodeId] = kdiff0; for (size_t i = 0; i < 3; ++i) + { nodes->weakDirections[3 * nodeId + i] = weakDirection[i]; + nodes->mainDirections[3 * nodeId + i] = mainDirection[i]; + } nodes->primitives[nodeId] = primitive; } diff --git a/src/ShapeRecogn/Nodes.cxx b/src/ShapeRecogn/Nodes.cxx index 845e48b5e..31610b3d8 100644 --- a/src/ShapeRecogn/Nodes.cxx +++ b/src/ShapeRecogn/Nodes.cxx @@ -32,6 +32,11 @@ const std::vector &Nodes::getWeakDirections() const return weakDirections; } +const std::vector &Nodes::getMainDirections() const +{ + return mainDirections; +} + const std::vector &Nodes::getK1() const { return k1; @@ -80,6 +85,13 @@ std::array Nodes::getWeakDirection(mcIdType nodeId) const weakDirections[3 * nodeId + 2]}; } +std::array Nodes::getMainDirection(mcIdType nodeId) const +{ + return {mainDirections[3 * nodeId], + mainDirections[3 * nodeId + 1], + mainDirections[3 * nodeId + 2]}; +} + std::array Nodes::getCoordinates(mcIdType nodeId) const { std::array nodeCoords; diff --git a/src/ShapeRecogn/Nodes.hxx b/src/ShapeRecogn/Nodes.hxx index ed8d267c2..ef06d1540 100644 --- a/src/ShapeRecogn/Nodes.hxx +++ b/src/ShapeRecogn/Nodes.hxx @@ -38,6 +38,7 @@ namespace MEDCoupling mcIdType getNbNodes() const; const std::vector &getNormals() const; const std::vector &getWeakDirections() const; + const std::vector &getMainDirections() const; const std::vector &getK1() const; std::array getNormal(mcIdType nodeId) const; @@ -47,6 +48,7 @@ namespace MEDCoupling const std::vector getNeighbors(mcIdType nodeId) const; PrimitiveType getPrimitiveType(mcIdType nodeId) const; std::array getWeakDirection(mcIdType nodeId) const; + std::array getMainDirection(mcIdType nodeId) const; std::array getCoordinates(mcIdType nodeId) const; private: @@ -64,6 +66,7 @@ namespace MEDCoupling std::vector k2; std::vector kdiff0; std::vector weakDirections; + std::vector mainDirections; std::vector primitives; }; }; -- 2.39.2