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

Axis-aligned rectangle stored by minimum and maximum corners. More...

#include <rectangle.hpp>

Inheritance diagram for pgl::Rectangle< PointType_, TLabel >:
[legend]

Classes

class  BoundaryIterator
 Forward iterator over the four rectangle boundary edges. More...
class  CornerIterator
 Forward iterator over the four corners in counterclockwise order. More...

Public Types

using PointType = PointType_
using NumberType = PointType::NumberType
using LabelType = TLabel
template<bool Oriented>
using BoundaryType = std::conditional_t<Oriented, OrientedSegment<PointType>, Segment<PointType>>
 Selects unordered or oriented boundary segments.
using value_type = PointType
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = PointType
using const_reference = PointType
using iterator = CornerIterator
using const_iterator = CornerIterator
using EdgeIterator = BoundaryIterator<false>
using OrientedEdgeIterator = BoundaryIterator<true>

Public Member Functions

constexpr Rectangle ()
 Creates the empty rectangle [(0,0),(-1,-1)].
constexpr Rectangle (PointType first, PointType second, bool minmax=false)
 Creates an axis-aligned rectangle from two opposite corners.
constexpr Rectangle (NumberType x1, NumberType y1, NumberType x2, NumberType y2, bool minmax=false)
 Creates an axis-aligned rectangle from four coordinates.
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
constexpr Rectangle (const Rectangle< OtherPointType, OtherLabelType > &other)
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
constexpr Rectangleoperator= (const Rectangle< OtherPointType, OtherLabelType > &other)
 Assigns from a rectangle with compatible point and label types.
template<std::ranges::input_range Range = std::initializer_list<PointType>>
requires std::ranges::common_range<Range> && std::convertible_to<std::ranges::range_value_t<Range>, PointType>
constexpr Rectangle (Range &&points)
 Creates the bounding box of a range of points.
template<std::ranges::input_range Range>
requires (!detail::is_point_v<typename std::ranges::range_value_t<Range>> && requires(const typename std::ranges::range_value_t
<Range>& shape) { shape.bbox(); })
constexpr Rectangle (Range &&shapes)
 Creates the bounding box of a range of bounded shapes.
constexpr PointType operator[] (std::size_t index) const
 Returns corner index for index in [0, 4).
constexpr bool empty () const
 Returns whether the rectangle is the empty set of points.
constexpr std::size_t size () const
 Returns the number of corners: 4, or 0 when empty.
constexpr PointType get (std::ptrdiff_t index) const
 Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the end.
constexpr std::ptrdiff_t index (const PointType &point) const
 Returns the smallest index i with (*this)[i] == point, or -1 if no corner equals point.
constexpr const PointTypemin () const
 Returns the minimum corner (min x, min y).
constexpr const PointTypemax () const
 Returns the maximum corner (max x, max y).
constexpr auto width () const
 Returns the rectangle width.
constexpr auto height () const
 Returns the rectangle height.
constexpr CornerIterator begin () const
 Returns an iterator to the minimum corner.
constexpr CornerIterator cbegin () const
 Returns an iterator to the minimum corner.
constexpr CornerIterator end () const
 Returns an iterator past the last corner.
constexpr CornerIterator cend () const
 Returns an iterator past the last corner.
constexpr EdgeIterator edgesBegin () const
 Returns an iterator to the first edge.
constexpr EdgeIterator edgesEnd () const
 Returns an iterator past the last edge.
constexpr OrientedEdgeIterator orientedEdgesBegin () const
 Returns an iterator to the first oriented edge.
constexpr OrientedEdgeIterator orientedEdgesEnd () const
 Returns an iterator past the last oriented edge.
constexpr bool operator== (const Rectangle &other) const
 Provides lexicographic ordering on (min, max).
template<AnyShapeConcept OtherShape>
constexpr bool samePointSet (const OtherShape &other) const
 Tests whether another shape defines exactly the same point set.
constexpr auto operator<=> (const Rectangle &other) const
 Orders rectangles lexicographically by their (min, max) corners, ignoring the label.
template<class A = LabelType>
requires (detail::has_label_v<A>)
constexpr A & label () const
 Returns the rectangle label.
template<class ResultNumber = NumberType>
constexpr ResultNumber area () const
 Returns the rectangle area.
constexpr auto twiceArea () const
 Returns twice the rectangle area.
constexpr bool isDegenerate () const
 Returns whether the rectangle has empty interior.
constexpr bool isPoint () const
 Returns whether the rectangle collapses to a single point.
constexpr std::optional< PointTypegetIfPoint () const
 Returns the point the rectangle collapses to, if it does.
constexpr bool isSegment () const
 Returns whether the rectangle collapses to a non-degenerate segment.
constexpr std::optional< BoundaryType< false > > getIfSegment () const
 Returns the segment the rectangle collapses to, if it does.
constexpr bool isUndefined () const
 Returns whether the rectangle is degenerate without collapsing to a point or to a segment.
constexpr Rectangle bbox () const
 Returns the bounding box of the rectangle.
template<class ResultNumber = grid_number_t<typename PointType_::NumberType>>
requires (detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints () const
 Returns the integer points the rectangle contains.
template<std::floating_point ResultNumber = double>
constexpr Rectangle< Point< ResultNumber > > fbox () const
 Returns a bounding box of the rectangle with floating point coordinates.
constexpr std::array< PointType, 4 > vertices () const
 Returns the four vertices in counterclockwise order.
constexpr std::array< Segment< PointType >, 4 > edges () const
 Returns the four edges as unordered segments.
constexpr std::array< OrientedSegment< PointType >, 4 > orientedEdges () const
 Returns the four boundary edges in counterclockwise order.
constexpr operator Convex< PointType > () const
 Converts the rectangle to a convex polygon.
constexpr Convex< PointTypeasConvex () const
 Returns the rectangle as a convex polygon.
constexpr Convex< PointTypeconvexHull () const
 Returns the convex hull of the rectangle's vertices.
constexpr HalfplaneIntersection< PointTypeasHalfplaneIntersection () const
 Returns the rectangle as a half-plane intersection.
constexpr operator Polygon< PointType > () const
 Converts the rectangle to a simple polygon.
constexpr Polygon< PointTypeasPolygon () const
 Returns the rectangle as a simple polygon.
constexpr PolygonWithHoles< PointTypeasPolygonWithHoles () const
 Returns the rectangle as a hole-free region.
constexpr PolygonSet< PointTypeasPolygonSet () const
 Returns the rectangle as a one-component set of regions.
template<PointConcept OtherPoint>
constexpr bool verticesContain (const OtherPoint &point) const
 Returns whether a point is one of the rectangle vertices.
template<PointConcept OtherPoint>
constexpr bool contains (const OtherPoint &point) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<LineConcept OtherLine>
constexpr bool contains (const OtherLine &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool contains (const OtherOrientedLine &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<SegmentConcept OtherSegment>
constexpr bool contains (const OtherSegment &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool contains (const OtherOrientedSegment &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<RayConcept OtherRay>
constexpr bool contains (const OtherRay &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<HalfplaneConcept OtherHalfplane>
constexpr bool contains (const OtherHalfplane &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<RectangleConcept OtherRectangle>
constexpr bool contains (const OtherRectangle &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<TriangleConcept OtherTriangle>
constexpr bool contains (const OtherTriangle &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<ConvexConcept OtherConvex>
constexpr bool contains (const OtherConvex &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PolygonConcept OtherPolygon>
constexpr bool contains (const OtherPolygon &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<DiskConcept OtherDisk>
constexpr bool contains (const OtherDisk &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool contains (const Shape< PointType > &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool boundaryContains (const Shape< PointType > &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<class EmptyPoint>
constexpr bool contains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<class EmptyPoint>
constexpr bool boundaryContains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<class EmptyPoint>
constexpr bool interiorContains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<class EmptyPoint>
constexpr bool separates (const EmptyShape< EmptyPoint > &) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PointConcept OtherPoint>
constexpr bool interiorContains (const OtherPoint &point) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<LineConcept OtherLine>
constexpr bool interiorContains (const OtherLine &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool interiorContains (const OtherOrientedLine &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<SegmentConcept OtherSegment>
constexpr bool interiorContains (const OtherSegment &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool interiorContains (const OtherOrientedSegment &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<RayConcept OtherRay>
constexpr bool interiorContains (const OtherRay &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<HalfplaneConcept OtherHalfplane>
constexpr bool interiorContains (const OtherHalfplane &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<RectangleConcept OtherRectangle>
constexpr bool interiorContains (const OtherRectangle &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<TriangleConcept OtherTriangle>
constexpr bool interiorContains (const OtherTriangle &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PointConcept OtherPoint>
constexpr bool boundaryContains (const OtherPoint &point) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<SegmentConcept OtherSegment>
constexpr bool boundaryContains (const OtherSegment &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool boundaryContains (const OtherOrientedSegment &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<LineConcept OtherLine>
constexpr bool boundaryContains (const OtherLine &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool boundaryContains (const OtherOrientedLine &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<RayConcept OtherRay>
constexpr bool boundaryContains (const OtherRay &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<HalfplaneConcept OtherHalfplane>
constexpr bool boundaryContains (const OtherHalfplane &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<RectangleConcept OtherRectangle>
constexpr bool boundaryContains (const OtherRectangle &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<TriangleConcept OtherTriangle>
constexpr bool boundaryContains (const OtherTriangle &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<ConvexConcept OtherConvex>
constexpr bool boundaryContains (const OtherConvex &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PolygonConcept OtherPolygon>
constexpr bool boundaryContains (const OtherPolygon &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<DiskConcept OtherDisk>
constexpr bool boundaryContains (const OtherDisk &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PointConcept OtherPoint>
constexpr bool intersects (const OtherPoint &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<RectangleConcept OtherRectangle>
constexpr bool intersects (const OtherRectangle &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<LineConcept OtherLine>
constexpr bool intersects (const OtherLine &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool intersects (const OtherOrientedLine &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<SegmentConcept OtherSegment>
constexpr bool intersects (const OtherSegment &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool intersects (const OtherOrientedSegment &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<RayConcept OtherRay>
constexpr bool intersects (const OtherRay &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<HalfplaneConcept OtherHalfplane>
constexpr bool intersects (const OtherHalfplane &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
constexpr bool intersects (const Shape< PointType > &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>)
constexpr bool intersects (const OtherShape &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<class EmptyPoint>
constexpr bool intersects (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<PointConcept OtherPoint>
constexpr bool interiorsIntersect (const OtherPoint &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<RectangleConcept OtherRectangle>
constexpr bool interiorsIntersect (const OtherRectangle &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<LineConcept OtherLine>
constexpr bool interiorsIntersect (const OtherLine &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool interiorsIntersect (const OtherOrientedLine &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<SegmentConcept OtherSegment>
constexpr bool interiorsIntersect (const OtherSegment &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool interiorsIntersect (const OtherOrientedSegment &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<RayConcept OtherRay>
constexpr bool interiorsIntersect (const OtherRay &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<HalfplaneConcept OtherHalfplane>
constexpr bool interiorsIntersect (const OtherHalfplane &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>)
constexpr bool interiorsIntersect (const OtherShape &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<class EmptyPoint>
constexpr bool interiorsIntersect (const EmptyShape< EmptyPoint > &) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
constexpr bool interiorsIntersect (const Shape< PointType > &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<RectangleConcept OtherRectangle>
constexpr bool separates (const OtherRectangle &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PointConcept OtherPoint>
constexpr bool separates (const OtherPoint &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<LineConcept OtherLine>
constexpr bool separates (const OtherLine &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool separates (const OtherOrientedLine &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<SegmentConcept OtherSegment>
constexpr bool separates (const OtherSegment &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool separates (const OtherOrientedSegment &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<RayConcept OtherRay>
constexpr bool separates (const OtherRay &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<HalfplaneConcept OtherHalfplane>
constexpr bool separates (const OtherHalfplane &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<TriangleConcept OtherTriangle>
constexpr bool separates (const OtherTriangle &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<ConvexConcept OtherConvex>
constexpr bool separates (const OtherConvex &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<DiskConcept OtherDisk>
constexpr bool separates (const OtherDisk &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PolygonConcept OtherPolygon>
constexpr bool separates (const OtherPolygon &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<MonotoneChainConcept OtherChain>
constexpr bool contains (const OtherChain &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<MonotoneChainConcept OtherChain>
constexpr bool boundaryContains (const OtherChain &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<MonotoneChainConcept OtherChain>
constexpr bool interiorContains (const OtherChain &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<MonotoneChainConcept OtherChain>
constexpr bool separates (const OtherChain &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PolylineConcept OtherPolyline>
constexpr bool contains (const OtherPolyline &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PolylineConcept OtherPolyline>
constexpr bool boundaryContains (const OtherPolyline &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PolylineConcept OtherPolyline>
constexpr bool interiorContains (const OtherPolyline &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PolylineConcept OtherPolyline>
constexpr bool separates (const OtherPolyline &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<HalfplaneIntersectionConcept OtherRegion>
constexpr bool contains (const OtherRegion &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<HalfplaneIntersectionConcept OtherRegion>
constexpr bool boundaryContains (const OtherRegion &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<HalfplaneIntersectionConcept OtherRegion>
constexpr bool interiorContains (const OtherRegion &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<HalfplaneIntersectionConcept OtherRegion>
constexpr bool separates (const OtherRegion &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PolygonWithHolesConcept OtherRegion>
constexpr bool contains (const OtherRegion &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PolygonWithHolesConcept OtherRegion>
constexpr bool boundaryContains (const OtherRegion &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PolygonWithHolesConcept OtherRegion>
constexpr bool interiorContains (const OtherRegion &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PolygonWithHolesConcept OtherRegion>
bool separates (const OtherRegion &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PolygonSetConcept OtherSet>
constexpr bool contains (const OtherSet &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PolygonSetConcept OtherSet>
constexpr bool boundaryContains (const OtherSet &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PolygonSetConcept OtherSet>
constexpr bool interiorContains (const OtherSet &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PolygonSetConcept OtherSet>
bool separates (const OtherSet &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
constexpr bool separates (const Shape< PointType > &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<DiskConcept OtherDisk>
constexpr bool interiorContains (const OtherDisk &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<ConvexConcept OtherConvex>
constexpr bool interiorContains (const OtherConvex &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PolygonConcept OtherPolygon>
constexpr bool interiorContains (const OtherPolygon &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<RectangleConcept OtherRectangle>
constexpr bool crosses (const OtherRectangle &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<PointConcept OtherPoint>
constexpr bool crosses (const OtherPoint &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<LineConcept OtherLine>
constexpr bool crosses (const OtherLine &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool crosses (const OtherOrientedLine &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<SegmentConcept OtherSegment>
constexpr bool crosses (const OtherSegment &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool crosses (const OtherOrientedSegment &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<RayConcept OtherRay>
constexpr bool crosses (const OtherRay &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<HalfplaneConcept OtherHalfplane>
constexpr bool crosses (const OtherHalfplane &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>)
constexpr bool crosses (const OtherShape &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<class EmptyPoint>
constexpr bool crosses (const EmptyShape< EmptyPoint > &) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
constexpr bool crosses (const Shape< PointType > &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr std::optional< Point< ResultNumber, typename PointType::LabelType > > intersection (const OtherPoint &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr std::optional< Rectangle< Point< ResultNumber, typename PointType::LabelType > > > intersection (const OtherRectangle &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherLine &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherOrientedLine &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherSegment &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherOrientedSegment &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherRay &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
constexpr auto intersection (const OtherHalfplane &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = NumberType, HalfplaneIntersectionConcept OtherRegion>
constexpr auto intersection (const OtherRegion &other) const
 Adds this rectangle's four constraints to a half-plane intersection without deriving vertices.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && !HalfplaneIntersectionConcept<OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self) { o.template intersection
<ResultNumber>(self); })
constexpr auto intersection (const OtherShape &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const
OtherShape& o, const Rectangle& self) { o.template regularizedIntersection<ResultNumber>(self); })
constexpr auto regularizedIntersection (const OtherShape &other) const
 Forwards a regularized intersection to the shape that owns it.
template<class ResultNumber = NumberType, class EmptyPoint>
constexpr EmptyShape< EmptyPoint > intersection (const EmptyShape< EmptyPoint > &) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto squaredDistance (const OtherPoint &point) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
constexpr auto squaredDistance (const OtherLine &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
constexpr auto squaredDistance (const OtherOrientedLine &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto squaredDistance (const OtherSegment &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto squaredDistance (const OtherOrientedSegment &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
constexpr auto squaredDistance (const OtherRay &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
constexpr auto squaredDistance (const OtherHalfplane &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto squaredDistance (const OtherRectangle &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template squaredDistance<ResultNumber>(self); })
constexpr auto squaredDistance (const OtherShape &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > squaredDistance (const Disk< DiskPointType, DiskLabel > &disk) const
 Returns the squared Euclidean distance to a disk.
template<class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
requires detail::ClosestPairConcept<Rectangle<PointType_, TLabel>, OtherShape>
constexpr auto closestSegments (const OtherShape &other) const
 Returns the pair of elements realizing the distance, nothing when the shapes meet.
template<class ResultNumber = division_result_t<NumberType>, class OtherShape>
requires detail::ClosestPointsPairConcept<Rectangle<PointType_, TLabel>, OtherShape>
constexpr auto closestPoints (const OtherShape &other) const
 Returns the pair of points realizing the distance, nothing when the shapes meet.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto distanceL1 (const OtherPoint &point) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
constexpr auto distanceL1 (const OtherLine &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
constexpr auto distanceL1 (const OtherOrientedLine &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto distanceL1 (const OtherSegment &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto distanceL1 (const OtherOrientedSegment &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
constexpr auto distanceL1 (const OtherRay &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
constexpr auto distanceL1 (const OtherHalfplane &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto distanceL1 (const OtherRectangle &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template distanceL1<ResultNumber>(self); })
constexpr auto distanceL1 (const OtherShape &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto intersection (const Shape< OtherPoint > &other) const
 Returns the intersection of the two shapes (A ∩ B), re-dispatching through the wrapper's own intersection.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto regularizedIntersection (const Shape< OtherPoint > &other) const
 Re-dispatches a regularized intersection through a runtime shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto regularizedUnion (const Shape< OtherPoint > &other) const
 Returns the regularized union of the two shapes (A ∪ B), re-dispatching through the wrapper's own regularizedUnion.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto difference (const Shape< OtherPoint > &other) const
 Returns the regularized set difference of the two shapes (A ∖ B), re-dispatching through the wrapper's own difference.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto symmetricDifference (const Shape< OtherPoint > &other) const
 Returns the regularized symmetric difference of the two shapes (A △ B), re-dispatching through the wrapper's own symmetricDifference.
template<class ResultNumber = double, PointConcept OtherPoint>
constexpr auto distanceL1 (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceL1.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto distanceLInf (const OtherPoint &point) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
constexpr auto distanceLInf (const OtherLine &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
constexpr auto distanceLInf (const OtherOrientedLine &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto distanceLInf (const OtherSegment &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto distanceLInf (const OtherOrientedSegment &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
constexpr auto distanceLInf (const OtherRay &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
constexpr auto distanceLInf (const OtherHalfplane &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto distanceLInf (const OtherRectangle &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template distanceLInf<ResultNumber>(self); })
constexpr auto distanceLInf (const OtherShape &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = double, PointConcept OtherPoint>
constexpr auto distanceLInf (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceLInf.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto hausdorffDistanceL1 (const OtherRectangle &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto hausdorffDistanceL1 (const OtherPoint &point) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto hausdorffDistanceL1 (const OtherSegment &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto hausdorffDistanceL1 (const OtherOrientedSegment &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template hausdorffDistanceL1<ResultNumber>(self); })
constexpr auto hausdorffDistanceL1 (const OtherShape &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto hausdorffDistanceL1 (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceL1.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto hausdorffDistanceLInf (const OtherRectangle &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto hausdorffDistanceLInf (const OtherPoint &point) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto hausdorffDistanceLInf (const OtherSegment &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto hausdorffDistanceLInf (const OtherOrientedSegment &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template hausdorffDistanceLInf<ResultNumber>(self); })
constexpr auto hausdorffDistanceLInf (const OtherShape &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto hausdorffDistanceLInf (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceLInf.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto squaredHausdorffDistance (const OtherRectangle &other) const
 Returns the squared Hausdorff distance to another rectangle.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto squaredHausdorffDistance (const OtherPoint &point) const
 Returns the squared Hausdorff distance to a point.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto squaredHausdorffDistance (const OtherSegment &other) const
 Returns the squared Hausdorff distance to a point.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto squaredHausdorffDistance (const OtherOrientedSegment &other) const
 Returns the squared Hausdorff distance to a point.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template squaredHausdorffDistance<ResultNumber>(self); })
constexpr auto squaredHausdorffDistance (const OtherShape &other) const
 Returns the squared Hausdorff distance to the given shape.
template<PointConcept OtherPoint>
requires (!detail::is_point_v<TShape> && !RectangleConcept<TShape> && requires(const TShape& shape) { shape.bbox(); })
constexpr void insert (const OtherPoint &point)
 Enlarges the rectangle so that it contains the given point.
template<RectangleConcept OtherRectangle>
constexpr void insert (const OtherRectangle &other)
 Enlarges the rectangle so that it contains another rectangle.
template<class TShape>
requires (!detail::is_point_v<TShape> && !RectangleConcept<TShape> && requires(const TShape& shape) { shape.bbox(); })
constexpr void insert (const TShape &shape)
 Enlarges the rectangle so that it contains a finite shape.
template<std::ranges::input_range Range = std::initializer_list<PointType>>
requires std::ranges::common_range<Range> && std::convertible_to<std::ranges::range_value_t<Range>, PointType> && (!requires(const
std::remove_cvref_t<Range>& shape) { shape.bbox(); })
constexpr void insert (Range &&range)
 Enlarges the rectangle so that it contains every point in a range.
template<std::ranges::input_range Range>
requires (!detail::is_point_v<typename std::ranges::range_value_t<Range>> && requires(const typename std::ranges::range_value_t
<Range>& shape) { shape.bbox(); })
constexpr void insert (Range &&range)
 Enlarges the rectangle to contain every point in a range of shapes.
constexpr Segment< PointTypediameter () const
 Returns a segment defining a diameter.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Point< ResultNumber > midpoint () const
 Returns the midpoint of the rectangle.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Point< ResultNumber > centroid () const
 Returns the centroid of the rectangle.
constexpr Disk< PointType, NoLabelcircumcircle () const
 Returns the circumcircle of the rectangle.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Point< ResultNumber > center () const
 Returns the center of the rectangle.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Point< ResultNumber > pointInside () const
 Returns a point inside the rectangle.
template<class OtherShape>
constexpr bool pointInsideInteriorContainedIn (const OtherShape &shape) const
 Tests whether some point in this shape's relative interior lies in the strict interior of shape.
constexpr Rectangle rotated90 (int k=1) const
 Returns the rectangle rotated by 90k degrees around the origin.
constexpr void rotate90 (int k=1)
 Rotates the rectangle by 90k degrees around the origin in place.
template<class OtherNumber>
constexpr Rectangle scaledUpX (const OtherNumber scalar) const
 Returns the rectangle with its x-coordinates multiplied by a factor.
template<class OtherNumber>
constexpr void scaleUpX (const OtherNumber scalar)
 Multiplies the rectangle's x-coordinates by a factor in place.
template<class OtherNumber>
constexpr Rectangle scaledUpY (const OtherNumber scalar) const
 Returns the rectangle with its y-coordinates multiplied by a factor.
template<class OtherNumber>
constexpr void scaleUpY (const OtherNumber scalar)
 Multiplies the rectangle's y-coordinates by a factor in place.
template<class OtherNumber>
constexpr Rectangle scaledDownX (const OtherNumber scalar) const
 Returns the rectangle with its x-coordinates divided by a divisor.
template<class OtherNumber>
constexpr void scaleDownX (const OtherNumber scalar)
 Divides the rectangle's x-coordinates by a divisor in place.
template<class OtherNumber>
constexpr Rectangle scaledDownY (const OtherNumber scalar) const
 Returns the rectangle with its y-coordinates divided by a divisor.
template<class OtherNumber>
constexpr void scaleDownY (const OtherNumber scalar)
 Divides the rectangle's y-coordinates by a divisor in place.
template<class OtherShape>
requires MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape>
constexpr auto minkowskiSum (const OtherShape &other) const
 Returns the Minkowski sum of this shape and another (A ⊕ B).
template<class OtherShape>
requires MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape>
constexpr auto minkowskiErosion (const OtherShape &other) const
 Returns the Minkowski erosion of this shape by another (A ⊖ B).
template<class OtherShape>
requires (!MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape> && BoundedPolygonalConcept<OtherShape>)
constexpr auto minkowskiErosion (const OtherShape &other) const
 Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self) { o.template minkowskiSum
<ResultNumber>(self); })
auto minkowskiSum (const OtherShape &other) const
 Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion (const OtherRectangle &other) const
 Returns the regularized union of the two shapes (A ∪ B).
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template regularizedUnion<ResultNumber>(self); })
auto regularizedUnion (const OtherShape &other) const
 Returns the regularized union of the two shapes (A ∪ B).
template<class ResultNumber = division_result_t<NumberType>, PolygonalRegionConcept OtherRegion>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference (const OtherRegion &other) const
 Returns the regularized set difference of the two shapes (A ∖ B).
template<class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference (const OtherIntersection &other) const
 Returns the regularized set difference of the two shapes (A ∖ B).
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference (const OtherHalfplane &other) const
 Returns the regularized set difference of the two shapes (A ∖ B).
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference (const OtherRectangle &other) const
 Returns the regularized symmetric difference of the two shapes (A △ B).
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template symmetricDifference<ResultNumber>(self); })
auto symmetricDifference (const OtherShape &other) const
 Returns the regularized symmetric difference of the two shapes (A △ B).
template<PointConcept OtherPoint>
constexpr Rectangleoperator+= (const OtherPoint &translation)
 Translates both stored corners in place.
template<PointConcept OtherPoint>
constexpr Rectangleoperator-= (const OtherPoint &translation)
 Translates both stored corners by the opposite vector in place.
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr Rectangleoperator*= (const Scalar &scalar)
 Scales the rectangle around the origin in place.
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr Rectangleoperator/= (const Scalar &scalar)
 Divides the rectangle coordinates by a scalar in place.
template<class ResultNumber, PolygonalRegionConcept OtherRegion>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > difference (const OtherRegion &other) const
template<class ResultNumber, HalfplaneIntersectionConcept OtherIntersection>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > difference (const OtherIntersection &other) const
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > difference (const OtherHalfplane &other) const
template<class ResultNumber, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > regularizedUnion (const OtherRectangle &other) const
template<class ResultNumber, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > symmetricDifference (const OtherRectangle &other) const
template<bool Oriented>
constexpr Rectangle< PointType, LabelType >::template BoundaryType< Oriented > boundaryAt (std::size_t index) const
template<PointConcept OtherPoint>
constexpr Rectangle< PointType, LabelType > & operator+= (const OtherPoint &translation)
template<PointConcept OtherPoint>
constexpr Rectangle< PointType, LabelType > & operator-= (const OtherPoint &translation)
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr Rectangle< PointType, LabelType > & operator*= (const Scalar &scalar)
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr Rectangle< PointType, LabelType > & operator/= (const Scalar &scalar)
template<class OtherNumber>
constexpr Rectangle< PointType, LabelTypescaledUpX (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Rectangle< PointType, LabelTypescaledUpY (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Rectangle< PointType, LabelTypescaledDownX (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Rectangle< PointType, LabelTypescaledDownY (const OtherNumber scalar) const

Detailed Description

template<class PointType_, class TLabel>
struct pgl::Rectangle< PointType_, TLabel >

Axis-aligned rectangle stored by minimum and maximum corners.

Axis-aligned rectangle stored by its minimum and maximum corners.

The stored corners are always (min x, min y) and (max x, max y).

Template Parameters
PointTypeCorner point type.

Member Typedef Documentation

◆ BoundaryType

template<class PointType_, class TLabel>
template<bool Oriented>
using pgl::Rectangle< PointType_, TLabel >::BoundaryType = std::conditional_t<Oriented, OrientedSegment<PointType>, Segment<PointType>>

Selects unordered or oriented boundary segments.

Template Parameters
OrientedWhen true, uses OrientedSegment.

◆ const_iterator

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::const_iterator = CornerIterator

◆ const_reference

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::const_reference = PointType

◆ difference_type

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::difference_type = std::ptrdiff_t

◆ EdgeIterator

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::EdgeIterator = BoundaryIterator<false>

◆ iterator

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::iterator = CornerIterator

◆ LabelType

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::LabelType = TLabel

◆ NumberType

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::NumberType = PointType::NumberType

◆ OrientedEdgeIterator

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::OrientedEdgeIterator = BoundaryIterator<true>

◆ PointType

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::PointType = PointType_

◆ reference

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::reference = PointType

◆ size_type

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::size_type = std::size_t

◆ value_type

template<class PointType_, class TLabel>
using pgl::Rectangle< PointType_, TLabel >::value_type = PointType

Standard range/container typedefs over the vertex sequence.

Constructor & Destructor Documentation

◆ Rectangle() [1/6]

template<class PointType_, class TLabel>
pgl::Rectangle< PointType_, TLabel >::Rectangle ( )
inlineconstexpr

Creates the empty rectangle [(0,0),(-1,-1)].

The maximum corner falls below the minimum one, which no pair of opposite corners normalizes to, so the rectangle covers no point at all and behaves as EmptyShape everywhere. See empty.

◆ Rectangle() [2/6]

template<class PointType_, class TLabel>
pgl::Rectangle< PointType_, TLabel >::Rectangle ( PointType first,
PointType second,
bool minmax = false )
inlineconstexpr

Creates an axis-aligned rectangle from two opposite corners.

When the normalized minimum and maximum corners coincide with the input points, their labels are preserved. Otherwise synthesized corners use default-constructed labels.

Passing minmax stores the corners as given, which is also the only way to build an empty rectangle other than Rectangle(): corners that invert on either axis are not swapped back but read as the empty set, and normalized to its one canonical representation so that all empty rectangles compare equal.

Parameters
firstFirst opposite corner.
secondSecond opposite corner.
minmaxTrue if we know that first.x() < second.x() and first.y() < second.y()

◆ Rectangle() [3/6]

template<class PointType_, class TLabel>
pgl::Rectangle< PointType_, TLabel >::Rectangle ( NumberType x1,
NumberType y1,
NumberType x2,
NumberType y2,
bool minmax = false )
inlineconstexpr

Creates an axis-aligned rectangle from four coordinates.

Parameters
x1X coordinate of the first corner.
y1Y coordinate of the first corner.
x2X coordinate of the second corner.
y2Y coordinate of the second corner.
minmaxTrue if we know that x1 < x2 and y1 < y2

◆ Rectangle() [4/6]

template<class PointType_, class TLabel>
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
pgl::Rectangle< PointType_, TLabel >::Rectangle ( const Rectangle< OtherPointType, OtherLabelType > & other)
inlineconstexpr

◆ Rectangle() [5/6]

template<class PointType_, class TLabel>
template<std::ranges::input_range Range = std::initializer_list<PointType>>
requires std::ranges::common_range<Range> && std::convertible_to<std::ranges::range_value_t<Range>, PointType>
pgl::Rectangle< PointType_, TLabel >::Rectangle ( Range && points)
inlineexplicitconstexpr

Creates the bounding box of a range of points.

The rectangle corners are the componentwise minimum and maximum points found in the range. An empty range encloses nothing, so it gives the empty rectangle.

Template Parameters
RangeInput range whose elements can be converted to PointType.
Parameters
pointsRange of points to enclose.

◆ Rectangle() [6/6]

template<class PointType_, class TLabel>
template<std::ranges::input_range Range>
requires (!detail::is_point_v<typename std::ranges::range_value_t<Range>> && requires(const typename std::ranges::range_value_t
<Range>& shape) { shape.bbox(); })
pgl::Rectangle< PointType_, TLabel >::Rectangle ( Range && shapes)
inlineexplicitconstexpr

Creates the bounding box of a range of bounded shapes.

The rectangle corners are the componentwise minimum and maximum points found in the range. An empty range, or one whose shapes are all empty, encloses nothing and gives the empty rectangle.

Template Parameters
RangeInput range whose elements can be converted to PointType.
Parameters
pointsRange of points to enclose.

Member Function Documentation

◆ area()

template<class PointType, class LabelType>
template<class ResultNumber>
ResultNumber pgl::Rectangle< PointType, LabelType >::area ( ) const
nodiscardconstexpr

Returns the rectangle area.

Template Parameters
ResultNumberResult type (default: NumberType).
Returns
width * height, which is 0 when empty.

◆ asConvex()

template<class PointType_, class TLabel>
Convex< PointType > pgl::Rectangle< PointType_, TLabel >::asConvex ( ) const
inlinenodiscardconstexpr

Returns the rectangle as a convex polygon.

Returns
Convex polygon with the same corners.

◆ asHalfplaneIntersection()

template<class PointType_, class TLabel>
HalfplaneIntersection< PointType > pgl::Rectangle< PointType_, TLabel >::asHalfplaneIntersection ( ) const
inlinenodiscardconstexpr

Returns the rectangle as a half-plane intersection.

The region is the intersection of the four edge half-planes. A degenerate rectangle produces the corresponding degenerate region (a segment or a point), and an empty one the empty region.

Returns
Half-plane intersection whose point set is this rectangle.

◆ asPolygon()

template<class PointType_, class TLabel>
Polygon< PointType > pgl::Rectangle< PointType_, TLabel >::asPolygon ( ) const
inlinenodiscardconstexpr

Returns the rectangle as a simple polygon.

Returns
Polygon with the same corners.

◆ asPolygonSet()

template<class PointType_, class TLabel>
PolygonSet< PointType > pgl::Rectangle< PointType_, TLabel >::asPolygonSet ( ) const
inlinenodiscardconstexpr

Returns the rectangle as a one-component set of regions.

A rectangle with no area covers nothing that survives regularization, so it gives back the empty set rather than a component without area.

Returns
PolygonSet whose only component is the rectangle as a region.

◆ asPolygonWithHoles()

template<class PointType_, class TLabel>
PolygonWithHoles< PointType > pgl::Rectangle< PointType_, TLabel >::asPolygonWithHoles ( ) const
inlinenodiscardconstexpr

Returns the rectangle as a hole-free region.

Returns
PolygonWithHoles whose outer boundary is the rectangle and which has no holes.

◆ bbox()

template<class PointType, class LabelType>
Rectangle< PointType, LabelType > pgl::Rectangle< PointType, LabelType >::bbox ( ) const
nodiscardconstexpr

Returns the bounding box of the rectangle.

Returns
This rectangle.

◆ begin()

template<class PointType_, class TLabel>
CornerIterator pgl::Rectangle< PointType_, TLabel >::begin ( ) const
inlineconstexpr

Returns an iterator to the minimum corner.

◆ boundaryAt()

template<class PointType_, class TLabel>
template<bool Oriented>
Rectangle< PointType, LabelType >::template BoundaryType< Oriented > pgl::Rectangle< PointType_, TLabel >::boundaryAt ( std::size_t index) const
constexpr

◆ boundaryContains() [1/19]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Rectangle< PointType_, TLabel >::boundaryContains ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [2/19]

template<class PointType, class LabelType>
template<MonotoneChainConcept OtherChain>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherChain & other) const
nodiscardconstexpr

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

◆ boundaryContains() [3/19]

template<class PointType, class LabelType>
template<ConvexConcept OtherConvex>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherConvex & other) const
nodiscardconstexpr

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

◆ boundaryContains() [4/19]

template<class PointType, class LabelType>
template<DiskConcept OtherDisk>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherDisk & other) const
nodiscardconstexpr

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

◆ boundaryContains() [5/19]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ boundaryContains() [6/19]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherLine & other) const
nodiscardconstexpr

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

◆ boundaryContains() [7/19]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ boundaryContains() [8/19]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ boundaryContains() [9/19]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherPoint & point) const
nodiscardconstexpr

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

Template Parameters
OtherPointType of the point.
Parameters
pointPoint to test.
Returns
true if the point lies on the rectangle boundary.

Rectangle

Axis-aligned rectangle predicates plus the rectangle-local clipping helpers used to answer strict interior and separation questions.

◆ boundaryContains() [10/19]

template<class PointType, class LabelType>
template<PolygonConcept OtherPolygon>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherPolygon & other) const
nodiscardconstexpr

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

◆ boundaryContains() [11/19]

template<class PointType, class LabelType>
template<PolylineConcept OtherPolyline>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherPolyline & other) const
nodiscardconstexpr

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

◆ boundaryContains() [12/19]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherRay & other) const
nodiscardconstexpr

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

◆ boundaryContains() [13/19]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

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

◆ boundaryContains() [14/19]

template<class PointType_, class TLabel>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Rectangle< PointType_, TLabel >::boundaryContains ( const OtherRegion & other) const
nodiscardconstexpr

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

A boundary has no area, so it holds only a region with no area — which is exactly the union of that region's ring edges.

◆ boundaryContains() [15/19]

template<class PointType, class LabelType>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ boundaryContains() [16/19]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ boundaryContains() [17/19]

template<class PointType_, class TLabel>
template<PolygonSetConcept OtherSet>
bool pgl::Rectangle< PointType_, TLabel >::boundaryContains ( const OtherSet & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [18/19]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const OtherTriangle & other) const
nodiscardconstexpr

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

◆ boundaryContains() [19/19]

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::boundaryContains ( const Shape< PointType > & other) const
nodiscardconstexpr

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

◆ cbegin()

template<class PointType_, class TLabel>
CornerIterator pgl::Rectangle< PointType_, TLabel >::cbegin ( ) const
inlineconstexpr

Returns an iterator to the minimum corner.

◆ cend()

template<class PointType_, class TLabel>
CornerIterator pgl::Rectangle< PointType_, TLabel >::cend ( ) const
inlineconstexpr

Returns an iterator past the last corner.

◆ center()

template<class PointType, class LabelType>
template<class ResultNumber>
Point< ResultNumber > pgl::Rectangle< PointType, LabelType >::center ( ) const
nodiscardconstexpr

Returns the center of the rectangle.

Template Parameters
ResultNumberCoordinate type of the center.
Returns
The rectangle midpoint.

◆ centroid()

template<class PointType, class LabelType>
template<class ResultNumber>
Point< ResultNumber > pgl::Rectangle< PointType, LabelType >::centroid ( ) const
nodiscardconstexpr

Returns the centroid of the rectangle.

Template Parameters
ResultNumberCoordinate type of the centroid.
Returns
The rectangle midpoint.
Warning
Divides coordinates by 2. Inexact for odd integer coordinates.

◆ circumcircle()

template<class PointType, class LabelType>
Disk< PointType, NoLabel > pgl::Rectangle< PointType, LabelType >::circumcircle ( ) const
nodiscardconstexpr

Returns the circumcircle of the rectangle.

The returned disk passes through the rectangle corners. The empty rectangle has none, so calling this on one is a precondition violation.

Returns
Disk passing through three rectangle corners.

◆ closestPoints()

template<class PointType_, class TLabel>
requires detail::ClosestPointsPairConcept<Rectangle<PointType_, TLabel>, OtherShape>
template<class ResultNumber, class OtherShape>
requires detail::ClosestPointsPairConcept<Rectangle<PointType_, TLabel>, OtherShape>
auto pgl::Rectangle< PointType_, TLabel >::closestPoints ( const OtherShape & other) const
nodiscardconstexpr

Returns the pair of points realizing the distance, nothing when the shapes meet.

The first point lies on this shape and the second on other. Empty exactly when squaredDistance is zero. Unlike closestSegments this also takes an unbounded convex other — a line, an oriented line, a ray, a half-plane, a half-plane intersection — which realizes the distance at a point on no edge and at no vertex: there is no element to name there, but there is still a point to give.

Template Parameters
ResultNumberCoordinate type of the returned points (default: division_result_t).
Warning
A point interior to an element comes from a division, so with an integer ResultNumber it truncates. Request a floating-point or pgl::Rational result type for an accurate value.

◆ closestSegments()

template<class PointType_, class TLabel>
requires detail::ClosestPairConcept<Rectangle<PointType_, TLabel>, OtherShape>
template<class ResultNumber, BoundedPolygonalConcept OtherShape>
requires detail::ClosestPairConcept<Rectangle<PointType_, TLabel>, OtherShape>
auto pgl::Rectangle< PointType_, TLabel >::closestSegments ( const OtherShape & other) const
nodiscardconstexpr

Returns the pair of elements realizing the distance, nothing when the shapes meet.

The first element is this shape's, the second is other's; each is one of the shape's edges, degenerate to a vertex where the shape has none. Empty exactly when squaredDistance is zero.

Template Parameters
ResultNumberCoordinate type of the returned segments (default: NumberType).
Warning
other's coordinates and labels are re-expressed in this shape's, so a narrower ResultNumber loses them.

◆ contains() [1/19]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Rectangle< PointType_, TLabel >::contains ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

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

◆ contains() [2/19]

template<class PointType, class LabelType>
template<MonotoneChainConcept OtherChain>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherChain & other) const
nodiscardconstexpr

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

◆ contains() [3/19]

template<class PointType, class LabelType>
template<ConvexConcept OtherConvex>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherConvex & other) const
nodiscardconstexpr

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

◆ contains() [4/19]

template<class PointType, class LabelType>
template<DiskConcept OtherDisk>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherDisk & other) const
nodiscardconstexpr

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

◆ contains() [5/19]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ contains() [6/19]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherLine & other) const
nodiscardconstexpr

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

◆ contains() [7/19]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ contains() [8/19]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ contains() [9/19]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherPoint & point) const
nodiscardconstexpr

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

The boundary is included.

Template Parameters
OtherPointType of the point.
Parameters
pointPoint to test.
Returns
true if the point lies in the rectangle.

Rectangle

Axis-aligned rectangle predicates plus the rectangle-local clipping helpers used to answer strict interior and separation questions.

◆ contains() [10/19]

template<class PointType, class LabelType>
template<PolygonConcept OtherPolygon>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherPolygon & other) const
nodiscardconstexpr

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

◆ contains() [11/19]

template<class PointType, class LabelType>
template<PolylineConcept OtherPolyline>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherPolyline & other) const
nodiscardconstexpr

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

◆ contains() [12/19]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherRay & other) const
nodiscardconstexpr

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

◆ contains() [13/19]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

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

The boundary is included.

Template Parameters
OtherNumberCoordinate type of the other rectangle corners.
OtherPoint::LabelTypeLabel type of the other rectangle corners.
Parameters
otherOther rectangle.
Returns
true if both corners of other lie in this rectangle.

◆ contains() [14/19]

template<class PointType_, class TLabel>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Rectangle< PointType_, TLabel >::contains ( const OtherRegion & other) const
nodiscardconstexpr

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

A region is contained exactly when its outer polygon is: the region holds the whole outer ring whatever its holes do, and this shape has a connected complement. See implementation/contains.hpp.

◆ contains() [15/19]

template<class PointType, class LabelType>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ contains() [16/19]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ contains() [17/19]

template<class PointType_, class TLabel>
template<PolygonSetConcept OtherSet>
bool pgl::Rectangle< PointType_, TLabel >::contains ( const OtherSet & other) const
inlinenodiscardconstexpr

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

◆ contains() [18/19]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Rectangle< PointType, LabelType >::contains ( const OtherTriangle & other) const
nodiscardconstexpr

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

◆ contains() [19/19]

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::contains ( const Shape< PointType > & other) const
nodiscardconstexpr

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

◆ convexHull()

template<class PointType_, class TLabel>
Convex< PointType > pgl::Rectangle< PointType_, TLabel >::convexHull ( ) const
inlinenodiscardconstexpr

Returns the convex hull of the rectangle's vertices.

A rectangle is already convex, so this is asConvex.

◆ crosses() [1/11]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Rectangle< PointType_, TLabel >::crosses ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

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

◆ crosses() [2/11]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ crosses() [3/11]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const OtherLine & other) const
nodiscardconstexpr

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

◆ crosses() [4/11]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ crosses() [5/11]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ crosses() [6/11]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const OtherPoint & other) const
nodiscardconstexpr

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

◆ crosses() [7/11]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const OtherRay & other) const
nodiscardconstexpr

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

◆ crosses() [8/11]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

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

For axis-aligned rectangles, this means each one separates the other.

Template Parameters
OtherNumberCoordinate type of the other rectangle corners.
OtherPoint::LabelTypeLabel type of the other rectangle corners.
Parameters
otherOther rectangle.
Returns
true if both rectangles split each other.

Rectangle

Axis-aligned rectangle predicates plus the rectangle-local clipping helpers used to answer strict interior and separation questions.

◆ crosses() [9/11]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ crosses() [10/11]

template<class PointType_, class TLabel>
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>)
bool pgl::Rectangle< PointType_, TLabel >::crosses ( const OtherShape & other) const
inlinenodiscardconstexpr

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

◆ crosses() [11/11]

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::crosses ( const Shape< PointType > & other) const
nodiscardconstexpr

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

◆ diameter()

template<class PointType, class LabelType>
Segment< PointType > pgl::Rectangle< PointType, LabelType >::diameter ( ) const
nodiscardconstexpr

Returns a segment defining a diameter.

For a rectangle, a diagonal is a diameter. The empty rectangle has no diagonal, so calling this on one is a precondition violation.

Returns
The diagonal from min() to max().

◆ difference() [1/7]

template<class PointType_, class TLabel>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Rectangle< PointType_, TLabel >::difference ( const OtherHalfplane & other) const

◆ difference() [2/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Rectangle< PointType_, TLabel >::difference ( const OtherHalfplane & other) const
nodiscard

Returns the regularized set difference of the two shapes (A ∖ B).

A half-plane is the one-constraint half-plane intersection, and is handled as one: see difference(const OtherIntersection&) const.

◆ difference() [3/7]

template<class PointType_, class TLabel>
template<class ResultNumber, HalfplaneIntersectionConcept OtherIntersection>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Rectangle< PointType_, TLabel >::difference ( const OtherIntersection & other) const

◆ difference() [4/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Rectangle< PointType_, TLabel >::difference ( const OtherIntersection & other) const
nodiscard

Returns the regularized set difference of the two shapes (A ∖ B).

A half-plane intersection may be unbounded, which stops it being a regularizedUnion operand but not a subtrahend: A ∖ B is bounded whenever A is, however far B reaches, so a PolygonSet can hold it. See PolygonWithHoles::difference(const OtherIntersection&) const for the clip that bounds it and for the rest of the contract.

◆ difference() [5/7]

template<class PointType_, class TLabel>
template<class ResultNumber, PolygonalRegionConcept OtherRegion>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Rectangle< PointType_, TLabel >::difference ( const OtherRegion & other) const

◆ difference() [6/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PolygonalRegionConcept OtherRegion>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Rectangle< PointType_, TLabel >::difference ( const OtherRegion & other) const
nodiscard

Returns the regularized set difference of the two shapes (A ∖ B).

A difference is not symmetric, so there is no higher-ranked operand to hand the pair to the way regularizedUnion does: a rectangle has to state it against every region itself. It states it once, over all six of them, by going through its polygon spelling — the same conversion every other operation makes, and one that costs nothing, the four corners already being in canonical polygon order. See Polygon::difference for the contract.

Template Parameters
ResultNumberThe number type for the result.
Parameters
otherThe shape to remove.
Returns
The pieces of the difference, in canonical order.

◆ difference() [7/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::difference ( const Shape< OtherPoint > & other) const
inlinenodiscard

Returns the regularized set difference of the two shapes (A ∖ B), re-dispatching through the wrapper's own difference.

A difference is not symmetric, so unlike regularizedUnion this cannot be handed to other as it stands. It wraps this shape instead and lets the wrapper visit both sides, which throws if the pair is unsupported — here, whenever other turns out to hold anything without area, or a Disk. An unbounded alternative is fine on this side, the result being contained in this shape either way. See Polygon::difference for the contract.

The point type is deduced from other so a plain concrete shape cannot reach this overload through an implicit conversion to Shape.

◆ distanceL1() [1/10]

template<class PointType, class LabelType>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
auto pgl::Rectangle< PointType, LabelType >::distanceL1 ( const OtherHalfplane & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceL1() [2/10]

template<class PointType, class LabelType>
template<class ResultNumber, LineConcept OtherLine>
auto pgl::Rectangle< PointType, LabelType >::distanceL1 ( const OtherLine & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceL1() [3/10]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedLineConcept OtherOrientedLine>
auto pgl::Rectangle< PointType, LabelType >::distanceL1 ( const OtherOrientedLine & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceL1() [4/10]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Rectangle< PointType, LabelType >::distanceL1 ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceL1() [5/10]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Rectangle< PointType, LabelType >::distanceL1 ( const OtherPoint & point) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceL1() [6/10]

template<class PointType, class LabelType>
template<class ResultNumber, RayConcept OtherRay>
auto pgl::Rectangle< PointType, LabelType >::distanceL1 ( const OtherRay & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceL1() [7/10]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Rectangle< PointType, LabelType >::distanceL1 ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceL1() [8/10]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Rectangle< PointType, LabelType >::distanceL1 ( const OtherSegment & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceL1() [9/10]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template distanceL1<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::distanceL1 ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs distanceL1 defined only once, on the higher-ranked shape.

◆ distanceL1() [10/10]

template<class PointType_, class TLabel>
template<class ResultNumber = double, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::distanceL1 ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceL1.

Distance is symmetric, so this just calls other's own distanceL1, which visits its wrapped alternative and throws if the pair is unsupported.

◆ distanceLInf() [1/10]

template<class PointType, class LabelType>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
auto pgl::Rectangle< PointType, LabelType >::distanceLInf ( const OtherHalfplane & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceLInf() [2/10]

template<class PointType, class LabelType>
template<class ResultNumber, LineConcept OtherLine>
auto pgl::Rectangle< PointType, LabelType >::distanceLInf ( const OtherLine & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceLInf() [3/10]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedLineConcept OtherOrientedLine>
auto pgl::Rectangle< PointType, LabelType >::distanceLInf ( const OtherOrientedLine & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceLInf() [4/10]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Rectangle< PointType, LabelType >::distanceLInf ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceLInf() [5/10]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Rectangle< PointType, LabelType >::distanceLInf ( const OtherPoint & point) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceLInf() [6/10]

template<class PointType, class LabelType>
template<class ResultNumber, RayConcept OtherRay>
auto pgl::Rectangle< PointType, LabelType >::distanceLInf ( const OtherRay & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceLInf() [7/10]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Rectangle< PointType, LabelType >::distanceLInf ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceLInf() [8/10]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Rectangle< PointType, LabelType >::distanceLInf ( const OtherSegment & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

An axis-aligned rectangle's closest point has integer coordinate gaps against another axis-aligned shape, so the point/rectangle overloads involve no division and are exact.

◆ distanceLInf() [9/10]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template distanceLInf<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::distanceLInf ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs distanceLInf defined only once, on the higher-ranked shape.

◆ distanceLInf() [10/10]

template<class PointType_, class TLabel>
template<class ResultNumber = double, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::distanceLInf ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceLInf.

Distance is symmetric, so this just calls other's own distanceLInf, which visits its wrapped alternative and throws if the pair is unsupported.

◆ edges()

template<class PointType, class LabelType>
std::array< Segment< PointType >, 4 > pgl::Rectangle< PointType, LabelType >::edges ( ) const
nodiscardconstexpr

Returns the four edges as unordered segments.

The empty rectangle has no edges, so calling this on one is a precondition violation; iterate with edgesBegin / edgesEnd to handle it.

Returns
Bottom, right, top, and left edges.

◆ edgesBegin()

template<class PointType_, class TLabel>
EdgeIterator pgl::Rectangle< PointType_, TLabel >::edgesBegin ( ) const
inlineconstexpr

Returns an iterator to the first edge.

Edges are visited in the same order as edges().

Returns
Iterator to the bottom edge.

◆ edgesEnd()

template<class PointType_, class TLabel>
EdgeIterator pgl::Rectangle< PointType_, TLabel >::edgesEnd ( ) const
inlineconstexpr

Returns an iterator past the last edge.

Returns
Sentinel iterator for edgesBegin().

◆ empty()

template<class PointType_, class TLabel>
bool pgl::Rectangle< PointType_, TLabel >::empty ( ) const
inlinenodiscardconstexpr

Returns whether the rectangle is the empty set of points.

A rectangle is empty when its stored maximum corner falls below its minimum one. Normalizing two opposite corners never produces that state, so it is reached only by Rectangle(), by the minmax constructor, and by the operations that answer with a rectangle covering nothing – all of which store the one canonical empty pair (0,0),(-1,-1). An empty rectangle behaves as EmptyShape: it has no vertices, no area, and every predicate reads it as the empty set.

Because the empty set has exactly that one representation, and because every rectangle covering a point has min x <= max x, the x axis alone decides the question and the y axis need not be read. An operation that writes corners has to keep it that way: corners that invert belong to the canonical empty pair, never to a rectangle of their own.

That one representation is also why a rational coordinate can read the two corners against the canonical constants rather than order them: it asks the same question without a cross-multiplication.

Complexity: O(1).

Returns
true if the rectangle covers no point.

◆ end()

template<class PointType_, class TLabel>
CornerIterator pgl::Rectangle< PointType_, TLabel >::end ( ) const
inlineconstexpr

Returns an iterator past the last corner.

◆ fbox()

template<class PointType, class LabelType>
template<std::floating_point ResultNumber>
Rectangle< Point< ResultNumber > > pgl::Rectangle< PointType, LabelType >::fbox ( ) const
nodiscardconstexpr

Returns a bounding box of the rectangle with floating point coordinates.

Template Parameters
ResultNumberFloating point type.
Returns
A rectangle that contains the rectangle, empty when empty.

◆ get()

template<class PointType_, class TLabel>
PointType pgl::Rectangle< PointType_, TLabel >::get ( std::ptrdiff_t index) const
inlineconstexpr

Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the end.

The empty rectangle has no corners to wrap around, so calling this on one is a precondition violation.

◆ getIfPoint()

template<class PointType, class LabelType>
std::optional< PointType > pgl::Rectangle< PointType, LabelType >::getIfPoint ( ) const
nodiscardconstexpr

Returns the point the rectangle collapses to, if it does.

Complexity: O(1).

Returns
The corner if isPoint, std::nullopt otherwise.

◆ getIfSegment()

template<class PointType, class LabelType>
std::optional< typename Rectangle< PointType, LabelType >::template BoundaryType< false > > pgl::Rectangle< PointType, LabelType >::getIfSegment ( ) const
nodiscardconstexpr

Returns the segment the rectangle collapses to, if it does.

Complexity: O(1).

Returns
The segment from min to max if isSegment, std::nullopt otherwise.

◆ hausdorffDistanceL1() [1/6]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Rectangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [2/6]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Rectangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherPoint & point) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [3/6]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Rectangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [4/6]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Rectangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherSegment & other) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [5/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template hausdorffDistanceL1<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::hausdorffDistanceL1 ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs hausdorffDistanceL1 defined only once, on the higher-ranked shape.

◆ hausdorffDistanceL1() [6/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::hausdorffDistanceL1 ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceL1.

Distance is symmetric, so this just calls other's own hausdorffDistanceL1, which visits its wrapped alternative and throws if the pair is unsupported.

◆ hausdorffDistanceLInf() [1/6]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Rectangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [2/6]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Rectangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherPoint & point) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [3/6]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Rectangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [4/6]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Rectangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherSegment & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [5/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template hausdorffDistanceLInf<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::hausdorffDistanceLInf ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs hausdorffDistanceLInf defined only once, on the higher-ranked shape.

◆ hausdorffDistanceLInf() [6/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::hausdorffDistanceLInf ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceLInf.

Distance is symmetric, so this just calls other's own hausdorffDistanceLInf, which visits its wrapped alternative and throws if the pair is unsupported.

◆ height()

template<class PointType_, class TLabel>
auto pgl::Rectangle< PointType_, TLabel >::height ( ) const
inlinenodiscardconstexpr

Returns the rectangle height.

Returns
max y - min y, or 0 when empty.

◆ index()

template<class PointType_, class TLabel>
std::ptrdiff_t pgl::Rectangle< PointType_, TLabel >::index ( const PointType & point) const
inlineconstexpr

Returns the smallest index i with (*this)[i] == point, or -1 if no corner equals point.

The empty rectangle has no corners, so it always answers -1.

◆ insert() [1/5]

template<class PointType, class LabelType>
requires (!detail::is_point_v<TShape> && !RectangleConcept<TShape> && requires(const TShape& shape) { shape.bbox(); })
template<class TShape>
requires (!detail::is_point_v<TShape> && !RectangleConcept<TShape> && requires(const TShape& shape) { shape.bbox(); })
void pgl::Rectangle< PointType, LabelType >::insert ( const TShape & point)
constexpr

Enlarges the rectangle so that it contains the given point.

Existing corner labels are preserved when their coordinates do not change. Newly synthesized corners use default-constructed labels.

An empty rectangle bounds nothing and so cannot be grown: it becomes the inserted point outright, rather than stretching to reach its inverted placeholder corners.

Template Parameters
OtherPointType of the point.
Parameters
pointPoint to insert.

◆ insert() [2/5]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
void pgl::Rectangle< PointType, LabelType >::insert ( const OtherRectangle< PointType_, TLabel > & other)
constexpr

Enlarges the rectangle so that it contains another rectangle.

Inserting an empty rectangle changes nothing; inserting into an empty one makes it a copy of other.

Template Parameters
OtherNumberCoordinate type of the other rectangle.
OtherPoint::LabelTypeLabel type of the other rectangle.
Parameters
otherRectangle to insert.

◆ insert() [3/5]

template<class PointType_, class TLabel>
template<class TShape>
requires (!detail::is_point_v<TShape> && !RectangleConcept<TShape> && requires(const TShape& shape) { shape.bbox(); })
void pgl::Rectangle< PointType_, TLabel >::insert ( const TShape & shape)
constexpr

Enlarges the rectangle so that it contains a finite shape.

The shape must expose bbox(). Infinite shapes such as lines, rays, and halfplanes do not have a finite bounding box and are intentionally not accepted by this overload. A shape whose bounding box is empty contributes nothing.

Template Parameters
ShapeShape type exposing bbox().
Parameters
shapeShape to insert.

◆ insert() [4/5]

template<class PointType_, class TLabel>
template<std::ranges::input_range Range>
requires (!detail::is_point_v<typename std::ranges::range_value_t<Range>> && requires(const typename std::ranges::range_value_t
<Range>& shape) { shape.bbox(); })
void pgl::Rectangle< PointType_, TLabel >::insert ( Range && range)
inlineconstexpr

Enlarges the rectangle to contain every point in a range of shapes.

The shape must expose bbox(). Infinite shapes such as lines, rays, and halfplanes do not have a finite bounding box and are intentionally not accepted by this overload.

Template Parameters
RangeRange of bounded shapes.
Parameters
rangeRange of shapes to insert.

◆ insert() [5/5]

template<class PointType_, class TLabel>
template<std::ranges::input_range Range = std::initializer_list<PointType>>
requires std::ranges::common_range<Range> && std::convertible_to<std::ranges::range_value_t<Range>, PointType> && (!requires(const
std::remove_cvref_t<Range>& shape) { shape.bbox(); })
void pgl::Rectangle< PointType_, TLabel >::insert ( Range && range)
inlineconstexpr

Enlarges the rectangle so that it contains every point in a range.

A single bounded shape (which exposes bbox()) is handled by the shape overload, even though it may itself be iterable as a range.

Template Parameters
RangeRange of points.
Parameters
rangePoints to insert.

◆ interiorContains() [1/18]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Rectangle< PointType_, TLabel >::interiorContains ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

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

◆ interiorContains() [2/18]

template<class PointType, class LabelType>
template<MonotoneChainConcept OtherChain>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherChain & other) const
nodiscardconstexpr

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

◆ interiorContains() [3/18]

template<class PointType, class LabelType>
template<ConvexConcept OtherConvex>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherConvex & other) const
nodiscardconstexpr

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

◆ interiorContains() [4/18]

template<class PointType, class LabelType>
template<DiskConcept OtherDisk>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherDisk & other) const
nodiscardconstexpr

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

◆ interiorContains() [5/18]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ interiorContains() [6/18]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherLine & other) const
nodiscardconstexpr

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

◆ interiorContains() [7/18]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ interiorContains() [8/18]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ interiorContains() [9/18]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherPoint & point) const
nodiscardconstexpr

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

Rectangle

Axis-aligned rectangle predicates plus the rectangle-local clipping helpers used to answer strict interior and separation questions.

◆ interiorContains() [10/18]

template<class PointType, class LabelType>
template<PolygonConcept OtherPolygon>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherPolygon & other) const
nodiscardconstexpr

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

◆ interiorContains() [11/18]

template<class PointType, class LabelType>
template<PolylineConcept OtherPolyline>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherPolyline & other) const
nodiscardconstexpr

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

◆ interiorContains() [12/18]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherRay & other) const
nodiscardconstexpr

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

◆ interiorContains() [13/18]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

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

The boundary is excluded.

Template Parameters
OtherNumberCoordinate type of the other rectangle corners.
OtherPoint::LabelTypeLabel type of the other rectangle corners.
Parameters
otherOther rectangle.
Returns
true if the interior contains both corners of other.

◆ interiorContains() [14/18]

template<class PointType_, class TLabel>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Rectangle< PointType_, TLabel >::interiorContains ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ interiorContains() [15/18]

template<class PointType, class LabelType>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ interiorContains() [16/18]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ interiorContains() [17/18]

template<class PointType_, class TLabel>
template<PolygonSetConcept OtherSet>
bool pgl::Rectangle< PointType_, TLabel >::interiorContains ( const OtherSet & other) const
inlinenodiscardconstexpr

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

◆ interiorContains() [18/18]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Rectangle< PointType, LabelType >::interiorContains ( const OtherTriangle & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [1/11]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Rectangle< PointType_, TLabel >::interiorsIntersect ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

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

◆ interiorsIntersect() [2/11]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [3/11]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const OtherLine & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [4/11]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [5/11]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [6/11]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const OtherPoint & other) const
nodiscardconstexpr

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

Rectangles with empty interiors never satisfy this predicate.

Template Parameters
OtherNumberCoordinate type of the other rectangle corners.
OtherPoint::LabelTypeLabel type of the other rectangle corners.
Parameters
otherOther rectangle.
Returns
true if the interiors overlap with positive area.

Rectangle

Axis-aligned rectangle predicates plus the rectangle-local clipping helpers used to answer strict interior and separation questions.

◆ interiorsIntersect() [7/11]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const OtherRay & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [8/11]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [9/11]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [10/11]

template<class PointType_, class TLabel>
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>)
bool pgl::Rectangle< PointType_, TLabel >::interiorsIntersect ( const OtherShape & other) const
inlinenodiscardconstexpr

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

◆ interiorsIntersect() [11/11]

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::interiorsIntersect ( const Shape< PointType > & other) const
nodiscardconstexpr

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

◆ intersection() [1/12]

template<class PointType_, class TLabel>
template<class ResultNumber = NumberType, class EmptyPoint>
EmptyShape< EmptyPoint > pgl::Rectangle< PointType_, TLabel >::intersection ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

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

◆ intersection() [2/12]

template<class PointType, class LabelType>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
auto pgl::Rectangle< PointType, LabelType >::intersection ( const OtherHalfplane & other) const
nodiscardconstexpr

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [3/12]

template<class PointType, class LabelType>
template<class ResultNumber, LineConcept OtherLine>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Rectangle< PointType, LabelType >::intersection ( const OtherLine & other) const
nodiscardconstexpr

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [4/12]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedLineConcept OtherOrientedLine>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Rectangle< PointType, LabelType >::intersection ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [5/12]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Rectangle< PointType, LabelType >::intersection ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [6/12]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
std::optional< Point< ResultNumber, typename PointType::LabelType > > pgl::Rectangle< PointType, LabelType >::intersection ( const OtherPoint & other) const
nodiscardconstexpr

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

◆ intersection() [7/12]

template<class PointType, class LabelType>
template<class ResultNumber, RayConcept OtherRay>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Rectangle< PointType, LabelType >::intersection ( const OtherRay & other) const
nodiscardconstexpr

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [8/12]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
std::optional< Rectangle< Point< ResultNumber, typename PointType::LabelType > > > pgl::Rectangle< PointType, LabelType >::intersection ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

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

◆ intersection() [9/12]

template<class PointType_, class TLabel>
template<class ResultNumber = NumberType, HalfplaneIntersectionConcept OtherRegion>
auto pgl::Rectangle< PointType_, TLabel >::intersection ( const OtherRegion & other) const
inlinenodiscardconstexpr

Adds this rectangle's four constraints to a half-plane intersection without deriving vertices.

◆ intersection() [10/12]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Rectangle< PointType, LabelType >::intersection ( const OtherSegment & other) const
nodiscardconstexpr

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [11/12]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && !HalfplaneIntersectionConcept<OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self) { o.template intersection
<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::intersection ( const OtherShape & other) const
inlinenodiscardconstexpr

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [12/12]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::intersection ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), re-dispatching through the wrapper's own intersection.

An intersection is symmetric, so this just calls other's own intersection, which visits its wrapped alternative and throws if the pair is unsupported.

The point type is deduced from other so a plain concrete shape cannot reach this overload through an implicit conversion to Shape.

Returns
The intersection wrapped in a Shape, rather than the tighter type the concrete pair would answer with: which alternative other holds is not known until run time, so neither is the result's.

◆ intersects() [1/11]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Rectangle< PointType_, TLabel >::intersects ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

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

◆ intersects() [2/11]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ intersects() [3/11]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const OtherLine & other) const
nodiscardconstexpr

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

◆ intersects() [4/11]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ intersects() [5/11]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ intersects() [6/11]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const OtherPoint & other) const
nodiscardconstexpr

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

Boundary contact counts as intersection.

Template Parameters
OtherNumberCoordinate type of the other rectangle corners.
OtherPoint::LabelTypeLabel type of the other rectangle corners.
Parameters
otherOther rectangle.
Returns
true if the rectangles share at least one point.

Rectangle

Axis-aligned rectangle predicates plus the rectangle-local clipping helpers used to answer strict interior and separation questions.

◆ intersects() [7/11]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const OtherRay & other) const
nodiscardconstexpr

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

◆ intersects() [8/11]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

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

◆ intersects() [9/11]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ intersects() [10/11]

template<class PointType_, class TLabel>
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>)
bool pgl::Rectangle< PointType_, TLabel >::intersects ( const OtherShape & other) const
inlinenodiscardconstexpr

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

◆ intersects() [11/11]

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::intersects ( const Shape< PointType > & other) const
nodiscardconstexpr

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

◆ isDegenerate()

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::isDegenerate ( ) const
nodiscardconstexpr

Returns whether the rectangle has empty interior.

The empty rectangle has no area either, so it is degenerate.

Returns
true when width or height is zero, or when empty.

Rectangle

Axis-aligned rectangle predicates plus the rectangle-local clipping helpers used to answer strict interior and separation questions.

◆ isPoint()

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::isPoint ( ) const
nodiscardconstexpr

Returns whether the rectangle collapses to a single point.

Complexity: O(1).

Returns
true if width and height are both zero.

◆ isSegment()

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::isSegment ( ) const
nodiscardconstexpr

Returns whether the rectangle collapses to a non-degenerate segment.

True when exactly one of width and height is zero, so the rectangle is a horizontal or vertical segment.

Complexity: O(1).

Returns
true if the rectangle is a segment of positive length.

◆ isUndefined()

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::isUndefined ( ) const
nodiscardconstexpr

Returns whether the rectangle is degenerate without collapsing to a point or to a segment.

A rectangle is undefined if it is not the empty rectangle but has [0] > [1].

Complexity: O(1).

Returns
false.

◆ label()

template<class PointType_, class TLabel>
template<class A = LabelType>
requires (detail::has_label_v<A>)
A & pgl::Rectangle< PointType_, TLabel >::label ( ) const
inlineconstexpr

Returns the rectangle label.

The label is mutable even through a const rectangle: it is metadata that does not participate in equality, hashing, or geometric predicates.

Returns
Reference to the stored label.

◆ latticePoints()

template<class PointType, class LabelType>
requires (detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
template<class ResultNumber>
requires (detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
std::vector< Point< ResultNumber, typename PointType::LabelType > > pgl::Rectangle< PointType, LabelType >::latticePoints ( ) const
nodiscard

Returns the integer points the rectangle contains.

The box is the product of its two sides, so the answer is: every integer of the x range paired with every integer of the y range, with no edge to walk and no crossing to sort. A degenerate box gives the points of the segment or the point it collapsed to.

Template Parameters
ResultNumberInteger coordinate type of the points: the shape's own coordinate type when that is a signed integer, the integer a pgl::Rational is built on, and int64_t for anything else.
Returns
The lattice points, in increasing order, carrying no label.
Exceptions
std::logic_errorIf a coordinate is not finite, or a lattice point of the shape does not fit ResultNumber.
std::length_errorIf there are more of them than a vector holds.

◆ max()

template<class PointType_, class TLabel>
const PointType & pgl::Rectangle< PointType_, TLabel >::max ( ) const
inlineconstexpr

Returns the maximum corner (max x, max y).

The corners of an empty rectangle are inverted placeholders, not points the rectangle covers; see empty.

Returns
Reference to the maximum corner.

◆ midpoint()

template<class PointType, class LabelType>
template<class ResultNumber>
Point< ResultNumber > pgl::Rectangle< PointType, LabelType >::midpoint ( ) const
nodiscardconstexpr

Returns the midpoint of the rectangle.

The empty rectangle has no point to be the middle of, so calling this on one is a precondition violation.

Template Parameters
ResultNumberCoordinate type of the midpoint.
Returns
Midpoint with no label.
Warning
Divides coordinates by 2. Inexact for odd integer coordinates.

◆ min()

template<class PointType_, class TLabel>
const PointType & pgl::Rectangle< PointType_, TLabel >::min ( ) const
inlineconstexpr

Returns the minimum corner (min x, min y).

The corners of an empty rectangle are inverted placeholders, not points the rectangle covers; see empty.

Returns
Reference to the minimum corner.

◆ minkowskiErosion() [1/2]

template<class PointType_, class TLabel>
template<class OtherShape>
requires (!MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape> && BoundedPolygonalConcept<OtherShape>)
auto pgl::Rectangle< PointType_, TLabel >::minkowskiErosion ( const OtherShape & other) const
nodiscardconstexpr

Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).

The pairs MinkowskiSummableConcept turns away, which are exactly the ones whose sum needs a region: a sum sweeps the operand's concavity into its answer, so it is the operand that decides the result type, and minkowskiSum hands the pair over to it.

An erosion reads the operand only through its support function, and a support function sees no further than the convex hull – A ⊖ B is A ⊖ hull(B) for a convex A. So this shape keeps the pair and answers it with the same convex region it erodes to by any other operand, at a cost linear in the two sizes: a Polygon, a PolygonWithHoles, a PolygonSet, a Polyline and a MonotoneChain are all as cheap here as their vertex count.

Template Parameters
OtherShapeType of the shape to erode by.
Parameters
otherShape to erode by.
Returns
The erosion, as a HalfplaneIntersection – the whole plane when other covers no point.

◆ minkowskiErosion() [2/2]

template<class PointType_, class TLabel>
requires MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape>
template<class OtherShape>
requires MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape>
auto pgl::Rectangle< PointType_, TLabel >::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. Two rectangles are the one non-trivial pair closed under the erosion: their minima and their maxima subtract, and the result is empty when a side of the operand is the longer.

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() [1/2]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self) { o.template minkowskiSum
<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::minkowskiSum ( const OtherShape & other) const
inlinenodiscard

Returns the regularized Minkowski sum of the two shapes (A ⊕ B).

The pairs MinkowskiSummableConcept rejects are exactly the ones whose sum needs a region-valued result rather than one bounded convex shape; they are implemented on Polygon and PolygonWithHoles. Forwards to the other shape's implementation so that each unordered pair needs the sum defined only once, on the higher-ranked shape.

◆ minkowskiSum() [2/2]

template<class PointType, class LabelType>
requires MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape>
template<class OtherShape>
requires MinkowskiSummableConcept<Rectangle<PointType_, TLabel>, OtherShape>
auto pgl::Rectangle< PointType, LabelType >::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 Convex< PointType >()

template<class PointType_, class TLabel>
pgl::Rectangle< PointType_, TLabel >::operator Convex< PointType > ( ) const
inlineexplicitnodiscardconstexpr

Converts the rectangle to a convex polygon.

The four corners already follow the canonical convex order (counterclockwise, lexicographically smallest first), and degenerate rectangles collapse to their hull. An empty rectangle gives the empty convex polygon, which has no vertices.

Returns
Convex polygon with the same corners.

◆ operator Polygon< PointType >()

template<class PointType_, class TLabel>
pgl::Rectangle< PointType_, TLabel >::operator Polygon< PointType > ( ) const
inlineexplicitnodiscardconstexpr

Converts the rectangle to a simple polygon.

The four corners already follow the canonical polygon order (counterclockwise, lexicographically smallest first). An empty rectangle gives the empty polygon, which has no vertices.

Returns
Polygon with the same corners.

◆ operator*=() [1/2]

template<class PointType_, class TLabel>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
Rectangle< PointType, LabelType > & pgl::Rectangle< PointType_, TLabel >::operator*= ( const Scalar & scalar)
constexpr

◆ operator*=() [2/2]

template<class PointType_, class TLabel>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
Rectangle & pgl::Rectangle< PointType_, TLabel >::operator*= ( const Scalar & scalar)
constexpr

Scales the rectangle around the origin in place.

Negative scalars keep the stored corners normalized through the non-member scaling operator.

Template Parameters
ScalarScalar type.
Parameters
scalarScale factor.
Returns
Reference to this rectangle.

◆ operator+=() [1/2]

template<class PointType_, class TLabel>
template<PointConcept OtherPoint>
Rectangle< PointType, LabelType > & pgl::Rectangle< PointType_, TLabel >::operator+= ( const OtherPoint & translation)
constexpr

◆ operator+=() [2/2]

template<class PointType_, class TLabel>
template<PointConcept OtherPoint>
Rectangle & pgl::Rectangle< PointType_, TLabel >::operator+= ( const OtherPoint & translation)
constexpr

Translates both stored corners in place.

Template Parameters
OtherNumberCoordinate type of the translation point.
OtherPoint::LabelTypeLabel type of the translation point.
Parameters
translationTranslation vector.
Returns
Reference to this rectangle.

◆ operator-=() [1/2]

template<class PointType_, class TLabel>
template<PointConcept OtherPoint>
Rectangle< PointType, LabelType > & pgl::Rectangle< PointType_, TLabel >::operator-= ( const OtherPoint & translation)
constexpr

◆ operator-=() [2/2]

template<class PointType_, class TLabel>
template<PointConcept OtherPoint>
Rectangle & pgl::Rectangle< PointType_, TLabel >::operator-= ( const OtherPoint & translation)
constexpr

Translates both stored corners by the opposite vector in place.

Template Parameters
OtherNumberCoordinate type of the translation point.
OtherPoint::LabelTypeLabel type of the translation point.
Parameters
translationTranslation vector to subtract.
Returns
Reference to this rectangle.

◆ operator/=() [1/2]

template<class PointType_, class TLabel>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
Rectangle< PointType, LabelType > & pgl::Rectangle< PointType_, TLabel >::operator/= ( const Scalar & scalar)
constexpr

◆ operator/=() [2/2]

template<class PointType_, class TLabel>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
Rectangle & pgl::Rectangle< PointType_, TLabel >::operator/= ( const Scalar & scalar)
constexpr

Divides the rectangle coordinates by a scalar in place.

Negative divisors keep the stored corners normalized through the non-member division operator.

Template Parameters
ScalarScalar type.
Parameters
scalarDivisor.
Returns
Reference to this rectangle.

◆ operator<=>()

template<class PointType_, class TLabel>
auto pgl::Rectangle< PointType_, TLabel >::operator<=> ( const Rectangle< PointType_, TLabel > & other) const
inlineconstexpr

Orders rectangles lexicographically by their (min, max) corners, ignoring the label.

◆ operator=()

template<class PointType_, class TLabel>
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
Rectangle & pgl::Rectangle< PointType_, TLabel >::operator= ( const Rectangle< OtherPointType, OtherLabelType > & other)
inlineconstexpr

Assigns from a rectangle with compatible point and label types.

◆ operator==()

template<class PointType_, class TLabel>
bool pgl::Rectangle< PointType_, TLabel >::operator== ( const Rectangle< PointType_, TLabel > & other) const
inlineconstexpr

Provides lexicographic ordering on (min, max).

Parameters
otherRectangle to compare with.
Returns
-1, 0, or 1.

◆ operator[]()

template<class PointType_, class TLabel>
PointType pgl::Rectangle< PointType_, TLabel >::operator[] ( std::size_t index) const
inlineconstexpr

Returns corner index for index in [0, 4).

Corners are returned in counterclockwise order starting from the minimum corner: min, bottomRight, max, topLeft. Two of the four corners are synthesized from the stored min/max, so the result is returned by value.

The empty rectangle has no corners, so size is 0 and every index is out of range; the assertion is the only check.

Parameters
indexCorner index.
Returns
The selected corner.

◆ orientedEdges()

template<class PointType, class LabelType>
std::array< OrientedSegment< PointType >, 4 > pgl::Rectangle< PointType, LabelType >::orientedEdges ( ) const
nodiscardconstexpr

Returns the four boundary edges in counterclockwise order.

The empty rectangle has no edges, so calling this on one is a precondition violation; iterate with orientedEdgesBegin / orientedEdgesEnd to handle it.

Returns
Bottom, right, top, and left oriented edges.

◆ orientedEdgesBegin()

template<class PointType_, class TLabel>
OrientedEdgeIterator pgl::Rectangle< PointType_, TLabel >::orientedEdgesBegin ( ) const
inlineconstexpr

Returns an iterator to the first oriented edge.

Oriented edges are visited in the same order as orientedEdges().

Returns
Iterator to the bottom oriented edge.

◆ orientedEdgesEnd()

template<class PointType_, class TLabel>
OrientedEdgeIterator pgl::Rectangle< PointType_, TLabel >::orientedEdgesEnd ( ) const
inlineconstexpr

Returns an iterator past the last oriented edge.

Returns
Sentinel iterator for orientedEdgesBegin().

◆ pointInside()

template<class PointType, class LabelType>
template<class ResultNumber>
Point< ResultNumber > pgl::Rectangle< PointType, LabelType >::pointInside ( ) const
nodiscardconstexpr

Returns a point inside the rectangle.

This is the midpoint, even for degenerate rectangles. The empty rectangle has no point inside it, so calling this on one is a precondition violation.

Template Parameters
ResultNumberCoordinate type of the midpoint.
Returns
Midpoint with the rectangle coordinate type.
Warning
Divides coordinates by 2. Inexact for odd integer coordinates.

◆ pointInsideInteriorContainedIn()

template<class PointType, class LabelType>
template<class OtherShape>
bool pgl::Rectangle< PointType, LabelType >::pointInsideInteriorContainedIn ( const OtherShape & shape) const
nodiscardconstexpr

Tests whether some point in this shape's relative interior lies in the strict interior of shape.

Uses pointInside as the witness. When integer truncation rounds that witness onto or outside the boundary, this shape and shape are scaled so the witness is exact, leaving the containment relation unchanged.

◆ regularizedIntersection() [1/2]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const
OtherShape& o, const Rectangle& self) { o.template regularizedIntersection<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::regularizedIntersection ( const OtherShape & other) const
inlinenodiscardconstexpr

Forwards a regularized intersection to the shape that owns it.

◆ regularizedIntersection() [2/2]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::regularizedIntersection ( const Shape< OtherPoint > & other) const
inlinenodiscard

Re-dispatches a regularized intersection through a runtime shape.

◆ regularizedUnion() [1/4]

template<class PointType_, class TLabel>
template<class ResultNumber, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Rectangle< PointType_, TLabel >::regularizedUnion ( const OtherRectangle< PointType_, TLabel > & other) const

◆ regularizedUnion() [2/4]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Rectangle< PointType_, TLabel >::regularizedUnion ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscard

Returns the regularized union of the two shapes (A ∪ B).

Two rectangles are the one pair of PolygonalRegionConcept operands a rectangle owns, being the lowest-ranked of them: every other pair is defined on the higher-ranked operand and reached through the forwarding overload below. The union of two rectangles is a rectangle only by coincidence — two that overlap in a corner make an L, and two that are apart make two pieces — so it answers with a set of regions like every other union. See Polygon::regularizedUnion for the contract.

Template Parameters
ResultNumberThe number type for the result.
Parameters
otherThe rectangle to unite with.
Returns
The pieces of the union, in canonical order.

◆ regularizedUnion() [3/4]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template regularizedUnion<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::regularizedUnion ( const OtherShape & other) const
inlinenodiscard

Returns the regularized union of the two shapes (A ∪ B).

Forwards to the other shape's implementation so that each unordered pair needs regularizedUnion defined only once, on the higher-ranked shape. See Polygon::regularizedUnion for the contract.

◆ regularizedUnion() [4/4]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::regularizedUnion ( const Shape< OtherPoint > & other) const
inlinenodiscard

Returns the regularized union of the two shapes (A ∪ B), re-dispatching through the wrapper's own regularizedUnion.

A union is symmetric, so this just calls other's own regularizedUnion, which visits its wrapped alternative and throws if the pair is unsupported — here, whenever other turns out to hold anything but a bounded polygonal region. See Polygon::regularizedUnion for the contract.

The point type is deduced from other so a plain concrete shape cannot reach this overload through an implicit conversion to Shape.

◆ rotate90()

template<class PointType, class LabelType>
void pgl::Rectangle< PointType, LabelType >::rotate90 ( int k = 1)
constexpr

Rotates the rectangle by 90k degrees around the origin in place.

Parameters
kNumber of 90-degree CCW rotations (may be negative).

◆ rotated90()

template<class PointType, class LabelType>
Rectangle< PointType, LabelType > pgl::Rectangle< PointType, LabelType >::rotated90 ( int k = 1) const
nodiscardconstexpr

Returns the rectangle rotated by 90k degrees around the origin.

Parameters
kNumber of 90-degree CCW rotations (may be negative).
Returns
Rotated rectangle.

◆ samePointSet()

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

Tests whether another shape defines exactly the same point set.

◆ scaledDownX() [1/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Rectangle< PointType, LabelType > pgl::Rectangle< PointType_, TLabel >::scaledDownX ( const OtherNumber scalar) const
constexpr

◆ scaledDownX() [2/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Rectangle pgl::Rectangle< PointType_, TLabel >::scaledDownX ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the rectangle with its x-coordinates divided by a divisor.

◆ scaledDownY() [1/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Rectangle< PointType, LabelType > pgl::Rectangle< PointType_, TLabel >::scaledDownY ( const OtherNumber scalar) const
constexpr

◆ scaledDownY() [2/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Rectangle pgl::Rectangle< PointType_, TLabel >::scaledDownY ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the rectangle with its y-coordinates divided by a divisor.

◆ scaleDownX()

template<class PointType, class LabelType>
template<class OtherNumber>
void pgl::Rectangle< PointType, LabelType >::scaleDownX ( const OtherNumber scalar)
constexpr

Divides the rectangle's x-coordinates by a divisor in place.

◆ scaleDownY()

template<class PointType, class LabelType>
template<class OtherNumber>
void pgl::Rectangle< PointType, LabelType >::scaleDownY ( const OtherNumber scalar)
constexpr

Divides the rectangle's y-coordinates by a divisor in place.

◆ scaledUpX() [1/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Rectangle< PointType, LabelType > pgl::Rectangle< PointType_, TLabel >::scaledUpX ( const OtherNumber scalar) const
constexpr

◆ scaledUpX() [2/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Rectangle pgl::Rectangle< PointType_, TLabel >::scaledUpX ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the rectangle with its x-coordinates multiplied by a factor.

◆ scaledUpY() [1/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Rectangle< PointType, LabelType > pgl::Rectangle< PointType_, TLabel >::scaledUpY ( const OtherNumber scalar) const
constexpr

◆ scaledUpY() [2/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Rectangle pgl::Rectangle< PointType_, TLabel >::scaledUpY ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the rectangle with its y-coordinates multiplied by a factor.

◆ scaleUpX()

template<class PointType, class LabelType>
template<class OtherNumber>
void pgl::Rectangle< PointType, LabelType >::scaleUpX ( const OtherNumber scalar)
constexpr

Multiplies the rectangle's x-coordinates by a factor in place.

◆ scaleUpY()

template<class PointType, class LabelType>
template<class OtherNumber>
void pgl::Rectangle< PointType, LabelType >::scaleUpY ( const OtherNumber scalar)
constexpr

Multiplies the rectangle's y-coordinates by a factor in place.

◆ separates() [1/19]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Rectangle< PointType_, TLabel >::separates ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

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

◆ separates() [2/19]

template<class PointType, class LabelType>
template<MonotoneChainConcept OtherChain>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherChain & other) const
nodiscardconstexpr

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

◆ separates() [3/19]

template<class PointType, class LabelType>
template<ConvexConcept OtherConvex>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherConvex & other) const
nodiscardconstexpr

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

◆ separates() [4/19]

template<class PointType, class LabelType>
template<DiskConcept OtherDisk>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherDisk & other) const
nodiscardconstexpr

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

◆ separates() [5/19]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ separates() [6/19]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherLine & other) const
nodiscardconstexpr

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

◆ separates() [7/19]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ separates() [8/19]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ separates() [9/19]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherPoint & other) const
nodiscardconstexpr

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

◆ separates() [10/19]

template<class PointType, class LabelType>
template<PolygonConcept OtherPolygon>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherPolygon & other) const
nodiscardconstexpr

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

◆ separates() [11/19]

template<class PointType, class LabelType>
template<PolylineConcept OtherPolyline>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherPolyline & other) const
nodiscardconstexpr

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

◆ separates() [12/19]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherRay & other) const
nodiscardconstexpr

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

◆ separates() [13/19]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

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

Rectangle

Axis-aligned rectangle predicates plus the rectangle-local clipping helpers used to answer strict interior and separation questions.

◆ separates() [14/19]

template<class PointType, class LabelType>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherRegion & other) const
nodiscard

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

The region is settled by the cell engine of implementation/separates.hpp; see the notes on pgl::PolygonWithHoles::separates for what a region admits that a simply connected target does not.

◆ separates() [15/19]

template<class PointType, class LabelType>
template<HalfplaneIntersectionConcept OtherRegion>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ separates() [16/19]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ separates() [17/19]

template<class PointType, class LabelType>
template<PolygonSetConcept OtherSet>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherSet & other) const
nodiscard

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

A set of regions is the one target that may already be in several pieces before anything is removed, so this neither folds over its components nor answers false for a remover that misses it. See implementation/separates.hpp.

◆ separates() [18/19]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Rectangle< PointType, LabelType >::separates ( const OtherTriangle & other) const
nodiscardconstexpr

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

◆ separates() [19/19]

template<class PointType, class LabelType>
bool pgl::Rectangle< PointType, LabelType >::separates ( const Shape< PointType > & other) const
nodiscardconstexpr

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

◆ size()

template<class PointType_, class TLabel>
std::size_t pgl::Rectangle< PointType_, TLabel >::size ( ) const
inlinenodiscardconstexpr

Returns the number of corners: 4, or 0 when empty.

◆ squaredDistance() [1/10]

template<class PointType_, class TLabel>
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > pgl::Rectangle< PointType_, TLabel >::squaredDistance ( const Disk< DiskPointType, DiskLabel > & disk) const
inlinenodiscard

Returns the squared Euclidean distance to a disk.

Forwards to Disk::squaredDistance. Reports in detail::floating_result_t<ResultNumber>: a distance realized on a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double.

◆ squaredDistance() [2/10]

template<class PointType, class LabelType>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
auto pgl::Rectangle< PointType, LabelType >::squaredDistance ( const OtherHalfplane & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(other), for an accurate value.

◆ squaredDistance() [3/10]

template<class PointType, class LabelType>
template<class ResultNumber, LineConcept OtherLine>
auto pgl::Rectangle< PointType, LabelType >::squaredDistance ( const OtherLine & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(other), for an accurate value.

◆ squaredDistance() [4/10]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedLineConcept OtherOrientedLine>
auto pgl::Rectangle< PointType, LabelType >::squaredDistance ( const OtherOrientedLine & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(other), for an accurate value.

◆ squaredDistance() [5/10]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Rectangle< PointType, LabelType >::squaredDistance ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(other), for an accurate value.

◆ squaredDistance() [6/10]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Rectangle< PointType, LabelType >::squaredDistance ( const OtherPoint & point) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

The closest point of an axis-aligned rectangle has integer coordinate gaps, so this overload involves no division and is exact.

The empty rectangle has no nearest point, so no distance is defined from it; this holds for every distance on this shape, Euclidean, L1, LInf, and Hausdorff alike, and calling one on an empty rectangle is a precondition violation.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).
OtherPointType of the point.
Parameters
pointPoint to measure from.
Returns
Squared Euclidean distance.

◆ squaredDistance() [7/10]

template<class PointType, class LabelType>
template<class ResultNumber, RayConcept OtherRay>
auto pgl::Rectangle< PointType, LabelType >::squaredDistance ( const OtherRay & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(other), for an accurate value.

◆ squaredDistance() [8/10]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Rectangle< PointType, LabelType >::squaredDistance ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Rectangle-to-rectangle distance uses axis gaps only and is exact.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).
OtherNumberCoordinate type of the other rectangle corners.
OtherPoint::LabelTypeLabel type of the other rectangle corners.
Parameters
otherOther rectangle.
Returns
Squared Euclidean distance.

◆ squaredDistance() [9/10]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Rectangle< PointType, LabelType >::squaredDistance ( const OtherSegment & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(other), for an accurate value.

◆ squaredDistance() [10/10]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template squaredDistance<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::squaredDistance ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs squaredDistance defined only once, on the higher-ranked shape.

◆ squaredHausdorffDistance() [1/5]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Rectangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the squared Hausdorff distance to a point.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).
OtherPointType of the point.
Parameters
pointPoint to measure from.
Returns
Squared Hausdorff distance.

◆ squaredHausdorffDistance() [2/5]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Rectangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherPoint & point) const
nodiscardconstexpr

Returns the squared Hausdorff distance to a point.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).
OtherPointType of the point.
Parameters
pointPoint to measure from.
Returns
Squared Hausdorff distance.

◆ squaredHausdorffDistance() [3/5]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Rectangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the squared Hausdorff distance to another rectangle.

For axis-aligned rectangles, the directed Hausdorff distance is attained at a vertex. It uses only point-to-rectangle distances and is exact.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).
OtherNumberCoordinate type of the other rectangle corners.
OtherPoint::LabelTypeLabel type of the other rectangle corners.
Parameters
otherOther rectangle.
Returns
Squared Hausdorff distance.

◆ squaredHausdorffDistance() [4/5]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Rectangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherSegment & other) const
nodiscardconstexpr

Returns the squared Hausdorff distance to a point.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).
OtherPointType of the point.
Parameters
pointPoint to measure from.
Returns
Squared Hausdorff distance.

◆ squaredHausdorffDistance() [5/5]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template squaredHausdorffDistance<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::squaredHausdorffDistance ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the squared Hausdorff distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs squaredHausdorffDistance defined only once, on the higher-ranked shape.

◆ symmetricDifference() [1/4]

template<class PointType_, class TLabel>
template<class ResultNumber, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Rectangle< PointType_, TLabel >::symmetricDifference ( const OtherRectangle< PointType_, TLabel > & other) const

◆ symmetricDifference() [2/4]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Rectangle< PointType_, TLabel >::symmetricDifference ( const OtherRectangle< PointType_, TLabel > & other) const
nodiscard

Returns the regularized symmetric difference of the two shapes (A △ B).

Two rectangles are the one pair of PolygonalRegionConcept operands a rectangle owns, being the lowest-ranked of them; every other pair is defined on the higher-ranked operand and reached through the forwarding overload below. See Polygon::symmetricDifference for the contract.

Template Parameters
ResultNumberThe number type for the result.
Parameters
otherThe other rectangle.
Returns
The pieces of the symmetric difference, in canonical order.

◆ symmetricDifference() [3/4]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Rectangle>) && requires(const OtherShape& o, const Rectangle& self)
{ o.template symmetricDifference<ResultNumber>(self); })
auto pgl::Rectangle< PointType_, TLabel >::symmetricDifference ( const OtherShape & other) const
inlinenodiscard

Returns the regularized symmetric difference of the two shapes (A △ B).

Forwards to the other shape's implementation so that each unordered pair needs symmetricDifference defined only once, on the higher-ranked shape. See Polygon::symmetricDifference for the contract.

◆ symmetricDifference() [4/4]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Rectangle< PointType_, TLabel >::symmetricDifference ( const Shape< OtherPoint > & other) const
inlinenodiscard

Returns the regularized symmetric difference of the two shapes (A △ B), re-dispatching through the wrapper's own symmetricDifference.

A symmetric difference is symmetric, so this just calls other's own, which visits its wrapped alternative and throws if the pair is unsupported. See Polygon::symmetricDifference for the contract.

The point type is deduced from other so a plain concrete shape cannot reach this overload through an implicit conversion to Shape.

◆ twiceArea()

template<class PointType, class LabelType>
auto pgl::Rectangle< PointType, LabelType >::twiceArea ( ) const
nodiscardconstexpr

Returns twice the rectangle area.

Returns
2 * area.

◆ vertices()

template<class PointType, class LabelType>
std::array< typename Rectangle< PointType, LabelType >::PointType, 4 > pgl::Rectangle< PointType, LabelType >::vertices ( ) const
nodiscardconstexpr

Returns the four vertices in counterclockwise order.

The first vertex is the minimum corner. The empty rectangle has no vertices, so calling this on one is a precondition violation; iterate with begin / end to handle it.

Returns
Vertices (xmin,ymin), (xmax,ymin), (xmax,ymax), (xmin,ymax).

◆ verticesContain()

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Rectangle< PointType, LabelType >::verticesContain ( const OtherPoint & point) const
nodiscardconstexpr

Returns whether a point is one of the rectangle vertices.

Template Parameters
OtherPointType of the point.
Parameters
pointPoint to test.
Returns
true if the point is a rectangle corner.

◆ width()

template<class PointType_, class TLabel>
auto pgl::Rectangle< PointType_, TLabel >::width ( ) const
inlinenodiscardconstexpr

Returns the rectangle width.

Returns
max x - min x, or 0 when empty.