Polygon

template<class T>
class Polygon
#include <polygon.hpp>

A polygon represented by a list of its vertices.

Public Functions

inline Polygon()
inline Polygon(const std::vector<Vect2<T>> &vertices)
inline int vertexCount() const

Returns the number of vertices in the polygon.

inline Vect2<T> vertex(const int i) const

Returns the i-th vertex of the polygon.

inline const std::vector<Vect2<T>> &vertices() const
inline void addVertex(const Vect2<T> vertex)

Adds a vertex at the end of the list.

bool isOnBoundary(const Vect2<T>) const

Tests if a point is on the boundary of the polygon.

bool isInside(const Vect2<T>) const

Tests if a point is inside the polyon.

bool isStrictlyInside(const Vect2<T>) const

Tests if a point is strictly inside the polyon.

Private Functions

bool isInsideNotBoundary(const Vect2<T>) const

Tests if a point outside the boundary is inside the polygon.

Private Members

std::vector<Vect2<T>> m_vertices