32 #include "MeshKernel/BoundingBox.hpp"
33 #include "MeshKernel/Definitions.hpp"
34 #include "MeshKernel/Point.hpp"
58 Polygon(
const std::vector<Point>& points,
63 Polygon(std::vector<Point>&& points,
67 void Reset(
const std::vector<Point>& points,
80 const std::vector<Point>&
Nodes()
const;
104 std::vector<Point>
Refine(
UInt startIndex,
UInt endIndex,
double refinementDistance)
const;
121 const std::vector<UInt>& nodeIndices,
133 std::vector<Point>
ComputeOffset(
double displacement,
const bool innerAndOuter)
const;
146 static void RefineSegment(std::vector<meshkernel::Point>& refinedPolygon,
147 const std::vector<meshkernel::Point>::const_iterator& nodeIterator,
148 const double refinementDistance,
152 static void computeAverageLengths(
const std::vector<double>& cumulativeDistances, std::vector<double>& averageDistances);
155 static void smoothCumulativeDistance(
const std::vector<double>& averageDistances, std::vector<double>& cumulativeDistances);
158 static void smoothAverageLengths(
const std::vector<double>& cumulativeDistances,
159 const double firstDistance,
160 const double lastDistance,
161 std::vector<double>& averageLengths);
164 static meshkernel::Point interpolatePointOnPolyline(
const std::vector<meshkernel::Point>& points,
165 const std::vector<double>& cumulativeDistances,
166 const double pointDistance);
174 bool ContainsCartesian(
const Point& point)
const;
177 bool ContainsSphericalAccurate(
const Point& point)
const;
180 std::vector<Point> m_nodes;
183 Projection m_projection = Projection::cartesian;
193 return static_cast<UInt>(m_nodes.size());
213 return m_boundingBox;
Projection
Enumerator describing the supported projections.
Definition: Definitions.hpp:41
A class defining a bounding box.
Definition: BoundingBox.hpp:39
std::vector< Point > LinearRefine(UInt startIndex, UInt endIndex) const
Refine the polygon.
Projection GetProjection() const
Get the projection used.
Definition: Polygon.hpp:216
A struct describing a point in a two-dimensional space.
Definition: Point.hpp:40
std::tuple< double, Point, TraversalDirection > FaceAreaAndCenterOfMass() const
Compute the area of the polygon, its centre of mass and the direction.
double PerimeterLength() const
Compute the perimiter length of the closed polygon.
bool Contains(const Point &point) const
Determine if the polygon contains the point.
A class containing the land boundary polylines.
Definition: LandBoundary.hpp:39
A closed polygon.
Definition: Polygon.hpp:45
std::vector< Point > ComputeOffset(double displacement, const bool innerAndOuter) const
Compute the poygon offset.
Polygon()=default
Default constructor.
void SnapToLandBoundary(const size_t startIndex, const size_t endIndex, const LandBoundary &boundary)
Snap the section of the polygon defined by start- and end-index to the land boundary.
Polygon & operator=(const Polygon ©)
Copy assignment operator.
Point & Node(const size_t i)
Return single point at position.
Definition: Polygon.hpp:201
std::vector< Point > Refine(UInt startIndex, UInt endIndex, double refinementDistance) const
Refine the polygon.
Contains the logic of the C++ static library.
Definition: AveragingInterpolation.hpp:36
const std::vector< Point > & Nodes() const
Return vector of nodes of the polygon.
Definition: Polygon.hpp:196
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition: Definitions.hpp:38
const BoundingBox & GetBoundingBox() const
Get the bounding box of the polygon.
Definition: Polygon.hpp:211
void Reset(const std::vector< Point > &points, Projection projection)
Reset the polygon.
UInt Size() const
Return the number of points in the polygon.
Definition: Polygon.hpp:191
std::vector< double > EdgeLengths() const
Computes the edge lengths of the polygon.