eckit::geo::polygon::Polygon class

Public types

using container_type = vector

Constructors, destructors, conversion operators

Polygon(const container_type& points) explicit
Polygon(container_type&& points) explicit
Polygon(const Polygon&) defaulted
Polygon(Polygon&&) defaulted
~Polygon() defaulted

Public functions

auto operator=(const Polygon&) -> Polygon& defaulted
auto operator=(Polygon&&) -> Polygon& defaulted
auto operator==(const Polygon&) const -> bool
auto operator!=(const Polygon& other) const -> bool
auto intersects(area::BoundingBox& bbox) const -> bool
Intersect polygon with bounding box.
auto contains(const PointLonLat& P) const -> bool
Point-in-polygon test based on winding number.
auto centroid() const -> PointLonLat
Centroid of polygon.
void clip(const Polygon&)
Clip polygon with another polygon (commutative)
void simplify()
Simplify polygon by removing consecutive and colinear points.
auto area(bool sign = false) const -> double
Area of polygon.
auto assign(T... args) -> T
auto at(T... args) -> T
auto back(T... args) -> T
auto begin(T... args) -> T
auto capacity(T... args) -> T
auto cbegin(T... args) -> T
auto cend(T... args) -> T
auto clear(T... args) -> T
auto crbegin(T... args) -> T
auto crend(T... args) -> T
auto data(T... args) -> T
auto emplace(T... args) -> T
auto emplace_back(T... args) -> T
auto empty(T... args) -> T
auto end(T... args) -> T
auto erase(T... args) -> T
auto front(T... args) -> T
auto get_allocator(T... args) -> T
auto insert(T... args) -> T
auto max_size(T... args) -> T
auto operator[](T... args) -> T
auto pop_back(T... args) -> T
auto push_back(T... args) -> T
auto rbegin(T... args) -> T
auto rend(T... args) -> T
auto reserve(T... args) -> T
auto resize(T... args) -> T
auto shrink_to_fit(T... args) -> T
auto size(T... args) -> T
auto swap(T... args) -> T

Friends

auto operator<<(std::ostream&, const Polygon&) -> std::ostream&

Function documentation

bool eckit::geo::polygon::Polygon::intersects(area::BoundingBox& bbox) const

Intersect polygon with bounding box.

Parameters
bbox in/out bounding box to intersect with, returns intersection
Returns if polygon intersects bounding box

bool eckit::geo::polygon::Polygon::contains(const PointLonLat& P) const

Point-in-polygon test based on winding number.

Returns if point is in polygon

PointLonLat eckit::geo::polygon::Polygon::centroid() const

Centroid of polygon.

Returns centroid

double eckit::geo::polygon::Polygon::area(bool sign = false) const

Area of polygon.

Parameters
sign in if true, returns positive area irrespective of point ordering
Returns area respecting point ordering (positive on CCW point ordering)