From 71132611a40d12385d4f4ad7779bb85e83009ef2 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Mon, 2 Jun 2014 14:46:20 +0200 Subject: [PATCH] [MeshLib/NumLib] MathLib::calcTriangleArea() -> GeoLib::calcTriangleArea(). --- MeshLib/Elements/TemplateQuad-impl.h | 4 ++-- MeshLib/Elements/TemplateTri.h | 3 ++- NumLib/Function/LinearInterpolationOnSurface.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/MeshLib/Elements/TemplateQuad-impl.h b/MeshLib/Elements/TemplateQuad-impl.h index afd624856b4..fff57263617 100644 --- a/MeshLib/Elements/TemplateQuad-impl.h +++ b/MeshLib/Elements/TemplateQuad-impl.h @@ -90,8 +90,8 @@ TemplateQuad<NNODES,CELLQUADTYPE>::~TemplateQuad() template <unsigned NNODES, CellType CELLQUADTYPE> double TemplateQuad<NNODES,CELLQUADTYPE>::computeVolume() { - return MathLib::calcTriangleArea(_nodes[0]->getCoords(), _nodes[1]->getCoords(), _nodes[2]->getCoords()) - + MathLib::calcTriangleArea(_nodes[2]->getCoords(), _nodes[3]->getCoords(), _nodes[0]->getCoords()); + return GeoLib::calcTriangleArea(*_nodes[0], *_nodes[1], *_nodes[2]) + + GeoLib::calcTriangleArea(*_nodes[2], *_nodes[3], *_nodes[0]); } template <unsigned NNODES, CellType CELLQUADTYPE> diff --git a/MeshLib/Elements/TemplateTri.h b/MeshLib/Elements/TemplateTri.h index a0c05f27d38..c91290193e2 100644 --- a/MeshLib/Elements/TemplateTri.h +++ b/MeshLib/Elements/TemplateTri.h @@ -22,6 +22,7 @@ #include "MeshEnums.h" #include "MathTools.h" +#include "AnalyticalGeometry.h" namespace MeshLib { @@ -121,7 +122,7 @@ protected: /// Calculates the area of the triangle by returning half of the area of the corresponding parallelogram. double computeVolume() { - return MathLib::calcTriangleArea(_nodes[0]->getCoords(), _nodes[1]->getCoords(), _nodes[2]->getCoords()); + return GeoLib::calcTriangleArea(*_nodes[0], *_nodes[1], *_nodes[2]); } protected: diff --git a/NumLib/Function/LinearInterpolationOnSurface.cpp b/NumLib/Function/LinearInterpolationOnSurface.cpp index d71716a7b85..18aa67f09ae 100644 --- a/NumLib/Function/LinearInterpolationOnSurface.cpp +++ b/NumLib/Function/LinearInterpolationOnSurface.cpp @@ -70,10 +70,10 @@ double LinearInterpolationOnSurface::interpolateInTri(const GeoLib::Triangle &tr std::vector<GeoLib::Point*> p_pnts = {{&pnts[0], &pnts[1], &pnts[2]}}; GeoLib::rotatePointsToXY(p_pnts); - const double* v1 = pnts[0].getCoords(); - const double* v2 = pnts[1].getCoords(); - const double* v3 = pnts[2].getCoords(); - const double area = MathLib::calcTriangleArea(v1, v2, v3); + GeoLib::Point const& v1(pnts[0]); + GeoLib::Point const& v2(pnts[1]); + GeoLib::Point const& v3(pnts[2]); + const double area = GeoLib::calcTriangleArea(v1, v2, v3); if (area==.0) { // take average if all points have the same coordinates -- GitLab