OGS
Polygon.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <list>
18#include <vector>
19
20#include "AABB.h"
21#include "Point.h"
22#include "Polyline.h"
23
24namespace GeoLib
25{
30class Polygon : public Polyline
31{
32public:
39 explicit Polygon(const Polyline& ply, bool init = true);
40
41 Polygon(Polygon const& other);
42 Polygon& operator=(Polygon const& rhs) = delete;
43
44 ~Polygon() override;
45
46 bool initialise();
47
54 bool isPntInPolygon(MathLib::Point3d const& pnt) const;
55
62 bool containsSegment(GeoLib::LineSegment const& segment) const;
63
69 bool isPolylineInPolygon(const Polyline& ply) const;
78 bool isPartOfPolylineInPolygon(const Polyline& ply) const;
79
91 GeoLib::Point& intersection_pnt,
92 std::size_t& seg_num) const;
93
96 std::list<Polygon*> const& computeListOfSimplePolygons();
97
98 friend bool operator==(Polygon const& lhs, Polygon const& rhs);
99
100private:
102
104 const std::list<Polygon*>::const_iterator& polygon_it);
105
106 void splitPolygonAtPoint(const std::list<Polygon*>::iterator& polygon_it);
107 std::list<Polygon*> _simple_polygon_list;
109};
110
117bool operator==(Polygon const& lhs, Polygon const& rhs);
118
119} // end namespace GeoLib
Definition of the AABB class.
Definition of the Point class.
Definition of the PolyLine class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:56
std::list< Polygon * > const & computeListOfSimplePolygons()
Definition Polygon.cpp:693
friend bool operator==(Polygon const &lhs, Polygon const &rhs)
Definition Polygon.cpp:596
Polygon & operator=(Polygon const &rhs)=delete
bool isPolylineInPolygon(const Polyline &ply) const
Definition Polygon.cpp:332
void splitPolygonAtPoint(const std::list< Polygon * >::iterator &polygon_it)
Definition Polygon.cpp:532
bool isPntInPolygon(MathLib::Point3d const &pnt) const
Definition Polygon.cpp:205
void splitPolygonAtIntersection(const std::list< Polygon * >::const_iterator &polygon_it)
Definition Polygon.cpp:473
bool isPartOfPolylineInPolygon(const Polyline &ply) const
Definition Polygon.cpp:339
bool containsSegment(GeoLib::LineSegment const &segment) const
Definition Polygon.cpp:261
~Polygon() override
Definition Polygon.cpp:158
std::list< Polygon * > _simple_polygon_list
Definition Polygon.h:107
bool getNextIntersectionPointPolygonLine(GeoLib::LineSegment const &seg, GeoLib::Point &intersection_pnt, std::size_t &seg_num) const
Definition Polygon.cpp:365
bool initialise()
Definition Polygon.cpp:171
void ensureCCWOrientation()
Definition Polygon.cpp:399
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition Polyline.h:40
friend class Polygon
Definition Polyline.h:90
bool operator==(LineSegment const &s0, LineSegment const &s1)