From 14dbcc9b018664854f599d6c82e5f1d921594018 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri, 20 Nov 2020 13:15:04 +0100 Subject: [PATCH] Use sqrDist that has MathLib::Point3d arguments. --- GeoLib/MinimalBoundingSphere.cpp | 2 +- MeshGeoToolsLib/MeshNodeSearcher.cpp | 4 +--- MeshLib/Elements/LineRule2.cpp | 2 +- MeshLib/MeshEditing/MeshRevision.cpp | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/GeoLib/MinimalBoundingSphere.cpp b/GeoLib/MinimalBoundingSphere.cpp index b29448a77d2..7f99bc9f607 100644 --- a/GeoLib/MinimalBoundingSphere.cpp +++ b/GeoLib/MinimalBoundingSphere.cpp @@ -182,7 +182,7 @@ MinimalBoundingSphere::recurseCalculation( double MinimalBoundingSphere::pointDistanceSquared(MathLib::Point3d const& pnt) const { - return MathLib::sqrDist(_center.getCoords(), pnt.getCoords())-(_radius*_radius); + return MathLib::sqrDist(_center, pnt)-(_radius*_radius); } std::vector<MathLib::Point3d*>* MinimalBoundingSphere::getRandomSpherePoints(std::size_t n_points) const diff --git a/MeshGeoToolsLib/MeshNodeSearcher.cpp b/MeshGeoToolsLib/MeshNodeSearcher.cpp index 5afc280eb6d..7887ba457ad 100644 --- a/MeshGeoToolsLib/MeshNodeSearcher.cpp +++ b/MeshGeoToolsLib/MeshNodeSearcher.cpp @@ -163,9 +163,7 @@ std::vector<std::size_t> MeshNodeSearcher::getMeshNodeIDs( ss << "- bulk node: " << (*bulk_nodes[id])[0] << ", " << (*bulk_nodes[id])[1] << ", " << (*bulk_nodes[id])[2] << ", distance: " - << std::sqrt(MathLib::sqrDist(bulk_nodes[id]->getCoords(), - p.getCoords())) - << "\n"; + << std::sqrt(MathLib::sqrDist(*bulk_nodes[id], p)) << "\n"; } OGS_FATAL( "Found {:d} nodes in the mesh for point {:d} : ({:g}, {:g}, " diff --git a/MeshLib/Elements/LineRule2.cpp b/MeshLib/Elements/LineRule2.cpp index 7ff5e1f01d8..373a8ef4b8b 100644 --- a/MeshLib/Elements/LineRule2.cpp +++ b/MeshLib/Elements/LineRule2.cpp @@ -21,7 +21,7 @@ const unsigned LineRule2::edge_nodes[1][2] = double LineRule2::computeVolume(Node const* const* _nodes) { - return sqrt(MathLib::sqrDist(_nodes[0]->getCoords(), _nodes[1]->getCoords())); + return sqrt(MathLib::sqrDist(*_nodes[0], *_nodes[1])); } bool LineRule2::isPntInElement(Node const* const* nodes, diff --git a/MeshLib/MeshEditing/MeshRevision.cpp b/MeshLib/MeshEditing/MeshRevision.cpp index 7783ff84722..3815dc5ff6c 100644 --- a/MeshLib/MeshEditing/MeshRevision.cpp +++ b/MeshLib/MeshEditing/MeshRevision.cpp @@ -179,8 +179,7 @@ std::vector<std::size_t> MeshRevision::collapseNodeIndices(double eps) const } // calc distance - if (MathLib::sqrDist(node->getCoords(), - test_node->getCoords()) < sqr_eps) + if (MathLib::sqrDist(*node, *test_node) < sqr_eps) { id_map[test_node->getID()] = node->getID(); } -- GitLab