Skip to content
Snippets Groups Projects
Commit 47b22672 authored by Tom Fischer's avatar Tom Fischer Committed by Dmitri Naumov
Browse files

[GL] clang-format GeoLib::Polygon::isPntInPolygon.

parent a88b7683
No related branches found
No related tags found
No related merge requests found
...@@ -70,7 +70,7 @@ bool Polygon::initialise () ...@@ -70,7 +70,7 @@ bool Polygon::initialise ()
return false; return false;
} }
bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const bool Polygon::isPntInPolygon(GeoLib::Point const& pnt) const
{ {
MathLib::Point3d const& min_aabb_pnt(_aabb.getMinPoint()); MathLib::Point3d const& min_aabb_pnt(_aabb.getMinPoint());
MathLib::Point3d const& max_aabb_pnt(_aabb.getMaxPoint()); MathLib::Point3d const& max_aabb_pnt(_aabb.getMaxPoint());
...@@ -81,24 +81,29 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const ...@@ -81,24 +81,29 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const
return false; return false;
} }
if (_simple_polygon_list.size() == 1) { if (_simple_polygon_list.size() == 1)
{
std::size_t n_intersections(0); std::size_t n_intersections(0);
const std::size_t n_nodes (getNumberOfPoints() - 1); const std::size_t n_nodes(getNumberOfPoints() - 1);
for (std::size_t k(0); k < n_nodes; k++) { for (std::size_t k(0); k < n_nodes; k++)
if (((*(getPoint(k)))[1] <= pnt[1] && pnt[1] <= (*(getPoint(k + 1)))[1]) || {
((*(getPoint(k + 1)))[1] <= pnt[1] && pnt[1] <= (*(getPoint(k)))[1])) { if (((*(getPoint(k)))[1] <= pnt[1] &&
pnt[1] <= (*(getPoint(k + 1)))[1]) ||
((*(getPoint(k + 1)))[1] <= pnt[1] &&
pnt[1] <= (*(getPoint(k)))[1]))
{
switch (getEdgeType(k, pnt)) switch (getEdgeType(k, pnt))
{ {
case EdgeType::TOUCHING: case EdgeType::TOUCHING:
return true; return true;
case EdgeType::CROSSING: case EdgeType::CROSSING:
n_intersections++; n_intersections++;
break; break;
case EdgeType::INESSENTIAL: case EdgeType::INESSENTIAL:
break; break;
default: default:
// do nothing // do nothing
; ;
} }
} }
} }
...@@ -106,7 +111,9 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const ...@@ -106,7 +111,9 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const
{ {
return true; return true;
} }
} else { }
else
{
for (auto it(_simple_polygon_list.begin()++); for (auto it(_simple_polygon_list.begin()++);
it != _simple_polygon_list.end(); it != _simple_polygon_list.end();
++it) ++it)
...@@ -124,7 +131,7 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const ...@@ -124,7 +131,7 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const
bool Polygon::isPntInPolygon(double x, double y, double z) const bool Polygon::isPntInPolygon(double x, double y, double z) const
{ {
const GeoLib::Point pnt(x,y,z); const GeoLib::Point pnt(x,y,z);
return isPntInPolygon (pnt); return isPntInPolygon(pnt);
} }
std::vector<GeoLib::Point> Polygon::getAllIntersectionPoints( std::vector<GeoLib::Point> Polygon::getAllIntersectionPoints(
......
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