modm API documentation
modm::Polygon2D< T > Class Template Reference

Polygon. More...

#include <modm/math/geometry/polygon_2d.hpp>

Public Member Functions

 Polygon2D (SizeType n)
 Constructs a polygon capable of holding n points.
 
 Polygon2D (std::initializer_list< PointType > init)
 
 Polygon2D (const Polygon2D &other)
 
Polygon2D & operator= (const Polygon2D &other)
 
Polygon2D & operator<< (const PointType &point)
 append a point to the polygon
 
bool intersects (const Polygon2D &other) const
 Check if a intersection exists. More...
 
bool intersects (const Circle2D< T > &circle) const
 Check if a intersection exists.
 
bool intersects (const LineSegment2D< T > &segment) const
 Check if a intersection exists.
 
bool intersects (const Ray2D< T > &segment) const
 Check if a intersection exists.
 
bool getIntersections (const LineSegment2D< T > &segment, PointSet2D< T > &intersectionPoints) const
 Calculate the intersection point(s)
 
bool isInside (const PointType &point)
 

Detailed Description

template<typename T>
class modm::Polygon2D< T >

Polygon.

The Polygon class provides a vector of points. The polygon is implicit closed, which means the first and the last point are connected.

Author
Fabian Greif

Member Function Documentation

template<typename T >
bool modm::Polygon2D< T >::intersects ( const Polygon2D< T > &  other) const

Check if a intersection exists.

template<typename T >
bool modm::Polygon2D< T >::isInside ( const PointType &  point)

Check if the point is contained inside the area of the polygon.

The borders of the polygon are included in the area of the polygon.

Warning
Only works for convex polygons!
Returns
true if point is contained in the area, false if it is outside.

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