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 void GetPolygonNodes(
const UInt startIndex,
166 std::vector<Point>& polygonNodes)
const;
169 std::vector<double> ComputeCumulativeDistances(
const std::vector<meshkernel::Point>& polygonNodes)
const;
172 std::tuple<meshkernel::UInt, meshkernel::UInt>
173 FindMinMaxRatioIndex(
const std::vector<double>& averageLengths,
174 const std::vector<double>& actualAverageLengths)
const;
177 static meshkernel::Point interpolatePointOnPolyline(
const std::vector<meshkernel::Point>& points,
178 const std::vector<double>& cumulativeDistances,
179 const double pointDistance);
187 bool ContainsCartesian(
const Point& point)
const;
190 bool ContainsSphericalAccurate(
const Point& point)
const;
193 std::vector<Point> m_nodes;
196 Projection m_projection = Projection::cartesian;
206 return static_cast<UInt>(m_nodes.size());
226 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:229
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:214
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:209
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:224
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:204
std::vector< double > EdgeLengths() const
Computes the edge lengths of the polygon.