diff --git a/Applications/DataExplorer/DataView/GeoMapper.cpp b/Applications/DataExplorer/DataView/GeoMapper.cpp index 125d837586597cd2038a6e2fed2eb11ea8b88b3a..0cdabd1fc80ea77d628c65b7e1436befb14db598 100644 --- a/Applications/DataExplorer/DataView/GeoMapper.cpp +++ b/Applications/DataExplorer/DataView/GeoMapper.cpp @@ -302,7 +302,7 @@ void GeoMapper::advancedMapOnMesh(const MeshLib::Mesh* mesh, const std::string & this->mapOnMesh(mesh); } -GeoLib::Point* GeoMapper::calcIntersection(MathLib::MathPoint const*const p1, MathLib::MathPoint const*const p2, GeoLib::Point const*const q1, GeoLib::Point const*const q2) const +GeoLib::Point* GeoMapper::calcIntersection(MathLib::Point3d const*const p1, MathLib::Point3d const*const p2, GeoLib::Point const*const q1, GeoLib::Point const*const q2) const { const double x1 = (*p1)[0], x2 = (*p2)[0], x3 = (*q1)[0], x4 = (*q2)[0]; const double y1 = (*p1)[1], y2 = (*p2)[1], y3 = (*q1)[1], y4 = (*q2)[1]; diff --git a/Applications/DataExplorer/DataView/GeoMapper.h b/Applications/DataExplorer/DataView/GeoMapper.h index 8f90a4070c662e15caad07aec7b8914b28319b62..4167c7262a4363e3a106b56a10e486508009485c 100644 --- a/Applications/DataExplorer/DataView/GeoMapper.h +++ b/Applications/DataExplorer/DataView/GeoMapper.h @@ -23,7 +23,7 @@ #include "Grid.h" // MathLib -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" namespace MeshLib { class Mesh; @@ -63,7 +63,7 @@ private: float getDemElevation(GeoLib::Point const& pnt) const; // Calculates the intersection of two lines embedded in the xy-plane - GeoLib::Point* calcIntersection(MathLib::MathPoint const*const p1, MathLib::MathPoint const*const p2, GeoLib::Point const*const q1, GeoLib::Point const*const q2) const; + GeoLib::Point* calcIntersection(MathLib::Point3d const*const p1, MathLib::Point3d const*const p2, GeoLib::Point const*const q1, GeoLib::Point const*const q2) const; // Returns the position of a point within a line-segment unsigned getPointPosInLine(GeoLib::Polyline const*const line, unsigned start, unsigned end, GeoLib::Point const*const point, double eps) const; diff --git a/GeoLib/AnalyticalGeometry.cpp b/GeoLib/AnalyticalGeometry.cpp index eda68f3dd3707d30279b1bc2045bcd6d4b9807e1..23cb1be843094482bb32b4a49e06408eb8fd54fb 100644 --- a/GeoLib/AnalyticalGeometry.cpp +++ b/GeoLib/AnalyticalGeometry.cpp @@ -199,10 +199,10 @@ bool lineSegmentsIntersect(const GeoLib::Polyline* ply, return false; } -bool isPointInTriangle(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c, +bool isPointInTriangle(MathLib::Point3d const& p, + MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri, GeoLib::TriangleTest algorithm) @@ -219,10 +219,10 @@ bool isPointInTriangle(MathLib::MathPoint const& p, return gaussPointInTriangle(p, a, b, c, eps_pnt_out_of_plane, eps_pnt_out_of_tri); } -bool gaussPointInTriangle(MathLib::MathPoint const& q, - MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c, +bool gaussPointInTriangle(MathLib::Point3d const& q, + MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri) { @@ -247,7 +247,7 @@ bool gaussPointInTriangle(MathLib::MathPoint const& q, if (-lower <= y[0] && y[0] <= upper && -lower <= y[1] && y[1] <= upper && y[0] + y[1] <= upper) { - MathLib::MathPoint const q_projected(std::array<double,3>{{ + MathLib::Point3d const q_projected(std::array<double,3>{{ a[0] + y[0] * v[0] + y[1] * w[0], a[1] + y[0] * v[1] + y[1] * w[1], a[2] + y[0] * v[2] + y[1] * w[2] @@ -259,10 +259,10 @@ bool gaussPointInTriangle(MathLib::MathPoint const& q, return false; } -bool barycentricPointInTriangle(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c, +bool barycentricPointInTriangle(MathLib::Point3d const& p, + MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri) { @@ -286,9 +286,9 @@ bool barycentricPointInTriangle(MathLib::MathPoint const& p, return true; } -bool isPointInTetrahedron(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, MathLib::MathPoint const& b, - MathLib::MathPoint const& c, MathLib::MathPoint const& d, double eps) +bool isPointInTetrahedron(MathLib::Point3d const& p, + MathLib::Point3d const& a, MathLib::Point3d const& b, + MathLib::Point3d const& c, MathLib::Point3d const& d, double eps) { double const d0 (orientation3d(d,a,b,c)); // if tetrahedron is not coplanar @@ -316,8 +316,8 @@ bool isPointInTetrahedron(MathLib::MathPoint const& p, return false; } -double calcTriangleArea(MathLib::MathPoint const& a, - MathLib::MathPoint const& b, MathLib::MathPoint const& c) +double calcTriangleArea(MathLib::Point3d const& a, + MathLib::Point3d const& b, MathLib::Point3d const& c) { MathLib::Vector3 const u(a,c); MathLib::Vector3 const v(a,b); @@ -453,7 +453,7 @@ void rotatePointsToXZ(std::vector<GeoLib::Point*> &pnts) (*(pnts[k]))[1] = 0.0; // should be -= d but there are numerical errors } -GeoLib::Point* triangleLineIntersection(MathLib::MathPoint const& a, MathLib::MathPoint const& b, MathLib::MathPoint const& c, MathLib::MathPoint const& p, MathLib::MathPoint const& q) +GeoLib::Point* triangleLineIntersection(MathLib::Point3d const& a, MathLib::Point3d const& b, MathLib::Point3d const& c, MathLib::Point3d const& p, MathLib::Point3d const& q) { const MathLib::Vector3 pq(p, q); const MathLib::Vector3 pa(p, a); @@ -480,10 +480,10 @@ double scalarTriple(MathLib::Vector3 const& u, MathLib::Vector3 const& v, MathLi return MathLib::scalarProduct(cross,w); } -double orientation3d(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c) +double orientation3d(MathLib::Point3d const& p, + MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c) { MathLib::Vector3 const ap (a, p); MathLib::Vector3 const bp (b, p); @@ -491,8 +491,8 @@ double orientation3d(MathLib::MathPoint const& p, return scalarTriple(bp,cp,ap); } -bool dividedByPlane(const MathLib::MathPoint& a, const MathLib::MathPoint& b, - const MathLib::MathPoint& c, const MathLib::MathPoint& d) +bool dividedByPlane(const MathLib::Point3d& a, const MathLib::Point3d& b, + const MathLib::Point3d& c, const MathLib::Point3d& d) { for (unsigned x=0; x<3; ++x) { @@ -506,8 +506,8 @@ bool dividedByPlane(const MathLib::MathPoint& a, const MathLib::MathPoint& b, return false; } -bool isCoplanar(const MathLib::MathPoint& a, const MathLib::MathPoint& b, - const MathLib::MathPoint& c, const MathLib::MathPoint& d) +bool isCoplanar(const MathLib::Point3d& a, const MathLib::Point3d& b, + const MathLib::Point3d& c, const MathLib::Point3d& d) { const MathLib::Vector3 ab(a,b); const MathLib::Vector3 ac(a,c); diff --git a/GeoLib/AnalyticalGeometry.h b/GeoLib/AnalyticalGeometry.h index 7561a45e5afbd65d3ab2a05224d4cf0944a7072d..1aa44c198b6c20c3590138bb8e635213257ddde3 100644 --- a/GeoLib/AnalyticalGeometry.h +++ b/GeoLib/AnalyticalGeometry.h @@ -108,8 +108,8 @@ void rotatePointsToXZ(std::vector<GeoLib::Point*> &pnts); * The formula is \f$A= \frac{1}{2} \cdot |u \times v|\f$, i.e. half of the area of the * parallelogram specified by the vectors\f$u=b-a\f$ and \f$v=c-a\f$. */ -double calcTriangleArea(MathLib::MathPoint const& a, MathLib::MathPoint const& b, - MathLib::MathPoint const& c); +double calcTriangleArea(MathLib::Point3d const& a, MathLib::Point3d const& b, + MathLib::Point3d const& c); /** * Calculates the volume of a tetrahedron. @@ -130,10 +130,10 @@ double calcTetrahedronVolume(const double* x1, const double* x2, const double* x * @param algorithm defines the method to use * @return true if the test point p is within the 'epsilon'-neighbourhood of the triangle */ -bool isPointInTriangle(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c, +bool isPointInTriangle(MathLib::Point3d const& p, + MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c, double eps_pnt_out_of_plane = std::numeric_limits<float>::epsilon(), double eps_pnt_out_of_tri = std::numeric_limits<float>::epsilon(), GeoLib::TriangleTest algorithm = GeoLib::GAUSS); @@ -151,9 +151,9 @@ bool isPointInTriangle(MathLib::MathPoint const& p, * @param eps_pnt_out_of_tri eps allowing for p to be slightly off outside of abc * @return true if the test point p is within the 'epsilon'-neighbourhood of the triangle */ -bool gaussPointInTriangle(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, MathLib::MathPoint const& b, - MathLib::MathPoint const& c, +bool gaussPointInTriangle(MathLib::Point3d const& p, + MathLib::Point3d const& a, MathLib::Point3d const& b, + MathLib::Point3d const& c, double eps_pnt_out_of_plane = std::numeric_limits<float>::epsilon(), double eps_pnt_out_of_tri = std::numeric_limits<float>::epsilon()); @@ -170,9 +170,9 @@ bool gaussPointInTriangle(MathLib::MathPoint const& p, * @param eps_pnt_out_of_tri eps allowing for p to be slightly off outside of abc * @return true if the test point p is within the 'epsilon'-neighbourhood of the triangle */ -bool barycentricPointInTriangle(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, MathLib::MathPoint const& b, - MathLib::MathPoint const& c, +bool barycentricPointInTriangle(MathLib::Point3d const& p, + MathLib::Point3d const& a, MathLib::Point3d const& b, + MathLib::Point3d const& c, double eps_pnt_out_of_plane = std::numeric_limits<float>::epsilon(), double eps_pnt_out_of_tri = std::numeric_limits<float>::epsilon()); @@ -188,9 +188,9 @@ bool barycentricPointInTriangle(MathLib::MathPoint const& p, * @param eps Accounts for numerical inaccuracies by allowing a point to be slightly outside of the element and still be regarded as inside. * @return true if the test point p is not located outside of abcd (i.e. inside or on a plane/edge). */ -bool isPointInTetrahedron(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, MathLib::MathPoint const& b, - MathLib::MathPoint const& c, MathLib::MathPoint const& d, +bool isPointInTetrahedron(MathLib::Point3d const& p, + MathLib::Point3d const& a, MathLib::Point3d const& b, + MathLib::Point3d const& c, MathLib::Point3d const& d, double eps = std::numeric_limits<double>::epsilon()); /** @@ -232,7 +232,7 @@ bool lineSegmentIntersect (const GeoLib::Point& a, const GeoLib::Point& b, * This method requires ABC to be counterclockwise and PQ to point downward. * @return Intersection point or NULL if there is no intersection. */ -GeoLib::Point* triangleLineIntersection(MathLib::MathPoint const& a, MathLib::MathPoint const& b, MathLib::MathPoint const& c, MathLib::MathPoint const& p, MathLib::MathPoint const& q); +GeoLib::Point* triangleLineIntersection(MathLib::Point3d const& a, MathLib::Point3d const& b, MathLib::Point3d const& c, MathLib::Point3d const& p, MathLib::Point3d const& q); /// Calculates the scalar triple (u x v) . w double scalarTriple(MathLib::Vector3 const& u, MathLib::Vector3 const& v, MathLib::Vector3 const& w); @@ -246,10 +246,10 @@ double scalarTriple(MathLib::Vector3 const& u, MathLib::Vector3 const& v, MathLi * @return If the triangle abc is ordered counterclockwise when viewed from p, the method will return a negative value, * otherwise it will return a positive value. If p is coplanar with abc, the function will return 0. */ -double orientation3d(MathLib::MathPoint const& p, - MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c); +double orientation3d(MathLib::Point3d const& p, + MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c); /** * Checks if a and b can be placed on a plane such that c and d lie on different sides of said plane. @@ -260,12 +260,12 @@ double orientation3d(MathLib::MathPoint const& p, * @param d second point to test * @return true, if such a plane can be found, false otherwise */ - bool dividedByPlane(const MathLib::MathPoint& a, const MathLib::MathPoint& b, - const MathLib::MathPoint& c, const MathLib::MathPoint& d); + bool dividedByPlane(const MathLib::Point3d& a, const MathLib::Point3d& b, + const MathLib::Point3d& c, const MathLib::Point3d& d); /// Checks if the four given points are located on a plane. - bool isCoplanar(const MathLib::MathPoint& a, const MathLib::MathPoint& b, - const MathLib::MathPoint& c, const MathLib::MathPoint & d); + bool isCoplanar(const MathLib::Point3d& a, const MathLib::Point3d& b, + const MathLib::Point3d& c, const MathLib::Point3d & d); /** * Method first computes the intersection points of line segements of GeoLib::Polyline objects diff --git a/GeoLib/MinimalBoundingSphere.cpp b/GeoLib/MinimalBoundingSphere.cpp index b2fef2cda1b94e1d5397d2ff63d82b538cb3bb11..a85dd08dfc1cac130a7c7d6a69124c28e89b72ca 100644 --- a/GeoLib/MinimalBoundingSphere.cpp +++ b/GeoLib/MinimalBoundingSphere.cpp @@ -27,13 +27,13 @@ MinimalBoundingSphere::MinimalBoundingSphere() } MinimalBoundingSphere::MinimalBoundingSphere( - MathLib::MathPoint const& p, double radius) + MathLib::Point3d const& p, double radius) : _radius(radius), _center(p) { } MinimalBoundingSphere::MinimalBoundingSphere( - MathLib::MathPoint const& p, MathLib::MathPoint const& q) + MathLib::Point3d const& p, MathLib::Point3d const& q) : _radius(std::numeric_limits<double>::epsilon()), _center(p) { MathLib::Vector3 const a(p, q); @@ -46,8 +46,8 @@ MinimalBoundingSphere::MinimalBoundingSphere( } } -MinimalBoundingSphere::MinimalBoundingSphere(MathLib::MathPoint const& p, - MathLib::MathPoint const& q, MathLib::MathPoint const& r) +MinimalBoundingSphere::MinimalBoundingSphere(MathLib::Point3d const& p, + MathLib::Point3d const& q, MathLib::Point3d const& r) { MathLib::Vector3 const a(p,r); MathLib::Vector3 const b(p,q); @@ -75,10 +75,10 @@ MinimalBoundingSphere::MinimalBoundingSphere(MathLib::MathPoint const& p, } } -MinimalBoundingSphere::MinimalBoundingSphere(MathLib::MathPoint const& p, - MathLib::MathPoint const& q, - MathLib::MathPoint const& r, - MathLib::MathPoint const& s) +MinimalBoundingSphere::MinimalBoundingSphere(MathLib::Point3d const& p, + MathLib::Point3d const& q, + MathLib::Point3d const& r, + MathLib::Point3d const& s) { MathLib::Vector3 const a(p, q); MathLib::Vector3 const b(p, r); @@ -122,10 +122,10 @@ MinimalBoundingSphere::MinimalBoundingSphere(MathLib::MathPoint const& p, } MinimalBoundingSphere::MinimalBoundingSphere( - std::vector<MathLib::MathPoint*> const& points) + std::vector<MathLib::Point3d*> const& points) : _radius(-1), _center(0,0,0) { - std::vector<MathLib::MathPoint*> sphere_points(points); + std::vector<MathLib::Point3d*> sphere_points(points); MinimalBoundingSphere const bounding_sphere = recurseCalculation(sphere_points, 0, sphere_points.size(), 0); _center = bounding_sphere.getCenter(); _radius = bounding_sphere.getRadius(); @@ -133,7 +133,7 @@ MinimalBoundingSphere::MinimalBoundingSphere( MinimalBoundingSphere MinimalBoundingSphere::recurseCalculation( - std::vector<MathLib::MathPoint*> sphere_points, + std::vector<MathLib::Point3d*> sphere_points, std::size_t start_idx, std::size_t length, std::size_t n_boundary_points) @@ -165,7 +165,7 @@ MinimalBoundingSphere::recurseCalculation( { if (i>start_idx) { - MathLib::MathPoint* tmp = sphere_points[start_idx+i]; + MathLib::Point3d* tmp = sphere_points[start_idx+i]; std::copy(sphere_points.begin() + start_idx, sphere_points.begin() + (start_idx + i), sphere_points.begin() + (start_idx + 1)); @@ -177,14 +177,14 @@ MinimalBoundingSphere::recurseCalculation( return sphere; } -double MinimalBoundingSphere::pointDistanceSquared(MathLib::MathPoint const& pnt) const +double MinimalBoundingSphere::pointDistanceSquared(MathLib::Point3d const& pnt) const { return MathLib::sqrDist(_center.getCoords(), pnt.getCoords())-(_radius*_radius); } -std::vector<MathLib::MathPoint*>* MinimalBoundingSphere::getRandomSpherePoints(std::size_t n_points) const +std::vector<MathLib::Point3d*>* MinimalBoundingSphere::getRandomSpherePoints(std::size_t n_points) const { - std::vector<MathLib::MathPoint*> *pnts = new std::vector<MathLib::MathPoint*>; + std::vector<MathLib::Point3d*> *pnts = new std::vector<MathLib::Point3d*>; pnts->reserve(n_points); srand ( static_cast<unsigned>(time(NULL)) ); @@ -198,7 +198,7 @@ std::vector<MathLib::MathPoint*>* MinimalBoundingSphere::getRandomSpherePoints(s sum+=(vec[i]*vec[i]); } double const fac (_radius/sqrt(sum)); - pnts->push_back(new MathLib::MathPoint(_center+fac * vec)); + pnts->push_back(new MathLib::Point3d(_center+fac * vec)); } return pnts; } diff --git a/GeoLib/MinimalBoundingSphere.h b/GeoLib/MinimalBoundingSphere.h index 6b934d1682e10f9895b24d75b23bae81161b7b74..3d86fed4af2722e8117f3df5b96712641e0e6971 100644 --- a/GeoLib/MinimalBoundingSphere.h +++ b/GeoLib/MinimalBoundingSphere.h @@ -19,7 +19,7 @@ #include <vector> #include "MathLib/Vector3.h" -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" namespace GeoLib { @@ -33,32 +33,32 @@ public: /// Copy constructor MinimalBoundingSphere(MinimalBoundingSphere const&) = default; /// Point-Sphere - MinimalBoundingSphere(MathLib::MathPoint const& p, double radius = std::numeric_limits<double>::epsilon()); + MinimalBoundingSphere(MathLib::Point3d const& p, double radius = std::numeric_limits<double>::epsilon()); /// Bounding sphere using two points - MinimalBoundingSphere(MathLib::MathPoint const& p, MathLib::MathPoint const& q); + MinimalBoundingSphere(MathLib::Point3d const& p, MathLib::Point3d const& q); /// Bounding sphere using three points - MinimalBoundingSphere(MathLib::MathPoint const& p, - MathLib::MathPoint const& q, MathLib::MathPoint const& r); + MinimalBoundingSphere(MathLib::Point3d const& p, + MathLib::Point3d const& q, MathLib::Point3d const& r); /// Bounding sphere using four points - MinimalBoundingSphere(MathLib::MathPoint const& p, - MathLib::MathPoint const& q, - MathLib::MathPoint const& r, - MathLib::MathPoint const& s); + MinimalBoundingSphere(MathLib::Point3d const& p, + MathLib::Point3d const& q, + MathLib::Point3d const& r, + MathLib::Point3d const& s); /// Bounding sphere of n points - MinimalBoundingSphere(std::vector<MathLib::MathPoint*> const& points); + MinimalBoundingSphere(std::vector<MathLib::Point3d*> const& points); ~MinimalBoundingSphere() {} /// Returns the center point of the sphere - MathLib::MathPoint getCenter() const { return MathLib::MathPoint(_center.getCoords()); } + MathLib::Point3d getCenter() const { return MathLib::Point3d(_center.getCoords()); } /// Returns the radius of the sphere double getRadius() const {return _radius; } /// Returns the squared euclidean distance of a point from the sphere (for points within the sphere distance is negative) - double pointDistanceSquared(MathLib::MathPoint const& pnt) const; + double pointDistanceSquared(MathLib::Point3d const& pnt) const; /// Creates n_points random points located on the surface of the bounding sphere (useful for visualisation) - std::vector<MathLib::MathPoint*>* + std::vector<MathLib::Point3d*>* getRandomSpherePoints(std::size_t n_points) const; private: @@ -79,7 +79,7 @@ private: * Code based on "Smallest Enclosing Spheres" implementation by Nicolas Capens on flipcode's Developer Toolbox (www.flipcode.com) */ static MinimalBoundingSphere recurseCalculation( - std::vector<MathLib::MathPoint*> sphere_points, + std::vector<MathLib::Point3d*> sphere_points, std::size_t start_idx, std::size_t length, std::size_t n_boundary_points); diff --git a/GeoLib/Point.h b/GeoLib/Point.h index e2f5afab72c21122d8323e6a96d7ecdd135a54c7..b795f02c2c7b489de37209fb94fa798a72fcba15 100644 --- a/GeoLib/Point.h +++ b/GeoLib/Point.h @@ -19,7 +19,7 @@ #include "GeoObject.h" // MathLib -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" namespace GeoLib { @@ -27,11 +27,11 @@ namespace GeoLib * \ingroup GeoLib */ -class Point : public MathLib::MathPoint, public GeoLib::GeoObject +class Point : public MathLib::Point3d, public GeoLib::GeoObject { public: Point(double x1, double x2, double x3) : - MathLib::MathPoint(), GeoLib::GeoObject() + MathLib::Point3d(), GeoLib::GeoObject() { this->_x[0] = x1; this->_x[1] = x2; @@ -39,11 +39,11 @@ public: } Point() : - MathLib::MathPoint(), GeoLib::GeoObject() + MathLib::Point3d(), GeoLib::GeoObject() {} Point (double const* x) : - MathLib::MathPoint(x), GeoLib::GeoObject() + MathLib::Point3d(x), GeoLib::GeoObject() {} /// return a geometry type diff --git a/GeoLib/Polyline.cpp b/GeoLib/Polyline.cpp index ebaa167dee847ee6bc340d7a1c15dc2dd70c80ca..b3a8af26b9ab02e2284df84ba1c2c99891f5e156 100644 --- a/GeoLib/Polyline.cpp +++ b/GeoLib/Polyline.cpp @@ -377,7 +377,7 @@ void Polyline::updatePointIDs(const std::vector<std::size_t> &pnt_ids) } } -double Polyline::getDistanceAlongPolyline(const MathLib::MathPoint& pnt, +double Polyline::getDistanceAlongPolyline(const MathLib::Point3d& pnt, const double epsilon_radius) const { double dist, lambda; diff --git a/GeoLib/Polyline.h b/GeoLib/Polyline.h index 7242e8ff0e7f1e688cddbef8e67d06ca3d4636ed..1f5e5bf8d52ec36eaa22d70fa5fece01429b693e 100644 --- a/GeoLib/Polyline.h +++ b/GeoLib/Polyline.h @@ -23,7 +23,7 @@ #include "Point.h" // MathLib -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" namespace GeoLib { @@ -154,7 +154,7 @@ public: * @return the distance along the polyline between the given point and the beginning of the polyline. * If the given point is not on the polyine, negative value is returned. */ - double getDistanceAlongPolyline(const MathLib::MathPoint& pnt, + double getDistanceAlongPolyline(const MathLib::Point3d& pnt, const double epsilon_radius) const; friend bool operator==(Polyline const& lhs, Polyline const& rhs); diff --git a/GeoLib/Raster.cpp b/GeoLib/Raster.cpp index fc4270de567a5ccf624fca3929753538a1a3d3c4..5d7fdac112d17e9443182ec0d0460d20fce2f620 100644 --- a/GeoLib/Raster.cpp +++ b/GeoLib/Raster.cpp @@ -101,7 +101,7 @@ Raster* Raster::getRasterFromSurface(Surface const& sfc, double cell_size, doubl return new Raster(n_cols, n_rows, ll[0], ll[1], cell_size, z_vals, z_vals+n_cols*n_rows ,-9999); } -double Raster::getValueAtPoint(const MathLib::MathPoint &pnt) const +double Raster::getValueAtPoint(const MathLib::Point3d &pnt) const { if (pnt[0]>=_ll_pnt[0] && pnt[0]<(_ll_pnt[0]+(_cell_size*_n_cols)) && pnt[1]>=_ll_pnt[1] && pnt[1]<(_ll_pnt[1]+(_cell_size*_n_rows))) @@ -119,7 +119,7 @@ double Raster::getValueAtPoint(const MathLib::MathPoint &pnt) const return _no_data_val; } -double Raster::interpolateValueAtPoint(MathLib::MathPoint const& pnt) const +double Raster::interpolateValueAtPoint(MathLib::Point3d const& pnt) const { // position in raster double const xPos ((pnt[0] - _ll_pnt[0]) / _cell_size); @@ -167,7 +167,7 @@ double Raster::interpolateValueAtPoint(MathLib::MathPoint const& pnt) const return MathLib::scalarProduct<double,4>(weight.data(), pix_val.data()); } -bool Raster::isPntOnRaster(MathLib::MathPoint const& pnt) const +bool Raster::isPntOnRaster(MathLib::Point3d const& pnt) const { if ((pnt[0]<_ll_pnt[0]) || (pnt[0]>_ll_pnt[0]+(_n_cols*_cell_size)) || (pnt[1]<_ll_pnt[1]) || (pnt[1]>_ll_pnt[1]+(_n_rows*_cell_size))) diff --git a/GeoLib/Raster.h b/GeoLib/Raster.h index 1199f7b81f0c5dfa94d545cae38bfc43e4fdf1ea..4ccb001bf7d0b9cffea380314a63543519f0a7bd 100644 --- a/GeoLib/Raster.h +++ b/GeoLib/Raster.h @@ -99,13 +99,13 @@ public: /** * Returns the raster value at the position of the given point. */ - double getValueAtPoint(const MathLib::MathPoint &pnt) const; + double getValueAtPoint(const MathLib::Point3d &pnt) const; /// Interpolates the elevation of the given point based on the 8-neighbourhood of the raster cell it is located on - double interpolateValueAtPoint(const MathLib::MathPoint &pnt) const; + double interpolateValueAtPoint(const MathLib::Point3d &pnt) const; /// Checks if the given point is located within the (x,y)-extension of the raster. - bool isPntOnRaster(MathLib::MathPoint const& node) const; + bool isPntOnRaster(MathLib::Point3d const& node) const; ~Raster(); diff --git a/MeshLib/Elements/Element.h b/MeshLib/Elements/Element.h index a39e56b781ea6936ab8598664da43a9e660938f3..5b856a6e61e76c6b18e9249be2d67a9ab7e0b641 100644 --- a/MeshLib/Elements/Element.h +++ b/MeshLib/Elements/Element.h @@ -19,7 +19,7 @@ #include <limits> #include <boost/optional.hpp> -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" #include "MeshLib/MeshEnums.h" #include "MeshLib/Mesh.h" @@ -163,11 +163,11 @@ public: /** * Checks if a point is inside the element. - * @param pnt a 3D MathLib::MathPoint object + * @param pnt a 3D MathLib::Point3d object * @param eps tolerance for numerical algorithm used or computing the property * @return true if the point is not outside the element, false otherwise */ - virtual bool isPntInElement(MathLib::MathPoint const& pnt, double eps = std::numeric_limits<double>::epsilon()) const = 0; + virtual bool isPntInElement(MathLib::Point3d const& pnt, double eps = std::numeric_limits<double>::epsilon()) const = 0; /** * Tests if the element is geometrically valid. diff --git a/MeshLib/Elements/TemplateHex-impl.h b/MeshLib/Elements/TemplateHex-impl.h index 5c3713d7d956308c5f3efd8c89f65e37537091a5..cb1be254d825edae6c6a3d8884ceaeae1f46f807 100644 --- a/MeshLib/Elements/TemplateHex-impl.h +++ b/MeshLib/Elements/TemplateHex-impl.h @@ -141,7 +141,7 @@ bool TemplateHex<NNODES,CELLHEXTYPE>::isEdge(unsigned idx1, unsigned idx2) const } template <unsigned NNODES, CellType CELLHEXTYPE> -bool TemplateHex<NNODES,CELLHEXTYPE>::isPntInElement(MathLib::MathPoint const& pnt, double eps) const +bool TemplateHex<NNODES,CELLHEXTYPE>::isPntInElement(MathLib::Point3d const& pnt, double eps) const { return (GeoLib::isPointInTetrahedron(pnt, *_nodes[4], *_nodes[7], *_nodes[5], *_nodes[0], eps) || GeoLib::isPointInTetrahedron(pnt, *_nodes[5], *_nodes[3], *_nodes[1], *_nodes[0], eps) || diff --git a/MeshLib/Elements/TemplateHex.h b/MeshLib/Elements/TemplateHex.h index 5aa4a0dc61f8f34c00a1fc77b1f30e4b9d63dc5c..e781bea71540799d7f5c51212f7213bd8caff135 100644 --- a/MeshLib/Elements/TemplateHex.h +++ b/MeshLib/Elements/TemplateHex.h @@ -112,11 +112,11 @@ public: /** * Checks if a point is inside the element. - * @param pnt a 3D MathLib::MathPoint object + * @param pnt a 3D MathLib::Point3d object * @param eps tolerance for numerical algorithm used or computing the property * @return true if the point is not outside the element, false otherwise */ - bool isPntInElement(MathLib::MathPoint const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; + bool isPntInElement(MathLib::Point3d const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; /** * Tests if the element is geometrically valid. diff --git a/MeshLib/Elements/TemplateLine-impl.h b/MeshLib/Elements/TemplateLine-impl.h index 56c36c2f5e8ea0c1c331a78d945fcbff0ec5776c..01ae92f28489210eafe3922a7cfb9679e7679b4a 100644 --- a/MeshLib/Elements/TemplateLine-impl.h +++ b/MeshLib/Elements/TemplateLine-impl.h @@ -56,7 +56,7 @@ TemplateLine<NNODES,CELLLINETYPE>::~TemplateLine() {} template <unsigned NNODES, CellType CELLLINETYPE> -bool TemplateLine<NNODES,CELLLINETYPE>::isPntInElement(MathLib::MathPoint const& pnt, double eps) const +bool TemplateLine<NNODES,CELLLINETYPE>::isPntInElement(MathLib::Point3d const& pnt, double eps) const { double tmp; double tmp_dst(0); diff --git a/MeshLib/Elements/TemplateLine.h b/MeshLib/Elements/TemplateLine.h index 8f8d7130122fa9cedc90eef8510d295f732f8dd9..514e8b3c99a5839165ab0c05d96d3376d54d7d0a 100644 --- a/MeshLib/Elements/TemplateLine.h +++ b/MeshLib/Elements/TemplateLine.h @@ -123,11 +123,11 @@ public: /** * Checks if a point is located on the line - * @param pnt a 3D MathLib::MathPoint object + * @param pnt a 3D MathLib::Point3d object * @param eps tolerance for numerical algorithm used or computing the property * @return true if the point is located on the line, false otherwise */ - bool isPntInElement(MathLib::MathPoint const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; + bool isPntInElement(MathLib::Point3d const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; /** * Tests if the element is geometrically valid. diff --git a/MeshLib/Elements/TemplatePrism-impl.h b/MeshLib/Elements/TemplatePrism-impl.h index 24b8c01a231fcbc8c04d8d3edfd6904d294033b1..1393be91522ffa02d16cde872ba6f150b1c76880 100644 --- a/MeshLib/Elements/TemplatePrism-impl.h +++ b/MeshLib/Elements/TemplatePrism-impl.h @@ -148,7 +148,7 @@ bool TemplatePrism<NNODES,CELLPRISMTYPE>::isEdge(unsigned idx1, unsigned idx2) c } template <unsigned NNODES, CellType CELLPRISMTYPE> -bool TemplatePrism<NNODES,CELLPRISMTYPE>::isPntInElement(MathLib::MathPoint const& pnt, double eps) const +bool TemplatePrism<NNODES,CELLPRISMTYPE>::isPntInElement(MathLib::Point3d const& pnt, double eps) const { return (GeoLib::isPointInTetrahedron(pnt, *_nodes[0], *_nodes[1], *_nodes[2], *_nodes[3], eps) || GeoLib::isPointInTetrahedron(pnt, *_nodes[1], *_nodes[4], *_nodes[2], *_nodes[3], eps) || diff --git a/MeshLib/Elements/TemplatePrism.h b/MeshLib/Elements/TemplatePrism.h index 064099b39ad1e36b8af2b0eedc3a65e7eb3c6801..5f7aa36066c0dd98f7405962fc4d50207a165514 100644 --- a/MeshLib/Elements/TemplatePrism.h +++ b/MeshLib/Elements/TemplatePrism.h @@ -110,11 +110,11 @@ public: /** * Checks if a point is inside the element. - * @param pnt a 3D MathLib::MathPoint object + * @param pnt a 3D MathLib::Point3d object * @param eps tolerance for numerical algorithm used or computing the property * @return true if the point is not outside the element, false otherwise */ - bool isPntInElement(MathLib::MathPoint const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; + bool isPntInElement(MathLib::Point3d const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; /** * Tests if the element is geometrically valid. diff --git a/MeshLib/Elements/TemplatePyramid-impl.h b/MeshLib/Elements/TemplatePyramid-impl.h index 704b03aa216841cde6b7df6df376adcf1edd6b93..9328c2109ac2cd895f87047199f984872ac5f912 100644 --- a/MeshLib/Elements/TemplatePyramid-impl.h +++ b/MeshLib/Elements/TemplatePyramid-impl.h @@ -150,7 +150,7 @@ bool TemplatePyramid<NNODES,CELLPYRAMIDTYPE>::isEdge(unsigned idx1, unsigned idx } template <unsigned NNODES, CellType CELLPYRAMIDTYPE> -bool TemplatePyramid<NNODES,CELLPYRAMIDTYPE>::isPntInElement(MathLib::MathPoint const& pnt, double eps) const +bool TemplatePyramid<NNODES,CELLPYRAMIDTYPE>::isPntInElement(MathLib::Point3d const& pnt, double eps) const { return (GeoLib::isPointInTetrahedron(pnt, *_nodes[0], *_nodes[1], *_nodes[2], *_nodes[4], eps) || GeoLib::isPointInTetrahedron(pnt, *_nodes[0], *_nodes[2], *_nodes[3], *_nodes[4], eps)); diff --git a/MeshLib/Elements/TemplatePyramid.h b/MeshLib/Elements/TemplatePyramid.h index a50851c05f1b6e34bebee2d47d812e4a3cd5bfa6..8c874e7daaedbfc778b1add0c7dea8b848c88c3d 100644 --- a/MeshLib/Elements/TemplatePyramid.h +++ b/MeshLib/Elements/TemplatePyramid.h @@ -108,11 +108,11 @@ public: /** * Checks if a point is inside the element. - * @param pnt a 3D MathLib::MathPoint object + * @param pnt a 3D MathLib::Point3d object * @param eps tolerance for numerical algorithm used or computing the property * @return true if the point is not outside the element, false otherwise */ - bool isPntInElement(MathLib::MathPoint const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; + bool isPntInElement(MathLib::Point3d const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; /** * Tests if the element is geometrically valid. diff --git a/MeshLib/Elements/TemplateQuad-impl.h b/MeshLib/Elements/TemplateQuad-impl.h index f993842b0d0036c29f88999e31a2a8eb8cb38f4f..864ab3f5385bc6c188ec5729161009d58f41086e 100644 --- a/MeshLib/Elements/TemplateQuad-impl.h +++ b/MeshLib/Elements/TemplateQuad-impl.h @@ -104,7 +104,7 @@ bool TemplateQuad<NNODES,CELLQUADTYPE>::isEdge(unsigned idx1, unsigned idx2) con } template <unsigned NNODES, CellType CELLQUADTYPE> -bool TemplateQuad<NNODES,CELLQUADTYPE>::isPntInElement(MathLib::MathPoint const& pnt, double eps) const +bool TemplateQuad<NNODES,CELLQUADTYPE>::isPntInElement(MathLib::Point3d const& pnt, double eps) const { return (GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps) || GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[2], *_nodes[3], eps)); diff --git a/MeshLib/Elements/TemplateQuad.h b/MeshLib/Elements/TemplateQuad.h index e5058a8b299aebd1f5641c9b9c1e8d119c9b60ee..573e5474eced09b53368e7d25b11fd492f7e497f 100644 --- a/MeshLib/Elements/TemplateQuad.h +++ b/MeshLib/Elements/TemplateQuad.h @@ -97,11 +97,11 @@ public: /** * Checks if a point is inside the element. - * @param pnt a 3D MathLib::MathPoint object + * @param pnt a 3D MathLib::Point3d object * @param eps tolerance for numerical algorithm used or computing the property * @return true if the point is not outside the element, false otherwise */ - bool isPntInElement(MathLib::MathPoint const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; + bool isPntInElement(MathLib::Point3d const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; /** * Tests if the element is geometrically valid. diff --git a/MeshLib/Elements/TemplateTet-impl.h b/MeshLib/Elements/TemplateTet-impl.h index 5ff0d13e772a19a57242aa14a453ebfeb9e6441e..5ddb6c5176ec018a0996db7bd1fb85fada35fd33 100644 --- a/MeshLib/Elements/TemplateTet-impl.h +++ b/MeshLib/Elements/TemplateTet-impl.h @@ -128,7 +128,7 @@ bool TemplateTet<NNODES,CELLTETTYPE>::isEdge(unsigned idx1, unsigned idx2) const } template <unsigned NNODES, CellType CELLTETTYPE> -bool TemplateTet<NNODES,CELLTETTYPE>::isPntInElement(MathLib::MathPoint const& pnt, double eps) const +bool TemplateTet<NNODES,CELLTETTYPE>::isPntInElement(MathLib::Point3d const& pnt, double eps) const { return GeoLib::isPointInTetrahedron(pnt, *_nodes[0], *_nodes[1], *_nodes[2], *_nodes[3], eps); } diff --git a/MeshLib/Elements/TemplateTet.h b/MeshLib/Elements/TemplateTet.h index aad0a51b77145a794d46eca5655527df665890f9..dce10086ad05ecdae3512c61342a00bdeacec7ba 100644 --- a/MeshLib/Elements/TemplateTet.h +++ b/MeshLib/Elements/TemplateTet.h @@ -107,11 +107,11 @@ public: /** * Checks if a point is inside the element. - * @param pnt a 3D MathLib::MathPoint object + * @param pnt a 3D MathLib::Point3d object * @param eps tolerance for numerical algorithm used or computing the property * @return true if the point is not outside the element, false otherwise */ - bool isPntInElement(MathLib::MathPoint const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; + bool isPntInElement(MathLib::Point3d const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; /** * Tests if the element is geometrically valid. diff --git a/MeshLib/Elements/TemplateTri-impl.h b/MeshLib/Elements/TemplateTri-impl.h index 6951024d8b6141f9a909b43e4a9ab14cb9de6d07..1e204207cd1cb85bdb5a728df1b9f6c456ff86b7 100644 --- a/MeshLib/Elements/TemplateTri-impl.h +++ b/MeshLib/Elements/TemplateTri-impl.h @@ -85,7 +85,7 @@ bool TemplateTri<NNODES,CELLTRITYPE>::isEdge(unsigned idx1, unsigned idx2) const } template <unsigned NNODES, CellType CELLTRITYPE> -bool TemplateTri<NNODES,CELLTRITYPE>::isPntInElement(MathLib::MathPoint const& pnt, double eps) const +bool TemplateTri<NNODES,CELLTRITYPE>::isPntInElement(MathLib::Point3d const& pnt, double eps) const { return GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps); } diff --git a/MeshLib/Elements/TemplateTri.h b/MeshLib/Elements/TemplateTri.h index c4b887d0af8606791b2460c1f500fd592af9aaff..f5e201088097ada56ee4698117769f61da8ca072 100644 --- a/MeshLib/Elements/TemplateTri.h +++ b/MeshLib/Elements/TemplateTri.h @@ -103,11 +103,11 @@ public: /** * Checks if a point is inside the element. - * @param pnt a 3D MathLib::MathPoint object + * @param pnt a 3D MathLib::Point3d object * @param eps tolerance for numerical algorithm used or computing the property * @return true if the point is not outside the element, false otherwise */ - bool isPntInElement(MathLib::MathPoint const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; + bool isPntInElement(MathLib::Point3d const& pnt, double eps = std::numeric_limits<double>::epsilon()) const; /** * Tests if the element is geometrically valid diff --git a/MeshLib/MeshQuality/EdgeRatioMetric.cpp b/MeshLib/MeshQuality/EdgeRatioMetric.cpp index 8c5bcd17edd55699a393e24f57e5145f2d6f0e14..278dfaf83af663f799b6697344c6850322506bf9 100644 --- a/MeshLib/MeshQuality/EdgeRatioMetric.cpp +++ b/MeshLib/MeshQuality/EdgeRatioMetric.cpp @@ -50,21 +50,21 @@ void EdgeRatioMetric::calculateQuality() break; } case MeshElemType::PRISM: { - std::vector<const MathLib::MathPoint*> pnts; + std::vector<const MathLib::Point3d*> pnts; for (size_t j(0); j < 6; j++) pnts.push_back(elem.getNode(j)); _element_quality_metric[k] = checkPrism(pnts); break; } case MeshElemType::PYRAMID: { - std::vector<const MathLib::MathPoint*> pnts; + std::vector<const MathLib::Point3d*> pnts; for (size_t j(0); j < 5; j++) pnts.push_back(elem.getNode(j)); _element_quality_metric[k] = checkPyramid(pnts); break; } case MeshElemType::HEXAHEDRON: { - std::vector<const MathLib::MathPoint*> pnts; + std::vector<const MathLib::Point3d*> pnts; for (size_t j(0); j < 8; j++) pnts.push_back(elem.getNode(j)); _element_quality_metric[k] = checkHexahedron(pnts); @@ -77,9 +77,9 @@ void EdgeRatioMetric::calculateQuality() } } -double EdgeRatioMetric::checkTriangle (MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c) const +double EdgeRatioMetric::checkTriangle (MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c) const { double len0 (sqrt(MathLib::sqrDist (b,a))); double len1 (sqrt(MathLib::sqrDist (b,c))); @@ -111,10 +111,10 @@ double EdgeRatioMetric::checkTriangle (MathLib::MathPoint const& a, } } -double EdgeRatioMetric::checkQuad (MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c, - MathLib::MathPoint const& d) const +double EdgeRatioMetric::checkQuad (MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c, + MathLib::Point3d const& d) const { double sqr_lengths[4] = {MathLib::sqrDist (b,a), MathLib::sqrDist (c,b), @@ -130,10 +130,10 @@ double EdgeRatioMetric::checkQuad (MathLib::MathPoint const& a, return sqrt(sqr_lengths[0]) / sqrt(sqr_lengths[3]); } -double EdgeRatioMetric::checkTetrahedron (MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c, - MathLib::MathPoint const& d) const +double EdgeRatioMetric::checkTetrahedron (MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c, + MathLib::Point3d const& d) const { double sqr_lengths[6] = {MathLib::sqrDist (b,a), MathLib::sqrDist (c,b), MathLib::sqrDist (c,a), MathLib::sqrDist (a,d), @@ -148,7 +148,7 @@ double EdgeRatioMetric::checkTetrahedron (MathLib::MathPoint const& a, return sqrt(sqr_lengths[0]) / sqrt(sqr_lengths[5]); } -double EdgeRatioMetric::checkPrism (std::vector<const MathLib::MathPoint*> const& pnts) const +double EdgeRatioMetric::checkPrism (std::vector<const MathLib::Point3d*> const& pnts) const { double sqr_lengths[9] = {MathLib::sqrDist (*pnts[0],*pnts[1]), MathLib::sqrDist (*pnts[1],*pnts[2]), @@ -169,7 +169,7 @@ double EdgeRatioMetric::checkPrism (std::vector<const MathLib::MathPoint*> const return sqrt(sqr_lengths[0]) / sqrt(sqr_lengths[8]); } -double EdgeRatioMetric::checkPyramid (std::vector<const MathLib::MathPoint*> const &pnts) const +double EdgeRatioMetric::checkPyramid (std::vector<const MathLib::Point3d*> const &pnts) const { double sqr_lengths[8] = {MathLib::sqrDist (*pnts[0],*pnts[1]), MathLib::sqrDist (*pnts[1],*pnts[2]), @@ -189,7 +189,7 @@ double EdgeRatioMetric::checkPyramid (std::vector<const MathLib::MathPoint*> con return sqrt(sqr_lengths[0]) / sqrt(sqr_lengths[7]); } -double EdgeRatioMetric::checkHexahedron (std::vector<const MathLib::MathPoint*> const & pnts) const +double EdgeRatioMetric::checkHexahedron (std::vector<const MathLib::Point3d*> const & pnts) const { double sqr_lengths[12] = {MathLib::sqrDist (*pnts[0],*pnts[1]), MathLib::sqrDist (*pnts[1],*pnts[2]), diff --git a/MeshLib/MeshQuality/EdgeRatioMetric.h b/MeshLib/MeshQuality/EdgeRatioMetric.h index eb3547a090f9576fb5851b899f843679c9ad1512..20a1ee57441311e1bdc0eed0a34fb3b586107c03 100644 --- a/MeshLib/MeshQuality/EdgeRatioMetric.h +++ b/MeshLib/MeshQuality/EdgeRatioMetric.h @@ -16,7 +16,7 @@ #define EDGERATIOMETRIC_H_ #include "ElementQualityMetric.h" -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" namespace MeshLib { @@ -33,20 +33,20 @@ public: virtual void calculateQuality (); private: - double checkTriangle (MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c) const; - double checkQuad (MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c, - MathLib::MathPoint const& d) const; - double checkTetrahedron (MathLib::MathPoint const& a, - MathLib::MathPoint const& b, - MathLib::MathPoint const& c, - MathLib::MathPoint const& d) const; - double checkPrism (std::vector<const MathLib::MathPoint*> const& pnts) const; - double checkPyramid (std::vector<const MathLib::MathPoint*> const& pnts) const; - double checkHexahedron (std::vector<const MathLib::MathPoint*> const& pnts) const; + double checkTriangle (MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c) const; + double checkQuad (MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c, + MathLib::Point3d const& d) const; + double checkTetrahedron (MathLib::Point3d const& a, + MathLib::Point3d const& b, + MathLib::Point3d const& c, + MathLib::Point3d const& d) const; + double checkPrism (std::vector<const MathLib::Point3d*> const& pnts) const; + double checkPyramid (std::vector<const MathLib::Point3d*> const& pnts) const; + double checkHexahedron (std::vector<const MathLib::Point3d*> const& pnts) const; }; } diff --git a/MeshLib/MeshQuality/RadiusEdgeRatioMetric.cpp b/MeshLib/MeshQuality/RadiusEdgeRatioMetric.cpp index 22fa2bc5fafec557c2ffc72aa8d7b9cdb3cfb613..0f047e0a596bc248a00fcf2823ee72fd533c6aa2 100644 --- a/MeshLib/MeshQuality/RadiusEdgeRatioMetric.cpp +++ b/MeshLib/MeshQuality/RadiusEdgeRatioMetric.cpp @@ -32,7 +32,7 @@ void RadiusEdgeRatioMetric::calculateQuality () { Element const& elem (*elements[k]); std::size_t const n_nodes (elem.getNBaseNodes()); - std::vector<MathLib::MathPoint*> pnts(n_nodes); + std::vector<MathLib::Point3d*> pnts(n_nodes); std::copy_n(elem.getNodes(), n_nodes, pnts.begin()); GeoLib::MinimalBoundingSphere const s(pnts); double min, max; diff --git a/MeshLib/Node.cpp b/MeshLib/Node.cpp index 8c4d76327dbeb3fc60d6e6e4694b411d5c2b3a79..cc9ccb5a84484154a9c2ed42b76faa5ea96fcde5 100644 --- a/MeshLib/Node.cpp +++ b/MeshLib/Node.cpp @@ -18,17 +18,17 @@ namespace MeshLib { Node::Node(const double coords[3], std::size_t id) - : MathLib::MathPoint(coords), _id(id) + : MathLib::Point3d(coords), _id(id) { } Node::Node(double x, double y, double z, std::size_t id) - : MathLib::MathPoint(std::array<double,3>({{x, y, z}})), _id(id) + : MathLib::Point3d(std::array<double,3>({{x, y, z}})), _id(id) { } Node::Node(const Node &node) - : MathLib::MathPoint(node.getCoords()), _id(node.getID()) + : MathLib::Point3d(node.getCoords()), _id(node.getID()) { } diff --git a/MeshLib/Node.h b/MeshLib/Node.h index 8c74e8ef91e3ebece68560d67d20b033f9920842..608e2badf961e650f0724e7d3c0ac7fc6868efae 100644 --- a/MeshLib/Node.h +++ b/MeshLib/Node.h @@ -20,7 +20,7 @@ #include <set> #include <vector> -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" #include "MeshEditing/removeMeshNodes.h" #include "MeshGenerators/MeshLayerMapper.h" @@ -35,7 +35,7 @@ class Element; /** * A mesh node with coordinates in 3D space. */ -class Node : public MathLib::MathPoint +class Node : public MathLib::Point3d { /* friend functions: */ friend bool MeshLayerMapper::layerMapping(MeshLib::Mesh &mesh, const GeoLib::Raster &raster, double noDataReplacementValue); diff --git a/NumLib/Function/ISpatialFunction.h b/NumLib/Function/ISpatialFunction.h index 16b9a79301d1509e3c0c0bcf971384b5b7939d54..dbd97e864d74c74e5a109d97ed5a4b3a168e487a 100644 --- a/NumLib/Function/ISpatialFunction.h +++ b/NumLib/Function/ISpatialFunction.h @@ -16,7 +16,7 @@ #include <vector> -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" namespace NumLib { @@ -34,7 +34,7 @@ public: * \param pnt a point object * \return evaluated value */ - virtual double operator()(const MathLib::MathPoint& pnt) const = 0; + virtual double operator()(const MathLib::Point3d& pnt) const = 0; }; } // NumLib diff --git a/NumLib/Function/LinearInterpolationAlongPolyline.cpp b/NumLib/Function/LinearInterpolationAlongPolyline.cpp index f3f442b81f8500e69492e07490c2134f49618611..4549a5e3a219e517c64fddd6f445f07e54482d6e 100644 --- a/NumLib/Function/LinearInterpolationAlongPolyline.cpp +++ b/NumLib/Function/LinearInterpolationAlongPolyline.cpp @@ -57,7 +57,7 @@ MathLib::PiecewiseLinearInterpolation LinearInterpolationAlongPolyline::createIn return MathLib::PiecewiseLinearInterpolation(vec_known_dist, vec_known_values); } -double LinearInterpolationAlongPolyline::operator()(const MathLib::MathPoint& pnt) const +double LinearInterpolationAlongPolyline::operator()(const MathLib::Point3d& pnt) const { const double dist = _ply.getDistanceAlongPolyline(pnt, _search_length); return dist>=0 ? _interpolation.getValue(dist) : _default_value; diff --git a/NumLib/Function/LinearInterpolationAlongPolyline.h b/NumLib/Function/LinearInterpolationAlongPolyline.h index acaa268b2bdfa25f72071a0ac0b67752d59998d4..78473eef7300e1d45659d08d40a6010bcd3a8041 100644 --- a/NumLib/Function/LinearInterpolationAlongPolyline.h +++ b/NumLib/Function/LinearInterpolationAlongPolyline.h @@ -62,7 +62,7 @@ public: * @return interpolated value. A default value is returned if the given point * is not located on a polyline */ - double operator()(const MathLib::MathPoint& pnt) const; + double operator()(const MathLib::Point3d& pnt) const; private: /// construct an interpolation algorithm diff --git a/NumLib/Function/LinearInterpolationOnSurface.cpp b/NumLib/Function/LinearInterpolationOnSurface.cpp index 760ea20d0a7c4f5d6724239224661fdcfbcdf76b..f5fd90ee7cacf80a8227a22a262dc8a1fc6beaf6 100644 --- a/NumLib/Function/LinearInterpolationOnSurface.cpp +++ b/NumLib/Function/LinearInterpolationOnSurface.cpp @@ -39,7 +39,7 @@ LinearInterpolationOnSurface::LinearInterpolationOnSurface( assert(vec_interpolate_point_ids.size()==vec_interpolate_point_values.size()); } -double LinearInterpolationOnSurface::operator()(const MathLib::MathPoint& pnt) const +double LinearInterpolationOnSurface::operator()(const MathLib::Point3d& pnt) const { const double* coords = pnt.getCoords(); if (!_sfc.isPntInBoundingVolume(coords)) diff --git a/NumLib/Function/LinearInterpolationOnSurface.h b/NumLib/Function/LinearInterpolationOnSurface.h index 9e98ec043a81a380a6fdb09e816a99e8f90e97a4..25774873a2997b3cce10da9367909c401d75f741 100644 --- a/NumLib/Function/LinearInterpolationOnSurface.h +++ b/NumLib/Function/LinearInterpolationOnSurface.h @@ -61,7 +61,7 @@ public: * @return interpolated value. A default value is returned if the given point * is not located on a surface */ - double operator()(const MathLib::MathPoint& pnt) const; + double operator()(const MathLib::Point3d& pnt) const; private: /// rotate a triangle to XY plane diff --git a/NumLib/Function/TemplateSpatialFunction.h b/NumLib/Function/TemplateSpatialFunction.h index d7c3f0ccda0ef8446201a5e6666f13c842e70c3c..8dff6611cfc55729a2c18b70bba19c76b306cbef 100644 --- a/NumLib/Function/TemplateSpatialFunction.h +++ b/NumLib/Function/TemplateSpatialFunction.h @@ -39,7 +39,7 @@ public: * @param pnt a point object * @return evaluated value */ - virtual double operator()(const MathLib::MathPoint& pnt) const + virtual double operator()(const MathLib::Point3d& pnt) const { return _f(pnt.getCoords()); } diff --git a/Tests/GeoLib/TestBoundingSphere.cpp b/Tests/GeoLib/TestBoundingSphere.cpp index d2fc8da43967e68e124afb66e6833a6a79131dae..5cf7d3a1f4ee06fc3ef4cda2f0750d2ee7bea9a7 100644 --- a/Tests/GeoLib/TestBoundingSphere.cpp +++ b/Tests/GeoLib/TestBoundingSphere.cpp @@ -17,15 +17,15 @@ #include "gtest/gtest.h" #include "GeoLib/MinimalBoundingSphere.h" -#include "MathLib/MathPoint.h" +#include "MathLib/Point3d.h" TEST(GeoLib, TestBoundingSphere) { - std::vector<MathLib::MathPoint*> pnts; - pnts.push_back(new MathLib::MathPoint(std::array<double,3>({{0, 0 , 0}}))); - pnts.push_back(new MathLib::MathPoint(std::array<double,3>({{2, 0 , 0}}))); - pnts.push_back(new MathLib::MathPoint(std::array<double,3>({{1, 0.1 , 0}}))); - pnts.push_back(new MathLib::MathPoint(std::array<double,3>({{1, -0.1 , 0}}))); + std::vector<MathLib::Point3d*> pnts; + pnts.push_back(new MathLib::Point3d(std::array<double,3>({{0, 0 , 0}}))); + pnts.push_back(new MathLib::Point3d(std::array<double,3>({{2, 0 , 0}}))); + pnts.push_back(new MathLib::Point3d(std::array<double,3>({{1, 0.1 , 0}}))); + pnts.push_back(new MathLib::Point3d(std::array<double,3>({{1, -0.1 , 0}}))); { /** @@ -39,7 +39,7 @@ TEST(GeoLib, TestBoundingSphere) * Expected result is C=(1,0,0), r=1 */ GeoLib::MinimalBoundingSphere s(pnts); - MathLib::MathPoint center = s.getCenter(); + MathLib::Point3d center = s.getCenter(); ASSERT_NEAR(1.0, center[0], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.0, center[1], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.0, center[2], std::numeric_limits<double>::epsilon()); @@ -61,7 +61,7 @@ TEST(GeoLib, TestBoundingSphere) */ (*pnts[2])[2] -= 1.4; GeoLib::MinimalBoundingSphere s(pnts); - MathLib::MathPoint center = s.getCenter(); + MathLib::Point3d center = s.getCenter(); ASSERT_NEAR(1.0, center[0], 0.0001); ASSERT_NEAR(0.0246, center[1], 0.0001); ASSERT_NEAR(-0.3446, center[2], 0.0001); @@ -80,10 +80,10 @@ TEST(GeoLib, TestBoundingSphere) (*pnts[3])[0] = 0.0; (*pnts[3])[1] = 1.0; (*pnts[3])[2] = 0.0; - pnts.push_back(new MathLib::MathPoint(std::array<double,3>({{0, 0, 1}}))); - pnts.push_back(new MathLib::MathPoint(std::array<double,3>({{1, 0, 1}}))); - pnts.push_back(new MathLib::MathPoint(std::array<double,3>({{1, 1, 1}}))); - pnts.push_back(new MathLib::MathPoint(std::array<double,3>({{0, 1, 0.9}}))); + pnts.push_back(new MathLib::Point3d(std::array<double,3>({{0, 0, 1}}))); + pnts.push_back(new MathLib::Point3d(std::array<double,3>({{1, 0, 1}}))); + pnts.push_back(new MathLib::Point3d(std::array<double,3>({{1, 1, 1}}))); + pnts.push_back(new MathLib::Point3d(std::array<double,3>({{0, 1, 0.9}}))); { /** @@ -91,7 +91,7 @@ TEST(GeoLib, TestBoundingSphere) * Expected result is C=(0.5,0.5,0.5), r=0.866 */ GeoLib::MinimalBoundingSphere s(pnts); - MathLib::MathPoint center = s.getCenter(); + MathLib::Point3d center = s.getCenter(); ASSERT_NEAR(0.5, center[0], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.5, center[1], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.5, center[2], std::numeric_limits<double>::epsilon()); @@ -105,7 +105,7 @@ TEST(GeoLib, TestBoundingSphere) (*pnts[7])[2] += 0.3; GeoLib::MinimalBoundingSphere s(pnts); { - MathLib::MathPoint center = s.getCenter(); + MathLib::Point3d center = s.getCenter(); ASSERT_NEAR(0.5, center[0], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.5, center[1], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.6, center[2], std::numeric_limits<double>::epsilon()); @@ -113,14 +113,14 @@ TEST(GeoLib, TestBoundingSphere) } /// Calculates the bounding sphere of points on a bounding sphere - std::vector<MathLib::MathPoint*> *sphere_points (s.getRandomSpherePoints(1000)); + std::vector<MathLib::Point3d*> *sphere_points (s.getRandomSpherePoints(1000)); GeoLib::MinimalBoundingSphere t(*sphere_points); - MathLib::MathPoint center = s.getCenter(); + MathLib::Point3d center = s.getCenter(); ASSERT_NEAR(0.5, center[0], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.5, center[1], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.6, center[2], std::numeric_limits<double>::epsilon()); ASSERT_NEAR(0.9273, s.getRadius(), 0.0001); std::for_each(pnts.begin(), pnts.end(), - std::default_delete<MathLib::MathPoint>()); + std::default_delete<MathLib::Point3d>()); }