32#include "MeshKernel/BoundingBox.hpp"
33#include "MeshKernel/Definitions.hpp"
34#include "MeshKernel/Point.hpp"
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 void ComputeResampledNodes(
const size_t numberOfNewNodes,
173 const std::vector<double>& segmentLengths,
174 const std::vector<size_t>& nodeIndices,
175 std::vector<Point>& refinedPolygon)
const;
178 std::tuple<meshkernel::UInt, meshkernel::UInt>
179 FindMinMaxRatioIndex(
const std::vector<double>& averageLengths,
180 const std::vector<double>& actualAverageLengths)
const;
183 static meshkernel::Point interpolatePointOnPolyline(
const std::vector<meshkernel::Point>& points,
184 const std::vector<double>& cumulativeDistances,
185 const double pointDistance);
193 bool ContainsCartesian(
const Point& point)
const;
196 bool ContainsSphericalAccurate(
const Point& point)
const;
199 std::vector<Point> m_nodes;
202 Projection m_projection = Projection::cartesian;
212 return static_cast<UInt>(m_nodes.size());
232 return m_boundingBox;
A class defining a bounding box.
Definition BoundingBox.hpp:40
A class containing the land boundary polylines.
Definition LandBoundary.hpp:40
A struct describing a point in a two-dimensional space.
Definition Point.hpp:41
A closed polygon.
Definition Polygon.hpp:46
Polygon(std::vector< Point > &&points, Projection projection)
Constructor.
Point & Node(const size_t i)
Return single point at position.
Definition Polygon.hpp:220
static std::tuple< double, Point, TraversalDirection > FaceAreaAndCenterOfMass(const std::vector< Point > &nodes, const std::vector< UInt > &nodeIndices, const Projection projection, bool isClosed)
Compute the area of the polygon, its centre of mass and the direction.
void Reset(const std::vector< Point > &points, Projection projection)
Reset the polygon.
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(Polygon &©)=default
Default move constructor.
std::tuple< double, Point, TraversalDirection > FaceAreaAndCenterOfMass() const
Compute the area of the polygon, its centre of mass and the direction.
Polygon(const std::vector< Point > &points, Projection projection)
Constructor.
Polygon(const Polygon ©)=default
Default copy constructor.
Polygon & operator=(Polygon &©)
Move assignment operator.
const BoundingBox & GetBoundingBox() const
Get the bounding box of the polygon.
Definition Polygon.hpp:230
Projection GetProjection() const
Get the projection used.
Definition Polygon.hpp:235
std::vector< Point > ComputeOffset(double displacement, const bool innerAndOuter) const
Compute the poygon offset.
std::vector< Point > Refine(UInt startIndex, UInt endIndex, double refinementDistance) const
Refine the polygon.
UInt Size() const
Return the number of points in the polygon.
Definition Polygon.hpp:210
const std::vector< Point > & Nodes() const
Return vector of nodes of the polygon.
Definition Polygon.hpp:215
Polygon & operator=(const Polygon ©)
Copy assignment operator.
std::vector< double > EdgeLengths() const
Computes the edge lengths of the polygon.
bool Contains(const Point &point) const
Determine if the polygon contains the point.
static std::tuple< double, Point, TraversalDirection > FaceAreaAndCenterOfMass(const std::vector< Point > &polygon, const Projection projection)
Compute the area of the polygon, its centre of mass and the direction.
std::vector< Point > LinearRefine(UInt startIndex, UInt endIndex) const
Refine the polygon.
double PerimeterLength() const
Compute the perimiter length of the closed polygon.
Polygon()=default
Default constructor.
Contains the logic of the C++ static library.
Definition AveragingInterpolation.hpp:37
Projection
Enumerator describing the supported projections.
Definition Definitions.hpp:43
std::uint32_t UInt
Integer type used when indexing mesh graph entities.
Definition Definitions.hpp:39