MeshKernel
|
A closed polygon. More...
#include <Polygon.hpp>
Public Member Functions | |
Polygon ()=default | |
Default constructor. | |
Polygon (const Polygon ©)=default | |
Default copy constructor. | |
Polygon (Polygon &©)=default | |
Default move constructor. | |
Polygon (const std::vector< Point > &points, Projection projection) | |
Constructor. | |
Polygon (std::vector< Point > &&points, Projection projection) | |
Constructor. More... | |
void | Reset (const std::vector< Point > &points, Projection projection) |
Reset the polygon. | |
Polygon & | operator= (const Polygon ©) |
Copy assignment operator. | |
Polygon & | operator= (Polygon &©) |
Move assignment operator. | |
UInt | Size () const |
Return the number of points in the polygon. | |
const std::vector< Point > & | Nodes () const |
Return vector of nodes of the polygon. | |
Point & | Node (const size_t i) |
Return single point at position. | |
const Point & | Node (const size_t i) const |
Return single point at position. | |
const BoundingBox & | GetBoundingBox () const |
Get the bounding box of the polygon. | |
bool | Contains (const Point &point) const |
Determine if the polygon contains the point. | |
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. More... | |
std::vector< Point > | Refine (UInt startIndex, UInt endIndex, double refinementDistance) const |
Refine the polygon. More... | |
std::vector< Point > | LinearRefine (UInt startIndex, UInt endIndex) const |
Refine the polygon. More... | |
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. | |
std::vector< double > | EdgeLengths () const |
Computes the edge lengths of the polygon. More... | |
std::vector< Point > | ComputeOffset (double displacement, const bool innerAndOuter) const |
Compute the poygon offset. | |
Projection | GetProjection () const |
Get the projection used. | |
Static Public Member Functions | |
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. | |
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. More... | |
A closed polygon.
A polygon consists of at least 3 distinct points, and 1 point to close the polygon.
meshkernel::Polygon::Polygon | ( | std::vector< Point > && | points, |
Projection | projection | ||
) |
Constructor.
std::vector<double> meshkernel::Polygon::EdgeLengths | ( | ) | const |
Computes the edge lengths of the polygon.
|
static |
Compute the area of the polygon, its centre of mass and the direction.
This version uses an indirect indexing of the set of nodes, this can be used to reduce the need to copy nodes to a separate array.
Refine the polygon.
std::vector<Point> meshkernel::Polygon::Refine | ( | UInt | startIndex, |
UInt | endIndex, | ||
double | refinementDistance | ||
) | const |
Refine the polygon.
The refined nodes are placed at equally spaced intervals for each polygon segment. The spacing of the refined nodes may differ between polygon segments.
void meshkernel::Polygon::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.