diff --git a/GeoLib/Polygon.cpp b/GeoLib/Polygon.cpp index 1bd58aecda5ed0cfae65ac829a1a5ae7e12a9fda..0d5b0265d770abf82373d4b9761d84040a03b8a0 100644 --- a/GeoLib/Polygon.cpp +++ b/GeoLib/Polygon.cpp @@ -141,7 +141,7 @@ bool Polygon::isPartOfPolylineInPolygon(const Polyline& ply) const const std::size_t n_nodes(getNumberOfPoints() - 1); for (std::size_t k(0); k < ply_size - 1; k++) { for (std::size_t j(0); j < n_nodes; j++) { - if (MathLib::lineSegmentIntersect(*(getPoint(j)), *(getPoint(j + 1)), + if (GeoLib::lineSegmentIntersect(*(getPoint(j)), *(getPoint(j + 1)), *(ply.getPoint(k)), *(ply.getPoint(k + 1)), *s)) { delete s; return true; @@ -160,7 +160,7 @@ bool Polygon::getNextIntersectionPointPolygonLine (GeoLib::Point const & a, if (_simple_polygon_list.empty()) { const std::size_t n_nodes(getNumberOfPoints() - 1); for (std::size_t k(seg_num); k < n_nodes; k++) { - if (MathLib::lineSegmentIntersect(*(getPoint(k)), *(getPoint(k + 1)), a, b, *intersection_pnt)) { + if (GeoLib::lineSegmentIntersect(*(getPoint(k)), *(getPoint(k + 1)), a, b, *intersection_pnt)) { seg_num = k; return true; } @@ -171,7 +171,7 @@ bool Polygon::getNextIntersectionPointPolygonLine (GeoLib::Point const & a, const Polygon* polygon(*it); const std::size_t n_nodes_simple_polygon(polygon->getNumberOfPoints() - 1); for (std::size_t k(0); k < n_nodes_simple_polygon; k++) { - if (MathLib::lineSegmentIntersect(*(polygon->getPoint(k)), *(polygon->getPoint(k + 1)), + if (GeoLib::lineSegmentIntersect(*(polygon->getPoint(k)), *(polygon->getPoint(k + 1)), a, b, *intersection_pnt)) { seg_num = k; return true; @@ -246,13 +246,13 @@ void Polygon::ensureCWOrientation () // *** calculate supporting plane (plane normal and MathLib::Vector plane_normal; double d; - MathLib::getNewellPlane(tmp_polygon_pnts, plane_normal, d); + GeoLib::getNewellPlane(tmp_polygon_pnts, plane_normal, d); // *** rotate if necessary double tol (sqrt(std::numeric_limits<double>::min())); if (fabs(plane_normal[0]) > tol || fabs(plane_normal[1]) > tol) // rotate copied points into x-y-plane - MathLib::rotatePointsToXY(plane_normal, tmp_polygon_pnts); + GeoLib::rotatePointsToXY(plane_normal, tmp_polygon_pnts); for (std::size_t k(0); k < tmp_polygon_pnts.size(); k++) (*(tmp_polygon_pnts[k]))[2] = 0.0; // should be -= d but there are numerical errors @@ -270,27 +270,27 @@ void Polygon::ensureCWOrientation () } // *** determine orientation - MathLib::Orientation orient; + GeoLib::Orientation orient; if (0 < min_x_max_y_idx && min_x_max_y_idx < n_pnts - 2) - orient = MathLib::getOrientation ( + orient = GeoLib::getOrientation ( tmp_polygon_pnts[min_x_max_y_idx - 1], tmp_polygon_pnts[min_x_max_y_idx], tmp_polygon_pnts[min_x_max_y_idx + 1]); else { if (0 == min_x_max_y_idx) - orient = MathLib::getOrientation ( + orient = GeoLib::getOrientation ( tmp_polygon_pnts[n_pnts - 1], tmp_polygon_pnts[0], tmp_polygon_pnts[1]); else - orient = MathLib::getOrientation ( + orient = GeoLib::getOrientation ( tmp_polygon_pnts[n_pnts - 2], tmp_polygon_pnts[n_pnts - 1], tmp_polygon_pnts[0]); } - if (orient == MathLib::CCW) + if (orient == GeoLib::CCW) { // switch orientation std::size_t tmp_n_pnts (n_pnts); @@ -309,7 +309,7 @@ void Polygon::splitPolygonAtIntersection (std::list<Polygon*>::iterator polygon_ while (polygon_it != _simple_polygon_list.end()) { GeoLib::Point* intersection_pnt (new GeoLib::Point); - bool is_simple (!MathLib::lineSegmentsIntersect (*polygon_it, + bool is_simple (!GeoLib::lineSegmentsIntersect (*polygon_it, idx0, idx1, *intersection_pnt)); diff --git a/GeoLib/Polyline.cpp b/GeoLib/Polyline.cpp index 2c7d732b11a25b853da6b7832631e74fe5071e86..b2411ca0fe2672e97e51c7d34253a8b03803fb93 100644 --- a/GeoLib/Polyline.cpp +++ b/GeoLib/Polyline.cpp @@ -387,7 +387,7 @@ bool isLineSegmentIntersecting (const Polyline& ply, bool intersect(false); GeoLib::Point intersection_pnt; for (std::size_t k(0); k < n && !intersect; k++) - intersect = MathLib::lineSegmentIntersect (*(ply.getPoint(k)), *(ply.getPoint( + intersect = GeoLib::lineSegmentIntersect (*(ply.getPoint(k)), *(ply.getPoint( k + 1)), s0, s1, intersection_pnt); return intersect; diff --git a/MathLib/EarClippingTriangulation.cpp b/MathLib/EarClippingTriangulation.cpp index ede63e70c3d45f96393b9498a009ca69e60c853a..115406c984ca78c676a318b156dd2ec0eb94192b 100644 --- a/MathLib/EarClippingTriangulation.cpp +++ b/MathLib/EarClippingTriangulation.cpp @@ -39,7 +39,7 @@ EarClippingTriangulation::EarClippingTriangulation(const GeoLib::Polygon* polygo std::vector<GeoLib::Point*> const& ref_pnts_vec (polygon->getPointsVec()); std::list<GeoLib::Triangle>::const_iterator it (_triangles.begin()); - if (_original_orient == MathLib::CW) { + if (_original_orient == GeoLib::CW) { while (it != _triangles.end()) { const std::size_t i0 (polygon->getPointID ((*it)[0])); const std::size_t i1 (polygon->getPointID ((*it)[1])); @@ -112,16 +112,16 @@ void EarClippingTriangulation::ensureCWOrientation () } // determine orientation if (0 < min_x_max_y_idx && min_x_max_y_idx < n_pnts-1) { - _original_orient = MathLib::getOrientation ( + _original_orient = GeoLib::getOrientation ( _pnts[min_x_max_y_idx-1], _pnts[min_x_max_y_idx], _pnts[min_x_max_y_idx+1]); } else { if (0 == min_x_max_y_idx) { - _original_orient = MathLib::getOrientation (_pnts[n_pnts-1], _pnts[0], _pnts[1]); + _original_orient = GeoLib::getOrientation (_pnts[n_pnts-1], _pnts[0], _pnts[1]); } else { - _original_orient = MathLib::getOrientation (_pnts[n_pnts-2], _pnts[n_pnts-1], _pnts[0]); + _original_orient = GeoLib::getOrientation (_pnts[n_pnts-2], _pnts[n_pnts-1], _pnts[0]); } } - if (_original_orient == MathLib::CCW) { + if (_original_orient == GeoLib::CCW) { // switch orientation for (std::size_t k(0); k<n_pnts/2; k++) { std::swap (_pnts[k], _pnts[n_pnts-1-k]); @@ -155,14 +155,14 @@ void EarClippingTriangulation::initLists () prev--; next = it; next++; - MathLib::Orientation orientation; + GeoLib::Orientation orientation; while (next != _vertex_list.end()) { orientation = getOrientation (_pnts[*prev], _pnts[*it], _pnts[*next]); - if (orientation == COLLINEAR) { + if (orientation == GeoLib::COLLINEAR) { it = _vertex_list.erase (it); next++; } else { - if (orientation == CW) { + if (orientation == GeoLib::CW) { _convex_vertex_list.push_back (*it); if (isEar (*prev, *it, *next)) _ear_list.push_back (*it); @@ -175,10 +175,10 @@ void EarClippingTriangulation::initLists () next = _vertex_list.begin(); orientation = getOrientation (_pnts[*prev], _pnts[*it], _pnts[*next]); - if (orientation == COLLINEAR) { + if (orientation == GeoLib::COLLINEAR) { it = _vertex_list.erase (it); } - if (orientation == CW) { + if (orientation == GeoLib::CW) { _convex_vertex_list.push_back (*it); if (isEar (*prev, *it, *next)) _ear_list.push_back (*it); @@ -224,9 +224,9 @@ void EarClippingTriangulation::clipEars() prevprev--; // apply changes to _convex_vertex_list and _ear_list looking "backward" - MathLib::Orientation orientation = getOrientation(_pnts[*prevprev], _pnts[*prev], + GeoLib::Orientation orientation = GeoLib::getOrientation(_pnts[*prevprev], _pnts[*prev], _pnts[*next]); - if (orientation == CW) { + if (orientation == GeoLib::CW) { BaseLib::uniquePushBack(_convex_vertex_list, *prev); // prev is convex if (isEar(*prevprev, *prev, *next)) { @@ -240,7 +240,7 @@ void EarClippingTriangulation::clipEars() // prev is not convex => reflex or collinear _convex_vertex_list.remove(*prev); _ear_list.remove(*prev); - if (orientation == COLLINEAR) { + if (orientation == GeoLib::COLLINEAR) { prev = _vertex_list.erase(prev); if (prev == _vertex_list.begin()) { prev = _vertex_list.end(); @@ -265,7 +265,7 @@ void EarClippingTriangulation::clipEars() // apply changes to _convex_vertex_list and _ear_list looking "forward" orientation = getOrientation(_pnts[*prev], _pnts[*next], _pnts[*nextnext]); - if (orientation == CW) { + if (orientation == GeoLib::CW) { BaseLib::uniquePushBack(_convex_vertex_list, *next); // next is convex if (isEar(*prev, *next, *nextnext)) { @@ -279,7 +279,7 @@ void EarClippingTriangulation::clipEars() // next is not convex => reflex or collinear _convex_vertex_list.remove(*next); _ear_list.remove(*next); - if (orientation == COLLINEAR) { + if (orientation == GeoLib::COLLINEAR) { next = _vertex_list.erase(next); if (next == _vertex_list.end()) next = _vertex_list.begin(); @@ -298,7 +298,7 @@ void EarClippingTriangulation::clipEars() next++; it = next; next++; - if (getOrientation(_pnts[*prev], _pnts[*it], _pnts[*next]) == CCW) + if (getOrientation(_pnts[*prev], _pnts[*it], _pnts[*next]) == GeoLib::CCW) _triangles.push_back(GeoLib::Triangle(_pnts, *prev, *next, *it)); else _triangles.push_back(GeoLib::Triangle(_pnts, *prev, *it, *next)); diff --git a/MathLib/EarClippingTriangulation.h b/MathLib/EarClippingTriangulation.h index 59c42453b966e1f843c4f37a5a027b04a625e662..6f11da70dade3eeecded1dc5a945aaed703d4069 100644 --- a/MathLib/EarClippingTriangulation.h +++ b/MathLib/EarClippingTriangulation.h @@ -58,7 +58,7 @@ private: */ std::list<GeoLib::Triangle> _triangles; - MathLib::Orientation _original_orient; + GeoLib::Orientation _original_orient; }; } // end namespace MathLib diff --git a/MeshLib/Elements/TemplateQuad.tpp b/MeshLib/Elements/TemplateQuad.tpp index 483ec5755985bdec4d30feb8c4233403c905a96b..e79a85a2d87eaee9e7ffbd7077b7bbcc4cf5ba4f 100644 --- a/MeshLib/Elements/TemplateQuad.tpp +++ b/MeshLib/Elements/TemplateQuad.tpp @@ -77,8 +77,8 @@ bool TemplateQuad<NNODES,CELLQUADTYPE>::isEdge(unsigned idx1, unsigned idx2) con template <unsigned NNODES, CellType::type CELLQUADTYPE> bool TemplateQuad<NNODES,CELLQUADTYPE>::isPntInside(GeoLib::Point const& pnt, double eps) const { - return (MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps) || - MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[2], *_nodes[3], eps)); + return (GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps) || + GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[2], *_nodes[3], eps)); } template <unsigned NNODES, CellType::type CELLQUADTYPE> diff --git a/MeshLib/Elements/TemplateTri.tpp b/MeshLib/Elements/TemplateTri.tpp index f051e7edf42adc5267f7c505d558027fc7fc083c..9df036aad07713782542d748eb11e78cafc53a1f 100644 --- a/MeshLib/Elements/TemplateTri.tpp +++ b/MeshLib/Elements/TemplateTri.tpp @@ -64,7 +64,7 @@ bool TemplateTri<NNODES,CELLTRITYPE>::isEdge(unsigned idx1, unsigned idx2) const template <unsigned NNODES, CellType::type CELLTRITYPE> bool TemplateTri<NNODES,CELLTRITYPE>::isPntInside(GeoLib::Point const& pnt, double eps) const { - return MathLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps); + return GeoLib::isPointInTriangle(pnt, *_nodes[0], *_nodes[1], *_nodes[2], eps); } template <unsigned NNODES, CellType::type CELLTRITYPE>