MeshKernel
|
A class containing a list of polygonaly enclosed regions. More...
#include <Polygons.hpp>
Public Member Functions | |
Polygons ()=default | |
Default constructor. | |
Polygons (const std::vector< Point > &polygon, Projection projection) | |
Constructor. More... | |
std::tuple< UInt, UInt, UInt > | PolygonIndex (UInt startIndex, UInt endIndex) const |
Get index of the polygon, and map the start- and end-index to the start- and end-index of the local polygon nodes. | |
const PolygonalEnclosure & | Enclosure (const UInt index) const |
Get the polygonal enclosure at the index. More... | |
std::vector< std::vector< Point > > | ComputePointsInPolygons () const |
Creates points inside the polygon using triangulation (the edges size determines how many points will be generated) More... | |
std::vector< Point > | RefineFirstPolygon (UInt startIndex, UInt endIndex, double refinementDistance) const |
Refines the polygon edges with additional nodes, from the start to the end index (refinepolygonpart) More... | |
std::vector< Point > | RefinePolygon (UInt polygonIndex, UInt startIndex, UInt endIndex, double refinementDistance) const |
Refines the polygon edges with additional nodes, from the start to the end index (refinepolygonpart) More... | |
std::vector< Point > | LinearRefinePolygon (UInt polygonIndex, UInt startIndex, UInt endIndex) const |
Linear refines the polygon edges with additional nodes, from the start to the end index. More... | |
Polygons | OffsetCopy (double distance, bool innerAndOuter) const |
Makes a new polygon from an existing one, by offsetting it by a distance (copypol) More... | |
void | SnapToLandBoundary (const LandBoundary &landBoundary, UInt startIndex, UInt endIndex) |
Snap the polygon to the land boundary. More... | |
bool | IsPointInPolygon (Point const &point, UInt polygonIndex) const |
Checks if a point is included in a given polygon. When the polygon is empty, the point is always included by default. More... | |
bool | IsPointInAnyPolygon (const Point &point) const |
Checks if a point is included in any of the polygonal enclosures contained. More... | |
std::tuple< bool, UInt > | IsPointInPolygons (const Point &point) const |
Checks if a point is included in any of the polygons (dbpinpol_optinside_perpol) More... | |
std::vector< bool > | PointsInPolygons (const std::vector< Point > &point) const |
For each point, compute the index of the polygon including it. More... | |
bool | IsEmpty () const |
Checks if the polygon is empty. More... | |
UInt | GetNumPolygons () const |
Gives the number of polygons. More... | |
UInt | GetNumNodes () const |
Gets the number of polygon nodes. More... | |
Projection | GetProjection () const |
Gets the projection. More... | |
std::vector< Point > | GatherAllEnclosureNodes () const |
Gets the nodes of all enclosures. | |
BoundingBox | GetBoundingBox (UInt polygonIndex) const |
Gets the bounding box for the polygon index i. More... | |
A class containing a list of polygonaly enclosed regions.
meshkernel::Polygons::Polygons | ( | const std::vector< Point > & | polygon, |
Projection | projection | ||
) |
Constructor.
[in] | polygon | The polygon nodes |
[in] | projection | The projection to use |
std::vector<std::vector<Point> > meshkernel::Polygons::ComputePointsInPolygons | ( | ) | const |
Creates points inside the polygon using triangulation (the edges size determines how many points will be generated)
|
inline |
Get the polygonal enclosure at the index.
BoundingBox meshkernel::Polygons::GetBoundingBox | ( | UInt | polygonIndex | ) | const |
Gets the bounding box for the polygon index i.
[in] | polygonIndex | Outer polygon index |
|
inline |
Gets the number of polygon nodes.
|
inline |
Gives the number of polygons.
|
inline |
Gets the projection.
bool meshkernel::Polygons::IsEmpty | ( | ) | const |
Checks if the polygon is empty.
bool meshkernel::Polygons::IsPointInAnyPolygon | ( | const Point & | point | ) | const |
Checks if a point is included in any of the polygonal enclosures contained.
[in] | point | The point to check |
Checks if a point is included in a given polygon. When the polygon is empty, the point is always included by default.
[in] | point | The point to check |
[in] | polygonIndex | The index of the polygon to account for |
Checks if a point is included in any of the polygons (dbpinpol_optinside_perpol)
[in] | point | The point to check |
std::vector<Point> meshkernel::Polygons::LinearRefinePolygon | ( | UInt | polygonIndex, |
UInt | startIndex, | ||
UInt | endIndex | ||
) | const |
Linear refines the polygon edges with additional nodes, from the start to the end index.
[in] | polygonIndex | The polygon index |
[in] | startIndex | The start index for the node array for the polygon |
[in] | endIndex | The end index for the node array for the polygon |
Polygons meshkernel::Polygons::OffsetCopy | ( | double | distance, |
bool | innerAndOuter | ||
) | const |
Makes a new polygon from an existing one, by offsetting it by a distance (copypol)
[in] | distance | The offset distance |
[in] | innerAndOuter | Offset inwards or outward |
std::vector<bool> meshkernel::Polygons::PointsInPolygons | ( | const std::vector< Point > & | point | ) | const |
For each point, compute the index of the polygon including it.
[in] | point | The vector of points |
std::vector<Point> meshkernel::Polygons::RefineFirstPolygon | ( | UInt | startIndex, |
UInt | endIndex, | ||
double | refinementDistance | ||
) | const |
Refines the polygon edges with additional nodes, from the start to the end index (refinepolygonpart)
[in] | startIndex | The start index |
[in] | endIndex | The end index |
[in] | refinementDistance | The chosen refinement distance |
std::vector<Point> meshkernel::Polygons::RefinePolygon | ( | UInt | polygonIndex, |
UInt | startIndex, | ||
UInt | endIndex, | ||
double | refinementDistance | ||
) | const |
Refines the polygon edges with additional nodes, from the start to the end index (refinepolygonpart)
[in] | polygonIndex | The polygon index |
[in] | startIndex | The start index for the node array for the polygon |
[in] | endIndex | The end index for the node array for the polygon |
[in] | refinementDistance | The chosen refinement distance |
void meshkernel::Polygons::SnapToLandBoundary | ( | const LandBoundary & | landBoundary, |
UInt | startIndex, | ||
UInt | endIndex | ||
) |
Snap the polygon to the land boundary.
The polygon points are snapped to the closest point on the land boundary.
[in] | landBoundary | The land boundary to which the polygon should be snapped. |
[in] | startIndex | The start index |
[in] | endIndex | The end index |