![]() |
Pangolin
Header-only C++20 plane computational geometry library
|
Closed convex polygon stored by its vertices. More...
#include <convex.hpp>
Classes | |
| class | BoundaryIterator |
| Forward iterator over the (optionally oriented) boundary edges. 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>> |
| using | EdgeIterator = BoundaryIterator<false> |
| using | OrientedEdgeIterator = BoundaryIterator<true> |
Public Member Functions | |
| constexpr | Convex ()=default |
| Creates a convex with no vertex. | |
| 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 | Convex (Range &&points, bool trusted=false) |
| Creates a convex from a range of points. | |
| constexpr | Convex (std::initializer_list< NumberType > coords, bool trusted=false) |
| Creates a convex from a flat list of coordinates. | |
| template<PointConcept OtherPointType, class OtherLabelType> requires (std::constructible_from<PointType, const OtherPointType&>) | |
| constexpr | Convex (const Convex< OtherPointType, OtherLabelType > &other) |
| Converts a convex with compatible vertex type. | |
| template<class A = LabelType> requires (detail::has_label_v<A>) | |
| constexpr A & | label () const |
| Returns the convex-polygon label. | |
| constexpr const PointType | operator[] (std::size_t index) const |
| Accesses a vertex by index. | |
| 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. Useful for iterating polygon edges where the last edge wraps around. | |
| constexpr auto | begin () const |
| Returns a constant iterator to the beginning of vertices. | |
| constexpr auto | cbegin () const |
| Returns a constant iterator to the beginning of vertices. | |
| constexpr auto | end () const |
| Returns a constant iterator to the end of vertices. | |
| constexpr auto | cend () const |
| Returns a constant iterator to the end of vertices. | |
| constexpr auto | operator<=> (const Convex &other) const |
| Compares two convex polygons. | |
| constexpr bool | operator== (const Convex &other) const |
| Checks equality of two convex polygons. | |
| template<AnyShapeConcept OtherShape> | |
| constexpr bool | samePointSet (const OtherShape &other) const |
| Tests whether another shape defines exactly the same point set. | |
| constexpr auto | twiceArea () const |
| Computes twice the area of the convex polygon. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr auto | area () const |
| Computes the area of the convex polygon. | |
| constexpr bool | empty () const |
| Returns whether the convex polygon is the empty set of points. | |
| constexpr bool | isDegenerate () const |
| Checks if the convex polygon is degenerate (has zero area). | |
| constexpr bool | isPoint () const |
| Returns whether the convex polygon collapses to a single point. | |
| constexpr std::optional< PointType > | getIfPoint () const |
| Returns the point the convex polygon collapses to, if it does. | |
| constexpr bool | isSegment () const |
| Returns whether the convex polygon collapses to a non-degenerate segment. | |
| constexpr std::optional< BoundaryType< false > > | getIfSegment () const |
| Returns the segment the convex polygon collapses to, if it does. | |
| constexpr bool | isUndefined () const |
| Returns whether the convex polygon is degenerate without collapsing to a point or to a segment. | |
| constexpr const Rectangle< PointType > & | bbox () const |
| Computes the bounding box of the convex polygon. | |
| 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 convex polygon contains. | |
| template<std::floating_point ResultNumber = double> | |
| constexpr Rectangle< Point< ResultNumber > > | fbox () const |
| Computes the floating-point bounding box of the convex polygon. | |
| constexpr const std::vector< PointType > | vertices () const |
| Returns the vertices of the convex polygon. | |
| constexpr Convex< PointType > | convexHull () const |
| Returns the convex hull of the polygon's vertices. | |
| constexpr std::vector< Segment< PointType > > | edges () const |
| Returns the edges of the convex polygon. | |
| constexpr std::vector< OrientedSegment< PointType > > | orientedEdges () const |
| Returns the oriented edges of the convex polygon. | |
| constexpr auto | verticesView () const |
| Returns a lazy view over the vertices, translating each on the fly instead of allocating a vector. | |
| constexpr auto | edgesView () const |
| Returns a lazy view over the edges, materializing each Segment on the fly instead of allocating a vector. | |
| constexpr auto | orientedEdgesView () const |
| Lazy view counterpart of orientedEdges(); see edgesView(). | |
| constexpr EdgeIterator | edgesBegin () const |
| Returns an iterator to the first unoriented edge. | |
| constexpr EdgeIterator | edgesEnd () const |
| Returns an iterator past the last unoriented 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 | operator Polygon< PointType > () const |
| Converts the convex polygon to a simple polygon. | |
| constexpr Polygon< PointType > | asPolygon () const |
| Returns the convex polygon as a simple polygon. | |
| constexpr PolygonWithHoles< PointType > | asPolygonWithHoles () const |
| Returns the convex polygon as a hole-free region. | |
| constexpr PolygonSet< PointType > | asPolygonSet () const |
| Returns the convex polygon as a one-component set of regions. | |
| constexpr HalfplaneIntersection< PointType > | asHalfplaneIntersection () const |
| Returns the convex polygon as a half-plane intersection. | |
| constexpr MonotoneChain< PointType > | lowerHull () const |
| Returns the lower hull: the boundary chain running from the lexicographically smallest vertex to the lexicographically largest one, counterclockwise (below the polygon). | |
| constexpr MonotoneChain< PointType > | upperHull () const |
| Returns the upper hull: the boundary chain running from the lexicographically smallest vertex to the lexicographically largest one, clockwise (above the polygon). | |
| template<PointConcept OtherPoint> requires (!detail::is_point_v<TShape> && requires(const TShape& shape) { shape.vertices(); }) | |
| constexpr void | insert (const OtherPoint &point) |
| Enlarges the convex polygon so that it contains the given point. | |
| template<class TShape> requires (!detail::is_point_v<TShape> && requires(const TShape& shape) { shape.vertices(); }) | |
| constexpr void | insert (const TShape &shape) |
| Enlarges the convex polygon 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.vertices(); }) | |
| constexpr void | insert (Range &&range) |
| Enlarges the convex polygon so that it contains every point in a range. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr Point< ResultNumber > | centroid () const |
| Computes the centroid of the convex polygon. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr Point< ResultNumber > | verticesCentroid () const |
| Computes the centroid of the vertex set. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr Point< ResultNumber > | pointInside () const |
| Returns a point inside the convex polygon. | |
| 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. | |
| size_t | size () const |
| Returns the number of vertices in the convex polygon. | |
| constexpr size_t | maxIndex () const |
| Returns the index of the maximum vertex (rightmost and highest in case of ties). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | verticesContain (const OtherPoint &point) const |
| Checks if the vertices list contains the given point. | |
| constexpr std::ptrdiff_t | index (const PointType &point) const |
| Returns the smallest index i with (*this)[i] == point, or -1 if point is not a vertex. | |
| constexpr std::vector< std::pair< std::size_t, std::size_t > > | antipodalPairs () const |
| Returns every antipodal vertex-index pair, via rotating calipers. | |
| constexpr Segment< PointType > | diameter () const |
| Returns a segment realizing the diameter (the farthest vertex pair). | |
| constexpr HalfplaneIntersection< PointType > | smallestEnclosingRectangle () const |
| Returns the smallest-area rectangle containing the convex polygon. | |
| constexpr HalfplaneIntersection< PointType > | smallestEnclosingSlab () const |
| Returns the narrowest slab containing the convex polygon. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr ResultNumber | squaredMinimumWidth () const |
| Returns the squared minimum width of the convex polygon. | |
| template<class ApproximateNumber = double> | |
| ApproximateNumber | minimumWidth () const |
| Returns the minimum width of the convex polygon. | |
| template<class UniformRandomBitGenerator> | |
| Disk< Point< NumberType > > | smallestEnclosingDisk (UniformRandomBitGenerator &&generator) const |
| Returns the smallest closed disk containing the convex polygon. | |
| Disk< Point< NumberType > > | smallestEnclosingDisk () const |
| Returns the smallest closed disk containing the convex polygon. | |
| 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 | boundaryContains (const Shape< OtherPoint > &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<class OtherNumberType> | |
| constexpr std::optional< std::array< Segment< PointType >, 2 > > | edgesAtX (OtherNumberType x) const |
| Returns two edges of the convex polygon that intersect with the vertical line at x. | |
| template<PointConcept OtherPoint> | |
| constexpr bool | contains (const OtherPoint &point) 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<LineConcept OtherLine> | |
| constexpr bool | contains (const OtherLine &) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | contains (const OtherOrientedLine &) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<RayConcept OtherRay> | |
| constexpr bool | contains (const OtherRay &) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | contains (const OtherHalfplane &) 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). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | contains (const Shape< OtherPoint > &other) const |
| Tests whether this shape 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<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<LineConcept OtherLine> | |
| constexpr bool | interiorContains (const OtherLine &) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | interiorContains (const OtherOrientedLine &) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<RayConcept OtherRay> | |
| constexpr bool | interiorContains (const OtherRay &) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | interiorContains (const OtherHalfplane &) 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<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<DiskConcept OtherDisk> | |
| constexpr bool | interiorContains (const OtherDisk &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | interiorContains (const Shape< OtherPoint > &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂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<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<RayConcept OtherRay> | |
| constexpr bool | intersects (const OtherRay &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<TriangleConcept OtherTriangle> | |
| constexpr bool | intersects (const OtherTriangle &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | intersects (const OtherPoint &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 ≠ ∅). | |
| template<ConvexConcept OtherConvex> | |
| constexpr bool | intersects (const OtherConvex &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | intersects (const OtherDisk &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | intersects (const Shape< OtherPoint > &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<typename OtherShape> requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Convex>) | |
| 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<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<RectangleConcept OtherRectangle> | |
| constexpr bool | interiorsIntersect (const OtherRectangle &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | interiorsIntersect (const OtherTriangle &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<ConvexConcept OtherConvex> | |
| constexpr bool | interiorsIntersect (const OtherConvex &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | interiorsIntersect (const OtherDisk &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | interiorsIntersect (const Shape< OtherPoint > &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<Convex>) | |
| 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) ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | separates (const OtherPoint &) 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<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<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 &) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | separates (const OtherRectangle &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<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). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | separates (const OtherDisk &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | separates (const Shape< OtherPoint > &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | crosses (const OtherPoint &) 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<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<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 &) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | crosses (const OtherRectangle &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | crosses (const OtherTriangle &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<ConvexConcept OtherConvex> | |
| constexpr bool | crosses (const OtherConvex &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | crosses (const OtherDisk &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | crosses (const Shape< OtherPoint > &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<Convex>) | |
| 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). | |
| template<class ResultNumber = division_result_t<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>, 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>, ConvexConcept OtherConvex> | |
| constexpr auto | squaredDistance (const OtherConvex &other) const |
| Returns the squared Euclidean distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle> | |
| constexpr auto | squaredDistance (const OtherTriangle &other) const |
| Returns the squared Euclidean distance to the given shape. | |
| template<class ResultNumber = division_result_t<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>, 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>, 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 = double, DiskConcept OtherDisk> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherDisk &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<Convex>) && requires(const OtherShape& o, const Convex& 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 = NumberType, BoundedPolygonalConcept OtherShape> requires detail::ClosestPairConcept<Convex<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<Convex<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 = division_result_t<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>, 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>, ConvexConcept OtherConvex> | |
| constexpr auto | distanceL1 (const OtherConvex &other) const |
| Returns the Manhattan (L1) distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle> | |
| constexpr auto | distanceL1 (const OtherTriangle &other) const |
| Returns the Manhattan (L1) distance to the given shape. | |
| template<class ResultNumber = division_result_t<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>, 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>, 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 = division_result_t<NumberType>, typename OtherShape> requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>) && requires(const OtherShape& o, const Convex& 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 Manhattan (L1) distance to the given shape. | |
| template<class ResultNumber = division_result_t<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>, 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>, ConvexConcept OtherConvex> | |
| constexpr auto | distanceLInf (const OtherConvex &other) const |
| Returns the Chebyshev (LInf) distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle> | |
| constexpr auto | distanceLInf (const OtherTriangle &other) const |
| Returns the Chebyshev (LInf) distance to the given shape. | |
| template<class ResultNumber = division_result_t<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>, 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>, 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 = division_result_t<NumberType>, typename OtherShape> requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>) && requires(const OtherShape& o, const Convex& 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 Manhattan (L1) 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>, RectangleConcept OtherRectangle> | |
| constexpr auto | hausdorffDistanceL1 (const OtherRectangle &other) const |
| Returns the Manhattan (L1) Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle> | |
| constexpr auto | hausdorffDistanceL1 (const OtherTriangle &other) const |
| Returns the Manhattan (L1) Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex> | |
| constexpr auto | hausdorffDistanceL1 (const OtherConvex &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<Convex>) && requires(const OtherShape& o, const Convex& 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 Manhattan (L1) 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>, RectangleConcept OtherRectangle> | |
| constexpr auto | hausdorffDistanceLInf (const OtherRectangle &other) const |
| Returns the Chebyshev (LInf) Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle> | |
| constexpr auto | hausdorffDistanceLInf (const OtherTriangle &other) const |
| Returns the Chebyshev (LInf) Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex> | |
| constexpr auto | hausdorffDistanceLInf (const OtherConvex &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<Convex>) && requires(const OtherShape& o, const Convex& 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 Manhattan (L1) distance to the given shape. | |
| template<class ResultNumber = NumberType, PointConcept OtherPoint> | |
| constexpr auto | squaredHausdorffDistance (const OtherPoint &point) const |
| Returns the squared Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment> | |
| constexpr auto | squaredHausdorffDistance (const OtherSegment &other) const |
| Returns the squared Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment> | |
| constexpr auto | squaredHausdorffDistance (const OtherOrientedSegment &other) const |
| Returns the squared Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle> | |
| constexpr auto | squaredHausdorffDistance (const OtherRectangle &other) const |
| Returns the squared Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle> | |
| constexpr auto | squaredHausdorffDistance (const OtherTriangle &other) const |
| Returns the squared Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex> | |
| constexpr auto | squaredHausdorffDistance (const OtherConvex &other) const |
| Returns the squared Hausdorff distance to the given shape. | |
| template<class ResultNumber = division_result_t<NumberType>, typename OtherShape> requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>) && requires(const OtherShape& o, const Convex& self) { o.template squaredHausdorffDistance<ResultNumber>(self); }) | |
| constexpr auto | squaredHausdorffDistance (const OtherShape &other) const |
| Returns the squared Hausdorff distance to the given shape. | |
| 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 = 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>, 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>, 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 std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > >, Convex< Point< ResultNumber, typename PointType::LabelType > > > > | 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 convex polygon's constraints to a half-plane intersection without deriving vertices. | |
| template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle> | |
| constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > >, Convex< 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>, TriangleConcept OtherTriangle> | |
| constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > >, Convex< Point< ResultNumber, typename PointType::LabelType > > > > | intersection (const OtherTriangle &other) const |
| Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint. | |
| template<class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex> | |
| constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > >, Convex< Point< ResultNumber, typename PointType::LabelType > > > > | intersection (const OtherConvex &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> && !HalfplaneIntersectionConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Convex>) && requires(const OtherShape& o, const Convex& 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<Convex>) && requires(const OtherShape& o, const Convex& 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. | |
| constexpr Convex | rotated90 (int k=1) const |
| Returns the convex polygon rotated by 90k degrees around the origin. | |
| constexpr void | rotate90 (int k=1) |
| Rotates the convex polygon by 90k degrees around the origin in place. | |
| template<class OtherNumber> | |
| constexpr Convex | scaledUpX (const OtherNumber scalar) const |
| Returns the convex polygon with its x-coordinates multiplied by a factor. | |
| template<class OtherNumber> | |
| constexpr void | scaleUpX (const OtherNumber scalar) |
| Multiplies the convex polygon's x-coordinates by a factor in place. | |
| template<class OtherNumber> | |
| constexpr Convex | scaledUpY (const OtherNumber scalar) const |
| Returns the convex polygon with its y-coordinates multiplied by a factor. | |
| template<class OtherNumber> | |
| constexpr void | scaleUpY (const OtherNumber scalar) |
| Multiplies the convex polygon's y-coordinates by a factor in place. | |
| template<class OtherNumber> | |
| constexpr Convex | scaledDownX (const OtherNumber scalar) const |
| Returns the convex polygon with its x-coordinates divided by a divisor. | |
| template<class OtherNumber> | |
| constexpr void | scaleDownX (const OtherNumber scalar) |
| Divides the convex polygon's x-coordinates by a divisor in place. | |
| template<class OtherNumber> | |
| constexpr Convex | scaledDownY (const OtherNumber scalar) const |
| Returns the convex polygon with its y-coordinates divided by a divisor. | |
| template<class OtherNumber> | |
| constexpr void | scaleDownY (const OtherNumber scalar) |
| Divides the convex polygon's y-coordinates by a divisor in place. | |
| template<class OtherShape> requires MinkowskiSummableConcept<Convex<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<Convex<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<Convex<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<Convex<PointType_, TLabel>, OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank <Convex>) && requires(const OtherShape& o, const Convex& 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>, ConvexConcept OtherConvex> | |
| PolygonSet< Point< ResultNumber, typename PointType::LabelType > > | regularizedUnion (const OtherConvex &other) const |
| Returns the regularized union of the two shapes (A ∪ B). | |
| template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle> | |
| PolygonSet< Point< ResultNumber, typename PointType::LabelType > > | regularizedUnion (const OtherTriangle &other) const |
| Returns the regularized union 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<Convex>) && requires(const OtherShape& o, const Convex& 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>, ConvexConcept OtherConvex> | |
| PolygonSet< Point< ResultNumber, typename PointType::LabelType > > | symmetricDifference (const OtherConvex &other) const |
| Returns the regularized symmetric difference of the two shapes (A △ B). | |
| template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle> | |
| PolygonSet< Point< ResultNumber, typename PointType::LabelType > > | symmetricDifference (const OtherTriangle &other) const |
| Returns the regularized symmetric 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<Convex>) && requires(const OtherShape& o, const Convex& 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 Convex & | operator+= (const OtherPoint &translation) |
| Translates the convex polygon by the given point in place. | |
| template<PointConcept OtherPoint> | |
| constexpr Convex & | operator-= (const OtherPoint &translation) |
| Translates the convex polygon by the negation of the given point. | |
| template<class Scalar> requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>) | |
| constexpr Convex & | operator*= (const Scalar &scalar) |
| Scales the convex polygon by the given scalar. | |
| template<class Scalar> requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>) | |
| constexpr Convex & | operator/= (const Scalar &scalar) |
| Divides the convex polygon by the given scalar. | |
| template<class UniformRandomBitGenerator> | |
| Disk< Point< typename Convex< PointType, LabelType >::NumberType > > | smallestEnclosingDisk (UniformRandomBitGenerator &&generator) const |
| 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, ConvexConcept OtherConvex> | |
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > | regularizedUnion (const OtherConvex &other) const |
| template<class ResultNumber, TriangleConcept OtherTriangle> | |
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > | regularizedUnion (const OtherTriangle &other) const |
| template<class ResultNumber, RectangleConcept OtherRectangle> | |
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > | regularizedUnion (const OtherRectangle &other) const |
| template<class ResultNumber, ConvexConcept OtherConvex> | |
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > | symmetricDifference (const OtherConvex &other) const |
| template<class ResultNumber, TriangleConcept OtherTriangle> | |
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > | symmetricDifference (const OtherTriangle &other) const |
| template<class ResultNumber, RectangleConcept OtherRectangle> | |
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > | symmetricDifference (const OtherRectangle &other) const |
| template<PointConcept OtherPoint> | |
| constexpr Convex< PointType, LabelType > & | operator+= (const OtherPoint &translation) |
| template<PointConcept OtherPoint> | |
| constexpr Convex< PointType, LabelType > & | operator-= (const OtherPoint &translation) |
| template<class Scalar> requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>) | |
| constexpr Convex< PointType, LabelType > & | operator*= (const Scalar &scalar) |
| template<class Scalar> requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>) | |
| constexpr Convex< PointType, LabelType > & | operator/= (const Scalar &scalar) |
| template<class OtherNumber> | |
| constexpr Convex< PointType, LabelType > | scaledUpX (const OtherNumber scalar) const |
| template<class OtherNumber> | |
| constexpr Convex< PointType, LabelType > | scaledUpY (const OtherNumber scalar) const |
| template<class OtherNumber> | |
| constexpr Convex< PointType, LabelType > | scaledDownX (const OtherNumber scalar) const |
| template<class OtherNumber> | |
| constexpr Convex< PointType, LabelType > | scaledDownY (const OtherNumber scalar) const |
Closed convex polygon stored by its vertices.
| using pgl::Convex< PointType_, TLabel >::BoundaryType = std::conditional_t<Oriented, OrientedSegment<PointType>, Segment<PointType>> |
| using pgl::Convex< PointType_, TLabel >::EdgeIterator = BoundaryIterator<false> |
| using pgl::Convex< PointType_, TLabel >::LabelType = TLabel |
| using pgl::Convex< PointType_, TLabel >::NumberType = PointType::NumberType |
| using pgl::Convex< PointType_, TLabel >::OrientedEdgeIterator = BoundaryIterator<true> |
| using pgl::Convex< PointType_, TLabel >::PointType = PointType_ |
|
constexprdefault |
Creates a convex with no vertex.
|
inlineexplicitconstexpr |
Creates a convex from a range of points.
| Range | Input range whose elements can be converted to PointType. |
| points | Range of points to enclose. |
| trusted | Set to true if the points are already convex hull vertices starting from the leftmost and ccw. |
|
inlineexplicitconstexpr |
Creates a convex from a flat list of coordinates.
The values are consumed in pairs (x0, y0, x1, y1, …), each pair forming one point, so the list must hold an even number of values.
| coords | Interleaved x/y coordinates of the points to enclose. |
| trusted | Set to true if the points are already convex hull vertices starting from the leftmost and ccw. |
|
inlineconstexpr |
Converts a convex with compatible vertex type.
| OtherPointType | Source vertex type. |
| other | Source convex. |
|
constexpr |
Returns every antipodal vertex-index pair, via rotating calipers.
A pair of vertices is antipodal when the polygon admits two parallel supporting lines, one through each vertex. The pairs are produced with a single rotating-calipers sweep over the CCW boundary. Each unordered pair is reported once as {i, j} with i < j, where the indices refer to the CCW vertex order exposed by operator[]. A convex polygon has at most 3n/2 antipodal pairs.
Complexity: O(n) for n vertices.
|
constexpr |
Computes the area of the convex polygon.
|
inlinenodiscardconstexpr |
Returns the convex polygon as a half-plane intersection.
The region is the intersection of the edge half-planes. An empty polygon produces the empty region; a degenerate one (a point or a segment) produces the corresponding degenerate region.
|
inlinenodiscardconstexpr |
Returns the convex polygon as a simple polygon.
|
inlinenodiscardconstexpr |
Returns the convex polygon as a one-component set of regions.
A convex polygon with no area covers nothing that survives regularization, so it gives back the empty set rather than a component without area.
|
inlinenodiscardconstexpr |
Returns the convex polygon as a hole-free region.
|
constexpr |
Computes the bounding box of the convex polygon.
The result is computed on the first call and cached in bbox_; later calls return the stored value. Any operation that modifies the convex resets the cache.
Complexity: O(log n) for n vertices on the first call, O(1) thereafter.
|
inlineconstexpr |
Returns a constant iterator to the beginning of vertices.
|
inlinenodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Returns false unless the convex polygon has at most two vertices. Complexity: O(log n) for n vertices on this convex polygon.
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Returns false unless all disk points are the same and that point is on the boundary of this convex polygon. Complexity: O(log n) for n vertices on this convex polygon.
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type to check. |
| point | The point to check. |
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices (four edge checks).
|
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.
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices.
Uses three O(log n) point-membership queries: both endpoints must lie on the boundary, and so must the midpoint. For a convex polygon, a segment with all three on the boundary necessarily lies on a single edge — otherwise it would be a chord passing through the interior.
| OtherPoint | The point type of the segment. |
| other | The segment to check. |
|
inlinenodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Complexity: O(log n) for n vertices (three edge checks).
|
constexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
inlineconstexpr |
Returns a constant iterator to the beginning of vertices.
|
inlineconstexpr |
Returns a constant iterator to the end of vertices.
|
constexpr |
Computes the centroid of the convex polygon.
| ResultNumber | The number type for the result. |
|
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.
| ResultNumber | Coordinate type of the returned points (default: division_result_t). |
ResultNumber it truncates. Request a floating-point or pgl::Rational result type for an accurate value.
|
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.
| ResultNumber | Coordinate type of the returned segments (default: NumberType). |
other's coordinates and labels are re-expressed in this shape's, so a narrower ResultNumber loses them.
|
inlinenodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
Complexity: O(min(n,m) log (n+m)) for convex polygons with n and m vertices.
| OtherPoint | The point type of the convex polygon. |
| other | The convex polygon to check. |
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
Complexity: O(n) for n vertices on this convex polygon.
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
| OtherPoint | The point type of the halfplane. |
| other | The halfplane to check. |
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
| OtherPoint | The point type of the line. |
| other | The line to check. |
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
| OtherPoint | The point type of the oriented line. |
| other | The oriented line to check. |
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the oriented segment. |
| other | The oriented segment to check. |
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type to check. |
| point | The point to check. |
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
| OtherPoint | The point type of the ray. |
| other | The ray to check. |
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the rectangle. |
| other | The rectangle to check. |
|
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.
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the segment. |
| other | The segment to check. |
|
inlinenodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the triangle. |
| other | The triangle to check. |
|
constexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
inlinenodiscardconstexpr |
Returns the convex hull of the polygon's vertices.
A convex polygon is already its own hull, so this just drops the label.
|
inlinenodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(n log m + m log n) for this polygon with n vertices and the other with m vertices.
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(n) for n vertices on this convex polygon.
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(1).
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(1).
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(n) for n vertices, dominated by interiorsIntersect.
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(log n) for n vertices.
|
inlinenodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
Complexity: O(n) for n vertices, dominated by interiorsIntersect.
|
constexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
constexpr |
Returns a segment realizing the diameter (the farthest vertex pair).
The farthest pair of vertices of a convex polygon is always antipodal, so the diameter is the longest segment over antipodalPairs(). Distances are compared exactly via squared length.
Complexity: O(n) for n vertices.
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< 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.
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< 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.
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< 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 convex polygon 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 vertices already being in canonical polygon order. See Polygon::difference for the contract.
| ResultNumber | The number type for the result. |
| other | The shape to remove. |
|
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.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
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 (the only shape ranked above Convex is Polygon).
|
nodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the L1 gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
inlinenodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Distance is symmetric, so this just calls other's own distanceL1, which visits its wrapped alternative and throws if the pair is unsupported.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
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 (the only shape ranked above Convex is Polygon).
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) distance to the given shape.
Unlike squaredDistance, this always uses the O(n) edge scan (no cyclic support-function search): the LInf gauge is not linear along an edge normal the way the Euclidean squared distance is, so the fast path's search functional does not carry over.
|
inlinenodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Distance is symmetric, so this just calls other's own distanceL1, which visits its wrapped alternative and throws if the pair is unsupported.
|
inlineconstexpr |
Returns the edges of the convex polygon.
|
constexpr |
Returns two edges of the convex polygon that intersect with the vertical line at x.
If the vertical line at x does not intersect the polygon, then std::nullopt is returned. If the vertical line at x intersects the polygon, then it returns an edge of the strict upper convex boundary and an edge of the strict lower convex boundary. By strict I mean that the edges returned are not vertical. If the intersection happens at a vertex between two non-vertical esges, then either one may be returned.
Complexity: O(log n) for n vertices.
| x | The x-coordinate of the vertical line. |
|
inlineconstexpr |
Returns an iterator to the first unoriented edge.
|
inlineconstexpr |
Returns an iterator past the last unoriented edge.
|
inlineconstexpr |
|
inlinenodiscardconstexpr |
Returns whether the convex polygon is the empty set of points.
A convex polygon with no vertices covers nothing, which is the state of a default-constructed one, of the hull of no points, and of every convex-valued result that comes back empty. It behaves as EmptyShape: every predicate reads it as the empty set.
Complexity: O(1).
|
inlineconstexpr |
Returns a constant iterator to the end of vertices.
|
constexpr |
Computes the floating-point bounding box of the convex polygon.
| ResultNumber | The floating-point type for the result. |
|
inlineconstexpr |
Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the end. Useful for iterating polygon edges where the last edge wraps around.
|
nodiscardconstexpr |
Returns the point the convex polygon collapses to, if it does.
Complexity: O(1).
|
nodiscardconstexpr |
Returns the segment the convex polygon collapses to, if it does.
Complexity: O(1).
|
nodiscardconstexpr |
Returns the Manhattan (L1) Hausdorff distance to the given shape.
|
nodiscardconstexpr |
Returns the Manhattan (L1) Hausdorff distance to the given shape.
|
nodiscardconstexpr |
Returns the Manhattan (L1) Hausdorff distance to the given shape.
|
nodiscardconstexpr |
Returns the Manhattan (L1) Hausdorff distance to the given shape.
|
nodiscardconstexpr |
Returns the Manhattan (L1) Hausdorff distance to the given shape.
|
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 (the only shape ranked above Convex is Polygon).
|
nodiscardconstexpr |
Returns the Manhattan (L1) Hausdorff distance to the given shape.
|
inlinenodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Distance is symmetric, so this just calls other's own distanceL1, which visits its wrapped alternative and throws if the pair is unsupported.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
|
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 (the only shape ranked above Convex is Polygon).
|
nodiscardconstexpr |
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
|
inlinenodiscardconstexpr |
Returns the Manhattan (L1) distance to the given shape.
Distance is symmetric, so this just calls other's own distanceL1, which visits its wrapped alternative and throws if the pair is unsupported.
|
constexpr |
Returns the smallest index i with (*this)[i] == point, or -1 if point is not a vertex.
Complexity: O(log n) for n vertices, via binary search over the two monotone boundary chains (mirrors verticesContain).
| point | The vertex to locate. |
|
constexpr |
Enlarges the convex polygon so that it contains the given point.
Complexity: O(log n) when the point is already contained, O(n log n) otherwise, for n vertices.
| OtherPoint | Type of the point. |
| point | Point to insert. |
|
constexpr |
Enlarges the convex polygon so that it contains a finite shape.
The shape must expose vertices() — its convex hull is then the hull of those vertices. Shapes without vertices (disks) and infinite shapes (lines, rays, halfplanes) are intentionally not accepted.
Complexity: O((n + k) log(n + k)) for n vertices and a shape with k vertices.
| TShape | Shape type exposing vertices(). |
| shape | Shape to insert. |
|
inlineconstexpr |
Enlarges the convex polygon so that it contains every point in a range.
A shape (which exposes vertices()) is handled by the shape overload, even though it may itself be iterable as a range of points.
Complexity: O((n + k) log(n + k)) for n vertices and k inserted points.
| Range | Range of points. |
| range | Points to insert. |
|
inlinenodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Complexity: O(min(n,m) log (m+n)) for polygons with n and m vertices
| OtherPoint | The point type of the convex polygon. |
| other | The convex polygon to check. |
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Complexity: O(n) for n vertices on this convex polygon.
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
| OtherPoint | The point type of the halfplane. |
| other | The halfplane to check. |
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
| OtherPoint | The point type of the line. |
| other | The line to check. |
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
| OtherPoint | The point type of the oriented line. |
| other | The oriented line to check. |
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the oriented segment. |
| other | The oriented segment to check. |
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type to check. |
| point | The point to check. |
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
| OtherPoint | The point type of the ray. |
| other | The ray to check. |
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the rectangle. |
| other | The rectangle to check. |
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the segment. |
| other | The segment to check. |
|
inlinenodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the triangle. |
| other | The triangle to check. |
|
constexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
inlinenodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(min(n,m) log(m+n)) for polygons with n and m vertices. A bounding-box test filters disjoint inputs in O(1).
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(n) for n vertices on this convex polygon.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
Uses intersection to obtain the convex polygon-ray intersect exactly in O(log n); the interiors meet iff the intersect is a non-degenerate chord not lying on the convex polygon boundary.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
Uses intersection to obtain the convex polygon-segment intersect exactly in O(log n); the interiors meet iff the intersect is a non-degenerate chord not lying on the convex polygon boundary.
|
inlinenodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
inlinenodiscardconstexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O((n+m) log(n+m)) for n and m vertices.
| ResultNumber | The number type for the result. |
| OtherPoint | The point type of the other convex polygon. |
| other | The other convex polygon to intersect with. |
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Clips the convex polygon to the closed half-plane. Complexity: O(log n + k log k) where n is the input size and k is the output size.
| ResultNumber | The number type for the result. |
| OtherHalfplane | The half-plane type to intersect with. |
| other | The half-plane to intersect with. |
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O(log n) for n vertices.
| ResultNumber | The number type for the result. |
| OtherPoint | The point type of the line. |
| other | The line to intersect with. |
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O(log n) for n vertices.
| ResultNumber | The number type for the result. |
| OtherPoint | The point type of the oriented line. |
| other | The oriented line to intersect with. |
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O(log n) for n vertices.
| ResultNumber | The number type for the result. |
| OtherPoint | The point type of the oriented segment. |
| other | The oriented segment to intersect with. |
|
nodiscardconstexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned point. |
| OtherPoint | Point type. |
| other | Point to intersect with. |
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O(log n) for n vertices.
| ResultNumber | The number type for the result. |
| OtherPoint | The point type of the ray. |
| other | The ray to intersect with. |
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O(log n) for n vertices.
| ResultNumber | The number type for the result. |
| OtherPoint | The point type of the rectangle. |
| other | The rectangle to intersect with. |
|
inlinenodiscardconstexpr |
Adds this convex polygon's constraints to a half-plane intersection without deriving vertices.
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O(log n) for n vertices.
| ResultNumber | The number type for the result. |
| OtherPoint | The point type of the segment. |
| other | The segment to intersect with. |
|
inlinenodiscardconstexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
|
constexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Complexity: O(log n) for n vertices.
| ResultNumber | The number type for the result. |
| OtherPoint | The point type of the triangle. |
| other | The triangle to intersect with. |
|
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.
other holds is not known until run time, so neither is the result's.
|
inlinenodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(min(n,m) log(n+m)) for convex polygons with n and m vertices. Cheap bounding-box check filters out disjoint cases in O(1).
| OtherPoint | The point type of the other convex polygon. |
| other | The convex polygon to check intersection with. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(n) for n vertices on this convex polygon.
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the half-plane. |
| other | The half-plane to check intersection with. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the line. |
| other | The line to check intersection with. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the oriented line. |
| other | The oriented line to check intersection with. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the oriented segment. |
| other | The oriented segment to check intersection with. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type to check. |
| other | The point to check. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the ray. |
| other | The ray to check intersection with. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the rectangle. |
| other | The rectangle to check intersection with. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the segment. |
| other | The segment to check intersection with. |
|
inlinenodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Complexity: O(log n) for n vertices.
| OtherPoint | The point type of the triangle. |
| other | The triangle to check intersection with. |
|
constexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
constexpr |
Checks if the convex polygon is degenerate (has zero area).
The empty convex polygon has no area either, so it is degenerate.
|
nodiscardconstexpr |
Returns whether the convex polygon collapses to a single point.
The hull invariant keeps the vertices distinct, so this normally means a single stored vertex; coincident vertices of a trusted polygon are handled too.
Complexity: O(1).
|
nodiscardconstexpr |
Returns whether the convex polygon collapses to a non-degenerate segment.
Holds when exactly two distinct vertices are stored.
Complexity: O(1).
|
nodiscardconstexpr |
Returns whether the convex polygon is degenerate without collapsing to a point or to a segment.
A convex polygon is never undefined: a degenerate one is always empty, a point, or a segment, so this always returns false. Use empty to detect the one that covers nothing. Provided for uniformity with the other shapes.
Complexity: O(1).
|
inlineconstexpr |
Returns the convex-polygon label.
The label is mutable even through a const convex polygon: it is metadata that does not participate in equality, hashing, or geometric predicates.
|
nodiscard |
Returns the integer points the convex polygon contains.
The boundary included: a point on an edge is a point of the shape. The boundary answers for its own points, edge by edge as segments, and a sweep over the columns of the bounding box answers for the rest, so the cost is one pass over the edges plus one point per point reported.
| ResultNumber | Integer 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. |
| std::logic_error | If a coordinate is not finite, or a lattice point of the shape does not fit ResultNumber. |
| std::length_error | If there are more of them than a vector holds. |
|
inlineconstexpr |
Returns the lower hull: the boundary chain running from the lexicographically smallest vertex to the lexicographically largest one, counterclockwise (below the polygon).
The two chains share their extreme vertices and together cover the whole boundary. A vertical edge at the rightmost x belongs to the lower hull, a vertical edge at the leftmost x to the upper hull, because the extremes are the lexicographic ones. For a degenerate convex polygon (at most two vertices) both chains are the polygon itself.
Complexity: O(n) for n vertices.
|
constexpr |
Returns the index of the maximum vertex (rightmost and highest in case of ties).
Complexity: O(log n) for n vertices.
|
nodiscard |
Returns the minimum width of the convex polygon.
The distance between the two supporting lines of smallestEnclosingSlab. Generally irrational, hence the floating-point return type; use squaredMinimumWidth to compare widths exactly. Divides the supporting distance by the edge length rather than taking the root of the squared width, so only one square root enters the result.
A polygon with fewer than three vertices returns zero.
Complexity: O(n) for n vertices.
| ApproximateNumber | Floating-point return type. |
|
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.
| OtherShape | Type of the shape to erode by. |
| other | Shape to erode by. |
other covers no point.
|
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. A convex polygon erodes to the region its own constraints leave once each is moved in.
Eroding by a shape that covers no point is the whole plane, which a HalfplaneIntersection returns and the tighter result types cannot.
| OtherShape | Type of the shape to erode by. |
| other | Shape to erode by. |
|
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.
|
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.
| OtherShape | Type of the other shape. |
| other | Shape to sum with. |
|
inlineexplicitnodiscardconstexpr |
Converts the convex polygon to a simple polygon.
The vertices already follow the canonical polygon order (counterclockwise, lexicographically smallest first).
|
constexpr |
|
constexpr |
Scales the convex polygon by the given scalar.
Complexity: O(n) for n vertices since we need to apply the scaling to each vertex.
| Scalar | The scalar type. |
| scalar | The scaling factor. |
|
constexpr |
|
constexpr |
Translates the convex polygon by the given point in place.
|
constexpr |
|
constexpr |
Translates the convex polygon by the negation of the given point.
Complexity: O(1).
| OtherPoint | The point type of the translation vector. |
| translation | The translation vector to negate. |
|
constexpr |
|
constexpr |
Divides the convex polygon by the given scalar.
Complexity: O(n) for n vertices since we need to apply the division to each vertex.
| Scalar | The scalar type. |
| scalar | The divisor. |
|
inlineconstexpr |
Compares two convex polygons.
| other | The other convex polygon to compare with. |
|
inlineconstexpr |
Checks equality of two convex polygons.
| other | The other convex polygon to compare with. |
|
inlineconstexpr |
Accesses a vertex by index.
| index | The index of the vertex. |
|
inlineconstexpr |
Returns the oriented edges of the convex polygon.
|
inlineconstexpr |
Returns an iterator to the first oriented edge.
|
inlineconstexpr |
Returns an iterator past the last oriented edge.
|
inlineconstexpr |
Lazy view counterpart of orientedEdges(); see edgesView().
|
constexpr |
Returns a point inside the convex polygon.
Complexity: O(1).
| ResultNumber | The number type for the result. |
|
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.
|
inlinenodiscardconstexpr |
Forwards a regularized intersection to the shape that owns it.
|
inlinenodiscard |
Re-dispatches a regularized intersection through a runtime shape.
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< PointType_, TLabel >::regularizedUnion | ( | const OtherConvex< PointType_, TLabel > & | other | ) | const |
|
nodiscard |
Returns the regularized union of the two shapes (A ∪ B).
The union of two bounded convex shapes is convex 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. A convex polygon is the highest-ranked of the three bounded convex regions, so it owns its pairs with all three; the pairs with an operand above it are defined there and reached through the forwarding overload below. See Polygon::regularizedUnion for the contract.
| ResultNumber | The number type for the result. |
| other | The shape to unite with. |
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< PointType_, TLabel >::regularizedUnion | ( | const OtherRectangle & | other | ) | const |
|
nodiscard |
Returns the regularized union of the two shapes (A ∪ B).
|
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.
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< PointType_, TLabel >::regularizedUnion | ( | const OtherTriangle & | other | ) | const |
|
nodiscard |
Returns the regularized union of the two shapes (A ∪ B).
|
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.
|
constexpr |
Rotates the convex polygon by 90k degrees around the origin in place.
| k | Number of 90-degree CCW rotations (may be negative). |
|
nodiscardconstexpr |
Returns the convex polygon rotated by 90k degrees around the origin.
| k | Number of 90-degree CCW rotations (may be negative). |
|
nodiscardconstexpr |
Tests whether another shape defines exactly the same point set.
|
constexpr |
|
nodiscardconstexpr |
Returns the convex polygon with its x-coordinates divided by a divisor.
|
constexpr |
|
nodiscardconstexpr |
Returns the convex polygon with its y-coordinates divided by a divisor.
|
constexpr |
Divides the convex polygon's x-coordinates by a divisor in place.
|
constexpr |
Divides the convex polygon's y-coordinates by a divisor in place.
|
constexpr |
|
nodiscardconstexpr |
Returns the convex polygon with its x-coordinates multiplied by a factor.
|
constexpr |
|
nodiscardconstexpr |
Returns the convex polygon with its y-coordinates multiplied by a factor.
|
constexpr |
Multiplies the convex polygon's x-coordinates by a factor in place.
|
constexpr |
Multiplies the convex polygon's y-coordinates by a factor in place.
|
inlinenodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(min(n,m) log(m+n)) for convex polygons with n vertices and m vertices.
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(n) for n vertices on this convex polygon.
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(1).
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(log n) for n vertices.
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(1).
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Unlike the Convex overload, a reflex polygon can dip into the convex body through several separate pockets while staying connected, so counting boundary arcs is not enough. The polygon is cut iff some connected component of the intersection touches the polygon boundary in two or more pieces, detected by walking the contacts around the convex boundary; this includes a convex body inside the polygon that pinches the boundary at two touch points.
Complexity: O(n log m + c m + c log c) for n polygon vertices, m convex polygon vertices, and c boundary contacts.
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(log n) for n vertices.
The ray is split iff its source lies outside the closed polygon (so the leading piece survives) and the ray actually intersects the convex polygon.
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(log n) for n vertices (four edge checks).
|
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.
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(log n) for n vertices.
A segment collinear with one of the convex polygon's boundary edges is not separated by the convex polygon — the convex polygon only touches the segment along the boundary, not through its interior, so the two outside extensions are not produced by removing the convex polygon's body. We therefore require the segment to cross the convex polygon interior, not just intersect it.
|
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.
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Complexity: O(log n) for n vertices (three edge checks).
|
constexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
inline |
Returns the number of vertices in the convex polygon.
|
nodiscard |
Returns the smallest closed disk containing the convex polygon.
This overload supplies the generator for the randomized incremental order, from a fixed seed, so the same polygon always yields the same disk. See the generator-taking overload for the contract.
Complexity: expected O(n) for n vertices.
| Disk< Point< typename Convex< PointType, LabelType >::NumberType > > pgl::Convex< PointType_, TLabel >::smallestEnclosingDisk | ( | UniformRandomBitGenerator && | generator | ) | const |
|
nodiscard |
Returns the smallest closed disk containing the convex polygon.
Delegates to pgl::smallestEnclosingDisk over the hull vertices, which is enough: a disk containing the vertices contains their hull. The returned disk keeps the coordinate number type and drops labels.
Complexity: expected O(n) for n vertices.
| UniformRandomBitGenerator | Generator accepted by std::shuffle. |
| generator | Generator used to randomize the incremental order. |
|
nodiscardconstexpr |
Returns the smallest-area rectangle containing the convex polygon.
A minimum-area enclosing rectangle always has one side flush with an edge of the polygon, so a single rotating-calipers sweep over the edges finds it: for each edge, three support vertices (the two extremes along the edge direction and the farthest one from the edge line) give the rectangle flush with that edge, and the sweep advances each support forward only.
The rectangle is generally not axis-parallel, and its corners are generally not representable in NumberType: they divide by the squared length of the edge the rectangle rests on. Its four supporting lines are, though — each runs through a vertex, along the flush edge or along that edge turned 90 degrees. So the result is a HalfplaneIntersection, which is exact in the polygon's own coordinate type, and the caller asks for the corners at whatever precision it wants, with k.vertices<ResultNumber>() or k.asConvex<ResultNumber>().
A polygon with fewer than three vertices has no area to enclose: the result is the polygon's own region, exactly as asHalfplaneIntersection returns it (empty, a point, or a segment).
Complexity: O(n) for n vertices. Comparing two candidate areas is degree six in the coordinates, past what a promoted coordinate type holds, so that comparison runs in a type that grows to hold it: pgl::BigInt for integral coordinates, pgl::ERational for rational ones, and the promoted floating-point type — no exact type — for floating-point ones.
|
nodiscardconstexpr |
Returns the narrowest slab containing the convex polygon.
The width of a convex polygon is the smallest distance between two parallel supporting lines, and the slab they bound is what this returns. The minimum is always attained with one of the two lines flush with an edge, so a single rotating-calipers sweep over the edges finds it: for each edge, the farthest vertex from that edge's line gives the slab flush with it, and that support advances forward only.
Both supporting lines are exact in NumberType – one runs along an edge, the other through a vertex along that same edge vector – while the distance between them is not, since it divides by the edge length and takes a square root. So the region comes back as a HalfplaneIntersection, exact in the polygon's own coordinate type, and the width itself is asked for separately with squaredMinimumWidth or minimumWidth. The slab is unbounded, so it has no bbox(); k.vertices<ResultNumber>() is empty for it.
A polygon with fewer than three vertices has no width to minimize: the result is the polygon's own region, exactly as asHalfplaneIntersection returns it (empty, a point, or a segment), which is the degenerate slab of width zero.
Complexity: O(n) for n vertices. Comparing two candidate widths is degree six in the coordinates, past what a promoted coordinate type holds, so that comparison runs in a type that grows to hold it: pgl::BigInt for integral coordinates, pgl::ERational for rational ones, and the promoted floating-point type – no exact type – for floating-point ones.
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Zero when the two convex polygons intersect; otherwise the smallest squared distance between them.
For two disjoint convex polygons the closest point of one lies on its boundary, hence on one of its edges. The minimum over all edges of one polygon of the edge-to-polygon distance therefore equals the polygon-to- polygon distance. The edges of the polygon with fewer vertices are queried — each query is the O(log m) squaredDistance(const OtherSegment&) search against the other polygon.
An overlap test guards the case where the fewer-vertex polygon strictly contains the other: there no edge of the queried polygon meets the other, yet the true distance is zero.
Complexity: O(min(n,m) log(n+m)) for polygons with n and m vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherConvex | The other convex polygon type. |
| other | The convex polygon to measure to. |
ResultNumber a perpendicular witness divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
nodiscard |
Returns the squared Euclidean distance to the given shape.
Zero when the disk and the polygon intersect; otherwise the square of distance(center, polygon) - radius, the gap between the polygon and the nearest point of the circle.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double.
Complexity: O(log n) for n vertices.
| OtherDisk | The disk type. |
| other | The disk to measure to. |
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Zero when the polygon intersects the half-plane; otherwise the polygon lies entirely on the far side of the boundary line, so its closest point of the half-plane is on that boundary and the distance equals the distance to Halfplane::asLine.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherHalfplane | The half-plane type. |
| other | The half-plane to measure to. |
ResultNumber the perpendicular distance divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Zero when the line intersects the convex polygon; otherwise the smallest squared distance between the two shapes.
A line disjoint from the polygon leaves the whole polygon on one side, so the closest point of the polygon is the vertex extremal along the line normal toward the line. The signed-distance functional is linear, hence cyclic-unimodal over the CCW vertices; its two extrema — the only candidates — are located with the same O(log n) cyclic search used by the segment overload, and the nearer of the two gives the exact minimum.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherLine | The line type. |
| other | The line to measure to. |
ResultNumber the perpendicular distance divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Orientation does not affect distance, so this forwards to the unoriented squaredDistance(const OtherLine&) overload via OrientedLine::asLine.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherOrientedLine | The oriented line type. |
| other | The oriented line to measure to. |
ResultNumber the perpendicular distance divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Orientation does not affect distance, so this forwards to the unoriented squaredDistance(const OtherSegment&) overload.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherOrientedSegment | The oriented segment type. |
| other | The oriented segment to measure to. |
ResultNumber a perpendicular witness divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Zero when the convex polygon contains the point (boundary included); otherwise the smallest squared distance from the point to an edge.
For an exterior point the closest boundary point lies on the contiguous chain of edges that face the point. That chain is located in logarithmic time: an interior reference point and two support-function searches bracket the edge the ray to the query exits through (which faces the query) and the opposite edge; a binary search then grows the facing chain, over which the per-edge distance is unimodal, and a final binary search picks the closest edge. The per-vertex distances themselves are not unimodal, so a direct search over vertices does not work.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
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>(point), for an accurate value.
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Zero when the ray intersects the convex polygon; otherwise the smallest squared distance between the two shapes.
For disjoint inputs the closest pair is realized either between the ray's source and the polygon, or between a polygon vertex and the interior of the ray. The first witness is the O(log n) squaredDistance(const OtherPoint&) query on the source. The remaining witnesses lie on the polygon vertices extremal along the ray normal: that functional is linear, hence cyclic-unimodal over the CCW vertices, so its two extrema are found with the same O(log n) cyclic search used by the segment overload. Measuring those vertices with Ray::squaredDistance clamps to the ray, absorbing the cases where the extremal vertex projects behind the source (the source query then supplies the true minimum).
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherRay | The ray type. |
| other | The ray to measure to. |
ResultNumber a perpendicular witness divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Forwards to the squaredDistance(const OtherConvex&) overload via the rectangle's Rectangle::asConvex representation.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherRectangle | The rectangle type. |
| other | The rectangle to measure to. |
ResultNumber a perpendicular witness divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Zero when the convex polygon and the segment intersect; otherwise the smallest squared distance between the two shapes.
For disjoint inputs the closest pair is realized either between a segment endpoint and the polygon, or between a polygon vertex and the interior of the segment. The first two witnesses are the two squaredDistance point-to-polygon queries on the endpoints. The third witness, when it exists, lies on the polygon vertex nearest the segment's supporting line: a vertex extremal along the segment normal. That normal functional is linear, hence cyclic-unimodal over the CCW vertices, so its two extrema — the candidate witnesses — are found with the same O(log n) cyclic search used elsewhere. The endpoint queries absorb every case in which the extremal vertex projects outside the segment (including a polygon edge parallel to the segment), so the four candidates together give the exact minimum.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherSegment | The segment type. |
| other | The segment to measure to. |
ResultNumber a perpendicular witness divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
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 (the only shape ranked above Convex is Polygon).
|
nodiscardconstexpr |
Returns the squared Euclidean distance to the given shape.
Forwards to the squaredDistance(const OtherConvex&) overload via the triangle's Triangle::asConvex representation.
Complexity: O(log n) for n vertices.
| ResultNumber | Coordinate type of the returned distance (default: division_result_t). |
| OtherTriangle | The triangle type. |
| other | The triangle to measure to. |
ResultNumber a perpendicular witness divides a squared length, so the result truncates and is inexact. Request a floating-point or pgl::Rational result type for an accurate value.
|
nodiscardconstexpr |
Returns the squared Hausdorff distance to the given shape.
The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.
| ResultNumber | Coordinate type of the returned distance (default: NumberType). |
|
nodiscardconstexpr |
Returns the squared Hausdorff distance to the given shape.
The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.
| ResultNumber | Coordinate type of the returned distance (default: NumberType). |
|
nodiscardconstexpr |
Returns the squared Hausdorff distance to the given shape.
The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.
| ResultNumber | Coordinate type of the returned distance (default: NumberType). |
|
nodiscardconstexpr |
Returns the squared Hausdorff distance to the given shape.
The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.
| ResultNumber | Coordinate type of the returned distance (default: NumberType). |
|
nodiscardconstexpr |
Returns the squared Hausdorff distance to the given shape.
The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.
| ResultNumber | Coordinate type of the returned distance (default: NumberType). |
|
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 (the only shape ranked above Convex is Polygon).
|
nodiscardconstexpr |
Returns the squared Hausdorff distance to the given shape.
The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.
| ResultNumber | Coordinate type of the returned distance (default: NumberType). |
|
nodiscardconstexpr |
Returns the squared minimum width of the convex polygon.
The width divides by an edge length and is therefore irrational, but its square is the fraction (2 * area)^2 / |edge|^2 and stays exact: this is the form to compare against a threshold or between polygons, the way squaredLength and squaredDistance are used elsewhere. Fitting through a gap of width w is squaredMinimumWidth() <= w * w, decided exactly for integral coordinates.
A polygon with fewer than three vertices has no width to minimize and returns zero, which is the width of its degenerate slab.
Complexity: O(n) for n vertices.
| ResultNumber | Type of the returned value (default: division_result_t). |
ResultNumber truncates the fraction, and squaring the numerator in it may overflow; the default type holds the value exactly. | PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< PointType_, TLabel >::symmetricDifference | ( | const OtherConvex< PointType_, TLabel > & | other | ) | const |
|
nodiscard |
Returns the regularized symmetric difference of the two shapes (A △ B).
A convex polygon is the highest-ranked of the three bounded convex regions, so it owns its pairs with all three; the pairs with an operand above it are defined there and reached through the forwarding overload below. See Polygon::symmetricDifference for the contract.
| ResultNumber | The number type for the result. |
| other | The other shape. |
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< PointType_, TLabel >::symmetricDifference | ( | const OtherRectangle & | other | ) | const |
|
nodiscard |
Returns the regularized symmetric difference of the two shapes (A △ B).
|
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.
| PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Convex< PointType_, TLabel >::symmetricDifference | ( | const OtherTriangle & | other | ) | const |
|
nodiscard |
Returns the regularized symmetric difference of the two shapes (A △ B).
|
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.
|
constexpr |
Computes twice the area of the convex polygon.
|
inlineconstexpr |
Returns the upper hull: the boundary chain running from the lexicographically smallest vertex to the lexicographically largest one, clockwise (above the polygon).
See lowerHull for how the two chains split the boundary.
Complexity: O(n) for n vertices.
|
inlineconstexpr |
Returns the vertices of the convex polygon.
|
constexpr |
Computes the centroid of the vertex set.
| ResultNumber | The number type for the result. |
|
constexpr |
Checks if the vertices list contains the given point.
Complexity: O(log n) for n vertices.
| OtherPoint | The point type to check. |
| point | The point to check. |
|
inlineconstexpr |
Returns a lazy view over the vertices, translating each on the fly instead of allocating a vector.
Same counterclockwise vertex sequence as vertices(), with no heap allocation. The convex polygon is itself a vertex range, so this is just begin() and end() packaged as a view for callers that take one.