Fishnet 2.0.1
Framework for Graph-Based Analysis of GIS Vector Data
Loading...
Searching...
No Matches
fishnet::geometry::SimplePolygon< T > Class Template Reference

Simple polygon implementation with no holes. More...

#include <SimplePolygon.hpp>

Inheritance diagram for fishnet::geometry::SimplePolygon< T >:
Collaboration diagram for fishnet::geometry::SimplePolygon< T >:

Public Types

using numeric_type = T
 
- Public Types inherited from fishnet::geometry::Ring< T >
using numeric_type = T
 

Public Member Functions

 SimplePolygon (const Ring< T > &boundary)
 
 SimplePolygon (std::initializer_list< Vec2D< T > > &&points)
 
 SimplePolygon (util::random_access_range_of< Vec2D< T > > auto const &points)
 
 SimplePolygon (util::random_access_range_of< Segment< T > > auto const &segments)
 
constexpr util::view_of< Segment< T > > auto getSegments ()=delete
 
constexpr util::random_access_range_of< Vec2D< T > > auto getPoints ()=delete
 
constexpr const Ring< T > & getBoundary () const noexcept
 
constexpr util::view_of< Ring< T > > auto getHoles () const noexcept
 
constexpr Rectangle< T > aaBB () const noexcept
 
template<fishnet::math::Number U>
constexpr bool operator== (const SimplePolygon< U > &other) const noexcept
 
constexpr bool isSimple () const noexcept
 
constexpr bool containsInHole (IPoint auto const &point) const noexcept
 
constexpr bool containsInHole (IPolygon auto const &other) const noexcept
 
constexpr bool contains (IPolygon auto const &other) const noexcept
 
constexpr bool crosses (IPolygon auto const &other) const noexcept
 
constexpr bool touches (IPolygon auto const &other) const noexcept
 
constexpr fishnet::math::DEFAULT_FLOATING_POINT distance (IPolygon auto const &other) const noexcept
 Distance between the two polygons.
 
- Public Member Functions inherited from fishnet::geometry::Ring< T >
 Ring (util::random_access_range_of< Vec2D< T > > auto const &points, bool checked=false)
 
 Ring (util::random_access_range_of< Segment< T > > auto &&segments, bool checked=false)
 
 Ring (std::initializer_list< Vec2D< T > > &&points)
 
template<fishnet::math::Number U>
constexpr operator Ring< U > () const noexcept
 
constexpr const Ring< T > & getBoundary () const noexcept
 
constexpr auto getHoles () const noexcept
 
constexpr util::view_of< Segment< T > > auto getSegments () const noexcept
 
constexpr util::view_of< Vec2D< T > > auto getPoints () const noexcept
 
constexpr fishnet::math::DEFAULT_FLOATING_POINT area () const noexcept
 Calculate the area of the ring Uses Shoelace formula: https://en.wikipedia.org/wiki/Shoelace_formula.
 
constexpr Vec2DReal centroid () const noexcept
 Calculate centroid point of the ring https://en.wikipedia.org/wiki/Centroid.
 
constexpr Rectangle< T > aaBB () const noexcept
 Computes the axis-aligned bounding box of the ring Calculated be computing the extreme points in every direction and forming a rectangle.
 
constexpr bool contains (IPoint auto const &point) const noexcept
 
constexpr bool isInside (IPoint auto const &point) const noexcept
 
constexpr bool isOnBoundary (IPoint auto const &point) const noexcept
 
constexpr bool isOutside (IPoint auto const &point) const noexcept
 
template<LinearGeometry L>
constexpr bool intersects (const L &linearFeature) const noexcept
 test whether a linear feature intersects the ring
 
constexpr std::unordered_set< Vec2DReal > intersections (LinearGeometry auto const &linearFeature) const noexcept
 
constexpr bool contains (ISegment auto const &segment) const noexcept
 Test whether a segment is fully contained inside the boundary of the ring Collect all intersections of the segment with the boundary segments, test if all middle points in-between the intersection points on the segment are contained in the ring.
 
template<fishnet::math::Number U>
constexpr bool operator== (const Ring< U > &other) const noexcept
 
constexpr bool crosses (IRing auto const &other) const noexcept
 
constexpr bool contains (IRing auto const &other) const noexcept
 
constexpr bool touches (IRing auto const &other) const noexcept
 
constexpr fishnet::math::DEFAULT_FLOATING_POINT distance (IRing auto const &other) const noexcept
 Distance between the two rings.
 
constexpr size_t hash () const noexcept
 
constexpr std::string toString () const noexcept
 

Static Public Attributes

static constexpr GeometryType type = GeometryType::POLYGON
 
- Static Public Attributes inherited from fishnet::geometry::Ring< T >
static constexpr GeometryType type = GeometryType::RING
 

Additional Inherited Members

- Protected Member Functions inherited from fishnet::geometry::Ring< T >
constexpr PointLocation getPointLocation (IPoint auto const &point) const noexcept
 Get the location of a point with regard to the ring (INSIDE | OUTSIDE | BOUNDARY) Uses the Ray-Casting algorithm: https://en.wikipedia.org/wiki/Point_in_polygon.
 

Detailed Description

template<fishnet::math::Number T>
class fishnet::geometry::SimplePolygon< T >

Simple polygon implementation with no holes.

Template Parameters
Tnumeric type used for computations

Member Typedef Documentation

◆ numeric_type

template<fishnet::math::Number T>
using fishnet::geometry::SimplePolygon< T >::numeric_type = T

Constructor & Destructor Documentation

◆ SimplePolygon() [1/4]

template<fishnet::math::Number T>
fishnet::geometry::SimplePolygon< T >::SimplePolygon ( const Ring< T > &  boundary)
inline

◆ SimplePolygon() [2/4]

template<fishnet::math::Number T>
fishnet::geometry::SimplePolygon< T >::SimplePolygon ( std::initializer_list< Vec2D< T > > &&  points)
inline

◆ SimplePolygon() [3/4]

template<fishnet::math::Number T>
fishnet::geometry::SimplePolygon< T >::SimplePolygon ( util::random_access_range_of< Vec2D< T > > auto const &  points)
inline

◆ SimplePolygon() [4/4]

template<fishnet::math::Number T>
fishnet::geometry::SimplePolygon< T >::SimplePolygon ( util::random_access_range_of< Segment< T > > auto const &  segments)
inline

Member Function Documentation

◆ aaBB()

template<fishnet::math::Number T>
constexpr Rectangle< T > fishnet::geometry::SimplePolygon< T >::aaBB ( ) const
inlineconstexprnoexcept

◆ contains()

template<fishnet::math::Number T>
constexpr bool fishnet::geometry::SimplePolygon< T >::contains ( IPolygon auto const &  other) const
inlineconstexprnoexcept

◆ containsInHole() [1/2]

template<fishnet::math::Number T>
constexpr bool fishnet::geometry::SimplePolygon< T >::containsInHole ( IPoint auto const &  point) const
inlineconstexprnoexcept

◆ containsInHole() [2/2]

template<fishnet::math::Number T>
constexpr bool fishnet::geometry::SimplePolygon< T >::containsInHole ( IPolygon auto const &  other) const
inlineconstexprnoexcept

◆ crosses()

template<fishnet::math::Number T>
constexpr bool fishnet::geometry::SimplePolygon< T >::crosses ( IPolygon auto const &  other) const
inlineconstexprnoexcept

◆ distance()

template<fishnet::math::Number T>
constexpr fishnet::math::DEFAULT_FLOATING_POINT fishnet::geometry::SimplePolygon< T >::distance ( IPolygon auto const &  other) const
inlineconstexprnoexcept

Distance between the two polygons.

Returns
0 if the polygons overlap in any way, i.e. if one contains or touches the other, otherwise the distance between their boundaries

◆ getBoundary()

template<fishnet::math::Number T>
constexpr const Ring< T > & fishnet::geometry::SimplePolygon< T >::getBoundary ( ) const
inlineconstexprnoexcept

◆ getHoles()

template<fishnet::math::Number T>
constexpr util::view_of< Ring< T > > auto fishnet::geometry::SimplePolygon< T >::getHoles ( ) const
inlineconstexprnoexcept

◆ getPoints()

template<fishnet::math::Number T>
constexpr util::random_access_range_of< Vec2D< T > > auto fishnet::geometry::SimplePolygon< T >::getPoints ( )
constexprdelete

◆ getSegments()

template<fishnet::math::Number T>
constexpr util::view_of< Segment< T > > auto fishnet::geometry::SimplePolygon< T >::getSegments ( )
constexprdelete

◆ isSimple()

template<fishnet::math::Number T>
constexpr bool fishnet::geometry::SimplePolygon< T >::isSimple ( ) const
inlineconstexprnoexcept

◆ operator==()

template<fishnet::math::Number T>
template<fishnet::math::Number U>
constexpr bool fishnet::geometry::SimplePolygon< T >::operator== ( const SimplePolygon< U > &  other) const
inlineconstexprnoexcept

◆ touches()

template<fishnet::math::Number T>
constexpr bool fishnet::geometry::SimplePolygon< T >::touches ( IPolygon auto const &  other) const
inlineconstexprnoexcept

Member Data Documentation

◆ type

template<fishnet::math::Number T>
constexpr GeometryType fishnet::geometry::SimplePolygon< T >::type = GeometryType::POLYGON
staticconstexpr

The documentation for this class was generated from the following file: