diff --git a/GeoLib/AnalyticalGeometry.cpp b/GeoLib/AnalyticalGeometry.cpp index 04bb79fffd6f3d21fe75fbac8a6f57e180c99c33..7f216b9b18f8f5623d8fb42c4d243561e1ddd64e 100644 --- a/GeoLib/AnalyticalGeometry.cpp +++ b/GeoLib/AnalyticalGeometry.cpp @@ -169,8 +169,8 @@ bool lineSegmentIntersect( } bool lineSegmentsIntersect(const GeoLib::Polyline* ply, - size_t &idx0, - size_t &idx1, + size_t &idx0, + size_t &idx1, GeoLib::Point& intersection_pnt) { size_t n_segs(ply->getNumberOfPoints() - 1); @@ -198,9 +198,10 @@ bool lineSegmentsIntersect(const GeoLib::Polyline* ply, } bool isPointInTriangle(GeoLib::Point const& p, - GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point const& c, - double eps_pnt_out_of_plane, double eps_pnt_out_of_tri, - GeoLib::TriangleTest algorithm) + GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point const& c, + double eps_pnt_out_of_plane, + double eps_pnt_out_of_tri, + GeoLib::TriangleTest algorithm) { switch (algorithm) { @@ -213,11 +214,9 @@ bool isPointInTriangle(GeoLib::Point const& p, } bool gaussPointInTriangle(GeoLib::Point const& q, - GeoLib::Point const& a, - GeoLib::Point const& b, - GeoLib::Point const& c, - double eps_pnt_out_of_plane, - double eps_pnt_out_of_tri) + GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point const& c, + double eps_pnt_out_of_plane, + double eps_pnt_out_of_tri) { MathLib::Vector3 const v(a, b); MathLib::Vector3 const w(a, c); @@ -253,8 +252,9 @@ bool gaussPointInTriangle(GeoLib::Point const& q, } bool barycentricPointInTriangle(GeoLib::Point const& p, - GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point const& c, - double eps_pnt_out_of_plane, double eps_pnt_out_of_tri) + GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point const& c, + double eps_pnt_out_of_plane, + double eps_pnt_out_of_tri) { if (std::abs(orientation3d(p, a, b, c)) > eps_pnt_out_of_plane) return false; diff --git a/GeoLib/AnalyticalGeometry.h b/GeoLib/AnalyticalGeometry.h index 1c31a79598d54b818f8e1f9ed78ffca6585d6572..ae0e46c0a52ea8027e363afa8d8eea1a7b51e261 100644 --- a/GeoLib/AnalyticalGeometry.h +++ b/GeoLib/AnalyticalGeometry.h @@ -121,7 +121,6 @@ double calcTetrahedronVolume(const double* x1, const double* x2, const double* x * Tests if the given point p is within the triangle, defined by its edge nodes a, b and c. * Using two eps-values it is possible to test an 'epsilon' neighbourhood around the triangle * as well as an 'epsilon' outside the triangles plane. - * Algorithm based on "Fundamentals of Computer Graphics" by Peter Shirley. * @param p test point * @param a edge node of triangle * @param b edge node of triangle @@ -132,14 +131,15 @@ double calcTetrahedronVolume(const double* x1, const double* x2, const double* x * @return true if the test point p is within the 'epsilon'-neighbourhood of the triangle */ bool isPointInTriangle(GeoLib::Point const& p, - GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point 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); + GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point 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); /** * Tests if the given point p is within the triangle, defined by its edge nodes a, b and c. - * Using the eps it is possible to test a 'epsilon' neighbourhood around the triangle. + * Using two eps-values it is possible to test an 'epsilon' neighbourhood around the triangle + * as well as an 'epsilon' outside the triangles plane. * @param p test point * @param a edge node of triangle * @param b edge node of triangle @@ -150,9 +150,9 @@ bool isPointInTriangle(GeoLib::Point const& p, * @return true if the test point p is within the 'epsilon'-neighbourhood of the triangle */ bool gaussPointInTriangle(GeoLib::Point const& p, - GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point 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::Point const& a, GeoLib::Point const& b, GeoLib::Point const& c, + double eps_pnt_out_of_plane = std::numeric_limits<float>::epsilon(), + double eps_pnt_out_of_tri = std::numeric_limits<float>::epsilon()); /** * Tests if the given point p is within the triangle, defined by its edge nodes a, b and c. @@ -168,9 +168,9 @@ bool gaussPointInTriangle(GeoLib::Point const& p, * @return true if the test point p is within the 'epsilon'-neighbourhood of the triangle */ bool barycentricPointInTriangle(GeoLib::Point const& p, - GeoLib::Point const& a, GeoLib::Point const& b, GeoLib::Point 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::Point const& a, GeoLib::Point const& b, GeoLib::Point const& c, + double eps_pnt_out_of_plane = std::numeric_limits<float>::epsilon(), + double eps_pnt_out_of_tri = std::numeric_limits<float>::epsilon()); /** * Tests if the given point p is located within a tetrahedron spanned by points a, b, c, d.