Skip to content
Snippets Groups Projects
Commit 71132611 authored by Tom Fischer's avatar Tom Fischer
Browse files

[MeshLib/NumLib] MathLib::calcTriangleArea() -> GeoLib::calcTriangleArea().

parent 2e764574
No related branches found
No related tags found
No related merge requests found
...@@ -90,8 +90,8 @@ TemplateQuad<NNODES,CELLQUADTYPE>::~TemplateQuad() ...@@ -90,8 +90,8 @@ TemplateQuad<NNODES,CELLQUADTYPE>::~TemplateQuad()
template <unsigned NNODES, CellType CELLQUADTYPE> template <unsigned NNODES, CellType CELLQUADTYPE>
double TemplateQuad<NNODES,CELLQUADTYPE>::computeVolume() double TemplateQuad<NNODES,CELLQUADTYPE>::computeVolume()
{ {
return MathLib::calcTriangleArea(_nodes[0]->getCoords(), _nodes[1]->getCoords(), _nodes[2]->getCoords()) return GeoLib::calcTriangleArea(*_nodes[0], *_nodes[1], *_nodes[2])
+ MathLib::calcTriangleArea(_nodes[2]->getCoords(), _nodes[3]->getCoords(), _nodes[0]->getCoords()); + GeoLib::calcTriangleArea(*_nodes[2], *_nodes[3], *_nodes[0]);
} }
template <unsigned NNODES, CellType CELLQUADTYPE> template <unsigned NNODES, CellType CELLQUADTYPE>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "MeshEnums.h" #include "MeshEnums.h"
#include "MathTools.h" #include "MathTools.h"
#include "AnalyticalGeometry.h"
namespace MeshLib { namespace MeshLib {
...@@ -121,7 +122,7 @@ protected: ...@@ -121,7 +122,7 @@ protected:
/// Calculates the area of the triangle by returning half of the area of the corresponding parallelogram. /// Calculates the area of the triangle by returning half of the area of the corresponding parallelogram.
double computeVolume() double computeVolume()
{ {
return MathLib::calcTriangleArea(_nodes[0]->getCoords(), _nodes[1]->getCoords(), _nodes[2]->getCoords()); return GeoLib::calcTriangleArea(*_nodes[0], *_nodes[1], *_nodes[2]);
} }
protected: protected:
......
...@@ -70,10 +70,10 @@ double LinearInterpolationOnSurface::interpolateInTri(const GeoLib::Triangle &tr ...@@ -70,10 +70,10 @@ double LinearInterpolationOnSurface::interpolateInTri(const GeoLib::Triangle &tr
std::vector<GeoLib::Point*> p_pnts = {{&pnts[0], &pnts[1], &pnts[2]}}; std::vector<GeoLib::Point*> p_pnts = {{&pnts[0], &pnts[1], &pnts[2]}};
GeoLib::rotatePointsToXY(p_pnts); GeoLib::rotatePointsToXY(p_pnts);
const double* v1 = pnts[0].getCoords(); GeoLib::Point const& v1(pnts[0]);
const double* v2 = pnts[1].getCoords(); GeoLib::Point const& v2(pnts[1]);
const double* v3 = pnts[2].getCoords(); GeoLib::Point const& v3(pnts[2]);
const double area = MathLib::calcTriangleArea(v1, v2, v3); const double area = GeoLib::calcTriangleArea(v1, v2, v3);
if (area==.0) { if (area==.0) {
// take average if all points have the same coordinates // take average if all points have the same coordinates
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment