Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
pgl::EmptyShape< PointType_ > Struct Template Reference

The empty set of points in the plane. More...

#include <emptyshape.hpp>

Inheritance diagram for pgl::EmptyShape< PointType_ >:
[legend]

Public Types

using PointType = PointType_
using NumberType = typename PointType::NumberType
using LabelType = typename PointType::LabelType

Public Member Functions

constexpr EmptyShape ()=default
 Creates the (unique) empty shape.
constexpr bool operator== (const EmptyShape &) const =default
 All empty shapes are equal and unordered among themselves.
constexpr auto operator<=> (const EmptyShape &) const =default
 Three-way comparison: all empty shapes are equivalent.
template<AnyShapeConcept OtherShape>
constexpr bool samePointSet (const OtherShape &other) const
 Tests whether another shape defines the empty point set.
constexpr bool isDegenerate () const
 The empty shape is never degenerate.
constexpr bool isUndefined () const
 The empty shape is never undefined.
PointType get (std::ptrdiff_t) const
 Always throws: the empty shape has no vertices.
PointType operator[] (std::size_t) const
 Always throws: the empty shape has no vertices.
template<class T>
std::ptrdiff_t index (const T &) const
 Always throws: the empty shape has no vertices.
template<class T>
constexpr bool contains (const T &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PointConcept OtherPoint>
constexpr bool contains (const EmptyShape< OtherPoint > &) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<class T>
constexpr bool boundaryContains (const T &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PointConcept OtherPoint>
constexpr bool boundaryContains (const EmptyShape< OtherPoint > &) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<class T>
constexpr bool interiorContains (const T &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PointConcept OtherPoint>
constexpr bool interiorContains (const EmptyShape< OtherPoint > &) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<class T>
constexpr bool intersects (const T &) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<class T>
constexpr bool interiorsIntersect (const T &) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<class T>
constexpr bool separates (const T &) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<class T>
constexpr bool crosses (const T &) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<class ResultNumber = NumberType, class T>
constexpr EmptyShape intersection (const T &) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class OtherShape>
requires MinkowskiSummableConcept<EmptyShape<PointType_>, OtherShape>
constexpr auto minkowskiSum (const OtherShape &other) const
 Returns the Minkowski sum of this shape and another (A ⊕ B).
template<class OtherShape>
requires MinkowskiSummableConcept<EmptyShape<PointType_>, OtherShape>
constexpr auto minkowskiErosion (const OtherShape &other) const
 Returns the Minkowski erosion of this shape by another (A ⊖ B).
template<PointConcept OtherPoint>
constexpr EmptyShapeoperator+= (const OtherPoint &)
 Translates the empty shape in place; a no-op.
template<PointConcept OtherPoint>
constexpr EmptyShapeoperator-= (const OtherPoint &)
 Translates the empty shape in place by a negated point; a no-op.
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr EmptyShapeoperator*= (const Scalar &)
 Scales the empty shape in place around the origin; a no-op.
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr EmptyShapeoperator/= (const Scalar &)
 Divides the empty shape in place around the origin; a no-op.
constexpr EmptyShape rotated90 (int=1) const
 Returns the empty shape rotated by 90k degrees; a no-op.
constexpr void rotate90 (int=1)
 Rotates the empty shape by 90k degrees in place; a no-op.
template<class OtherNumber>
constexpr EmptyShape scaledUpX (const OtherNumber) const
 Returns the empty shape with its x-coordinates scaled up; a no-op.
template<class OtherNumber>
constexpr void scaleUpX (const OtherNumber)
 Scales the empty shape's x-coordinates up in place; a no-op.
template<class OtherNumber>
constexpr EmptyShape scaledUpY (const OtherNumber) const
 Returns the empty shape with its y-coordinates scaled up; a no-op.
template<class OtherNumber>
constexpr void scaleUpY (const OtherNumber)
 Scales the empty shape's y-coordinates up in place; a no-op.
template<class OtherNumber>
constexpr EmptyShape scaledDownX (const OtherNumber) const
 Returns the empty shape with its x-coordinates scaled down; a no-op.
template<class OtherNumber>
constexpr void scaleDownX (const OtherNumber)
 Scales the empty shape's x-coordinates down in place; a no-op.
template<class OtherNumber>
constexpr EmptyShape scaledDownY (const OtherNumber) const
 Returns the empty shape with its y-coordinates scaled down; a no-op.
template<class OtherNumber>
constexpr void scaleDownY (const OtherNumber)
 Scales the empty shape's y-coordinates down in place; a no-op.

Static Public Member Functions

static constexpr std::size_t size ()
 Returns the number of vertices, always 0.

Detailed Description

template<class PointType_ = Point<>>
struct pgl::EmptyShape< PointType_ >

The empty set of points in the plane.

Template Parameters
PointType_Point type the shape is nominally parameterized on; only its associated types are used, since an empty shape stores no coordinates.

Member Typedef Documentation

◆ LabelType

template<class PointType_ = Point<>>
using pgl::EmptyShape< PointType_ >::LabelType = typename PointType::LabelType

◆ NumberType

template<class PointType_ = Point<>>
using pgl::EmptyShape< PointType_ >::NumberType = typename PointType::NumberType

◆ PointType

template<class PointType_ = Point<>>
using pgl::EmptyShape< PointType_ >::PointType = PointType_

Constructor & Destructor Documentation

◆ EmptyShape()

template<class PointType_ = Point<>>
pgl::EmptyShape< PointType_ >::EmptyShape ( )
constexprdefault

Creates the (unique) empty shape.

Member Function Documentation

◆ boundaryContains() [1/2]

template<class PointType_ = Point<>>
template<PointConcept OtherPoint>
bool pgl::EmptyShape< PointType_ >::boundaryContains ( const EmptyShape< OtherPoint > & ) const
inlinenodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [2/2]

template<class PointType_ = Point<>>
template<class T>
bool pgl::EmptyShape< PointType_ >::boundaryContains ( const T & other) const
inlinenodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ contains() [1/2]

template<class PointType_ = Point<>>
template<PointConcept OtherPoint>
bool pgl::EmptyShape< PointType_ >::contains ( const EmptyShape< OtherPoint > & ) const
inlinenodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [2/2]

template<class PointType_ = Point<>>
template<class T>
bool pgl::EmptyShape< PointType_ >::contains ( const T & other) const
inlinenodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ crosses()

template<class PointType_ = Point<>>
template<class T>
bool pgl::EmptyShape< PointType_ >::crosses ( const T & ) const
inlinenodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ get()

template<class PointType_ = Point<>>
PointType pgl::EmptyShape< PointType_ >::get ( std::ptrdiff_t ) const
inlinenodiscard

Always throws: the empty shape has no vertices.

◆ index()

template<class PointType_ = Point<>>
template<class T>
std::ptrdiff_t pgl::EmptyShape< PointType_ >::index ( const T & ) const
inlinenodiscard

Always throws: the empty shape has no vertices.

◆ interiorContains() [1/2]

template<class PointType_ = Point<>>
template<PointConcept OtherPoint>
bool pgl::EmptyShape< PointType_ >::interiorContains ( const EmptyShape< OtherPoint > & ) const
inlinenodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [2/2]

template<class PointType_ = Point<>>
template<class T>
bool pgl::EmptyShape< PointType_ >::interiorContains ( const T & other) const
inlinenodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorsIntersect()

template<class PointType_ = Point<>>
template<class T>
bool pgl::EmptyShape< PointType_ >::interiorsIntersect ( const T & ) const
inlinenodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ intersection()

template<class PointType_ = Point<>>
template<class ResultNumber = NumberType, class T>
EmptyShape pgl::EmptyShape< PointType_ >::intersection ( const T & ) const
inlinenodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

◆ intersects()

template<class PointType_ = Point<>>
template<class T>
bool pgl::EmptyShape< PointType_ >::intersects ( const T & ) const
inlinenodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ isDegenerate()

template<class PointType_ = Point<>>
bool pgl::EmptyShape< PointType_ >::isDegenerate ( ) const
inlinenodiscardconstexpr

The empty shape is never degenerate.

◆ isUndefined()

template<class PointType_ = Point<>>
bool pgl::EmptyShape< PointType_ >::isUndefined ( ) const
inlinenodiscardconstexpr

The empty shape is never undefined.

The empty shape is not degenerate, so this always returns false. Provided for uniformity with the other shapes.

Returns
false.

◆ minkowskiErosion()

template<class PointType>
requires MinkowskiSummableConcept<EmptyShape<PointType_>, OtherShape>
template<class OtherShape>
requires MinkowskiSummableConcept<EmptyShape<PointType_>, OtherShape>
auto pgl::EmptyShape< PointType >::minkowskiErosion ( const OtherShape & other) const
nodiscardconstexpr

Returns the Minkowski erosion of this shape by another (A ⊖ B).

The erosion is the point set {x : x ⊕ B ⊆ A}, the translations of other that keep it inside this shape – equivalently ⋂ {A - b : b ∈ B}. It is the morphological dual of minkowskiSum and is defined for the same pairs, but it is not commutative.

Eroding by a Point is the translation by its negation, so it returns this shape's own type; the other pairs come back as the convex region they are, a HalfplaneIntersection, which holds a lower-dimensional erosion and the empty one as readily as a two-dimensional one. Nothing fits inside the empty set, so every erosion of one is empty – except by another empty shape, which fits vacuously.

Eroding by a shape that covers no point is the whole plane, which a HalfplaneIntersection returns and the tighter result types cannot.

Template Parameters
OtherShapeType of the shape to erode by.
Parameters
otherShape to erode by.
Returns
The erosion, in the tightest type that represents it.

◆ minkowskiSum()

template<class PointType>
requires MinkowskiSummableConcept<EmptyShape<PointType_>, OtherShape>
template<class OtherShape>
requires MinkowskiSummableConcept<EmptyShape<PointType_>, OtherShape>
auto pgl::EmptyShape< PointType >::minkowskiSum ( const OtherShape & other) const
nodiscardconstexpr

Returns the Minkowski sum of this shape and another (A ⊕ B).

The sum is the point set {a + b : a ∈ A, b ∈ B}. Summing with a Point is a translation, so it returns this shape's own type; two bounded convex shapes sum to a Convex, or to a Rectangle when both are rectangles. See MinkowskiSummableConcept for the pairs a Minkowski sum is defined for.

Template Parameters
OtherShapeType of the other shape.
Parameters
otherShape to sum with.
Returns
The Minkowski sum, in the tightest type that represents it.

◆ operator*=()

template<class PointType_ = Point<>>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
EmptyShape & pgl::EmptyShape< PointType_ >::operator*= ( const Scalar & )
inlineconstexpr

Scales the empty shape in place around the origin; a no-op.

The empty set has no points to scale, so it is left unchanged.

Returns
This shape, unmodified.

◆ operator+=()

template<class PointType_ = Point<>>
template<PointConcept OtherPoint>
EmptyShape & pgl::EmptyShape< PointType_ >::operator+= ( const OtherPoint & )
inlineconstexpr

Translates the empty shape in place; a no-op.

The empty set has no points to move, so translation leaves it unchanged.

Returns
This shape, unmodified.

◆ operator-=()

template<class PointType_ = Point<>>
template<PointConcept OtherPoint>
EmptyShape & pgl::EmptyShape< PointType_ >::operator-= ( const OtherPoint & )
inlineconstexpr

Translates the empty shape in place by a negated point; a no-op.

The empty set has no points to move, so translation leaves it unchanged.

Returns
This shape, unmodified.

◆ operator/=()

template<class PointType_ = Point<>>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
EmptyShape & pgl::EmptyShape< PointType_ >::operator/= ( const Scalar & )
inlineconstexpr

Divides the empty shape in place around the origin; a no-op.

The empty set has no points to scale, so it is left unchanged.

Returns
This shape, unmodified.

◆ operator<=>()

template<class PointType_ = Point<>>
auto pgl::EmptyShape< PointType_ >::operator<=> ( const EmptyShape< PointType_ > & ) const
nodiscardconstexprdefault

Three-way comparison: all empty shapes are equivalent.

◆ operator==()

template<class PointType_ = Point<>>
bool pgl::EmptyShape< PointType_ >::operator== ( const EmptyShape< PointType_ > & ) const
nodiscardconstexprdefault

All empty shapes are equal and unordered among themselves.

◆ operator[]()

template<class PointType_ = Point<>>
PointType pgl::EmptyShape< PointType_ >::operator[] ( std::size_t ) const
inlinenodiscard

Always throws: the empty shape has no vertices.

◆ rotate90()

template<class PointType_ = Point<>>
void pgl::EmptyShape< PointType_ >::rotate90 ( int = 1)
inlineconstexpr

Rotates the empty shape by 90k degrees in place; a no-op.

◆ rotated90()

template<class PointType_ = Point<>>
EmptyShape pgl::EmptyShape< PointType_ >::rotated90 ( int = 1) const
inlinenodiscardconstexpr

Returns the empty shape rotated by 90k degrees; a no-op.

◆ samePointSet()

template<class PointType>
template<AnyShapeConcept OtherShape>
bool pgl::EmptyShape< PointType >::samePointSet ( const OtherShape & other) const
nodiscardconstexpr

Tests whether another shape defines the empty point set.

◆ scaledDownX()

template<class PointType_ = Point<>>
template<class OtherNumber>
EmptyShape pgl::EmptyShape< PointType_ >::scaledDownX ( const OtherNumber ) const
inlinenodiscardconstexpr

Returns the empty shape with its x-coordinates scaled down; a no-op.

◆ scaledDownY()

template<class PointType_ = Point<>>
template<class OtherNumber>
EmptyShape pgl::EmptyShape< PointType_ >::scaledDownY ( const OtherNumber ) const
inlinenodiscardconstexpr

Returns the empty shape with its y-coordinates scaled down; a no-op.

◆ scaleDownX()

template<class PointType_ = Point<>>
template<class OtherNumber>
void pgl::EmptyShape< PointType_ >::scaleDownX ( const OtherNumber )
inlineconstexpr

Scales the empty shape's x-coordinates down in place; a no-op.

◆ scaleDownY()

template<class PointType_ = Point<>>
template<class OtherNumber>
void pgl::EmptyShape< PointType_ >::scaleDownY ( const OtherNumber )
inlineconstexpr

Scales the empty shape's y-coordinates down in place; a no-op.

◆ scaledUpX()

template<class PointType_ = Point<>>
template<class OtherNumber>
EmptyShape pgl::EmptyShape< PointType_ >::scaledUpX ( const OtherNumber ) const
inlinenodiscardconstexpr

Returns the empty shape with its x-coordinates scaled up; a no-op.

◆ scaledUpY()

template<class PointType_ = Point<>>
template<class OtherNumber>
EmptyShape pgl::EmptyShape< PointType_ >::scaledUpY ( const OtherNumber ) const
inlinenodiscardconstexpr

Returns the empty shape with its y-coordinates scaled up; a no-op.

◆ scaleUpX()

template<class PointType_ = Point<>>
template<class OtherNumber>
void pgl::EmptyShape< PointType_ >::scaleUpX ( const OtherNumber )
inlineconstexpr

Scales the empty shape's x-coordinates up in place; a no-op.

◆ scaleUpY()

template<class PointType_ = Point<>>
template<class OtherNumber>
void pgl::EmptyShape< PointType_ >::scaleUpY ( const OtherNumber )
inlineconstexpr

Scales the empty shape's y-coordinates up in place; a no-op.

◆ separates()

template<class PointType_ = Point<>>
template<class T>
bool pgl::EmptyShape< PointType_ >::separates ( const T & ) const
inlinenodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ size()

template<class PointType_ = Point<>>
constexpr std::size_t pgl::EmptyShape< PointType_ >::size ( )
inlinestaticnodiscardconstexpr

Returns the number of vertices, always 0.