template<typename T>
recti::RPolygon class

Rectilinear Polygon.

Template parameters
T

RPolygon is a class template that represents a rectilinear polygon. It stores the origin point and a vector of edges that define the polygon. The template parameter T specifies the type of the coordinates of the points.

Constructors, destructors, conversion operators

RPolygon(gsl::span<const Point<T>> pointset) explicit constexpr
Constructs a new RPolygon object from a set of points.

Public functions

auto operator+=(const Vector2<T>& vector) -> RPolygon & -> auto constexpr
Adds a vector to the origin of the rectilinear polygon.
auto signed_area() const -> T -> auto constexpr
Calculates the signed area of the rectilinear polygon.
template<typename U>
auto contains(const Point<U>& rhs) const -> bool -> auto
Checks if the given point is contained within the rectilinear polygon.
auto lb() const -> Point< T > -> auto
auto ub() const -> Point< T > -> auto

Function documentation

template<typename T>
recti::RPolygon<T>::RPolygon(gsl::span<const Point<T>> pointset) explicit constexpr

Constructs a new RPolygon object from a set of points.

Parameters
pointset in A span of Point<T> objects representing the vertices of the rectilinear polygon.

This constructor takes a gsl::span of Point<T> objects representing the vertices of the rectilinear polygon. The first point in the span is used as the origin of the polygon, and the remaining points are used to construct the vectors that define the edges of the polygon.

template<typename T>
auto recti::RPolygon<T>::operator+=(const Vector2<T>& vector) -> RPolygon & constexpr

Adds a vector to the origin of the rectilinear polygon.

Parameters
vector in The vector to add to the origin.
Returns A reference to the modified RPolygon object.

This method adds the given vector to the origin point of the rectilinear polygon, effectively translating the entire polygon by the specified vector.

template<typename T>
auto recti::RPolygon<T>::signed_area() const -> T constexpr

Calculates the signed area of the rectilinear polygon.

Returns The signed area of the rectilinear polygon.

This method calculates the signed area of the rectilinear polygon represented by this RPolygon object.

template<typename T> template<typename U>
auto recti::RPolygon<T>::contains(const Point<U>& rhs) const -> bool

Checks if the given point is contained within the rectilinear polygon.

Template parameters
U The type of the point coordinates.
Parameters
rhs in The point to check for containment.
Returns true if the point is contained within the rectilinear polygon, false otherwise.

This method checks if the provided point is contained within the rectilinear polygon represented by this RPolygon object.

template<typename T>
auto recti::RPolygon<T>::lb() const -> Point< T >

Returns Point<T>

template<typename T>
auto recti::RPolygon<T>::ub() const -> Point< T >

Returns Point<T>