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

Two-dimensional point with optional label payload. More...

#include <point.hpp>

Inheritance diagram for pgl::Point< TNumber, TLabel >:
[legend]

Public Types

using NumberType = TNumber
using LabelType = TLabel

Public Member Functions

constexpr Point ()=default
 Creates the origin point (0, 0).
constexpr Point (NumberType x, NumberType y)
 Creates a point from its x and y coordinates.
template<class X, class Y, class A>
requires (std::constructible_from<NumberType, const X&> && std::constructible_from<NumberType, const Y&> &&
std::constructible_from<LabelType, A&&>)
constexpr Point (const X &x, const Y &y, A &&label)
 Creates a point from its coordinates and label.
template<PointConcept OtherPoint>
constexpr Point (const OtherPoint &other)
 Converts a point with different coordinate and label types.
constexpr const NumberTypex () const
 Returns the x coordinate.
NumberTypex ()
constexpr const NumberTypey () const
 Returns the y coordinate.
NumberTypey ()
template<class A = LabelType>
requires (detail::has_label_v<A>)
constexpr A & label () const
 Returns the stored label.
constexpr const NumberTypeoperator[] (std::size_t index) const
 Returns coordinate 0 for x and 1 for y.
NumberTypeoperator[] (std::size_t index)
 Returns coordinate 0 for x and 1 for y.
constexpr const NumberTypeget (std::ptrdiff_t index) const
 Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the end.
constexpr NumberTypeget (std::ptrdiff_t index)
constexpr std::ptrdiff_t index (const NumberType &value) const
 Returns the smallest index i with (*this)[i] == value, or -1 if no coordinate equals value.
constexpr auto begin ()
 Returns an iterator to the first coordinate.
constexpr auto begin () const
constexpr auto cbegin () const
 Returns an iterator to the first coordinate.
constexpr auto end ()
 Returns an iterator past the last coordinate.
constexpr auto end () const
constexpr auto cend () const
 Returns an iterator past the last coordinate.
constexpr Point operator- () const
 Returns the point mirrored through the origin.
template<PointConcept OtherPoint>
constexpr bool operator== (const OtherPoint &other) const
 Tests coordinate equality.
template<AnyShapeConcept OtherShape>
constexpr bool samePointSet (const OtherShape &other) const
 Tests whether another shape defines exactly the same point set.
template<PointConcept OtherPoint>
constexpr std::strong_ordering operator<=> (const OtherPoint &other) const
 Provides lexicographic ordering on (x, y).
constexpr Rectangle< Pointbbox () const
 Returns the bounding box of the point.
template<std::floating_point ResultNumber = double>
constexpr Rectangle< Point< ResultNumber > > fbox () const
 Returns a floating-point bounding box containing the point.
constexpr std::array< Point, 1 > vertices () const
 Returns the unique vertex of the point-shaped object.
constexpr Convex< PointconvexHull () const
 Returns the convex hull of the point.
constexpr std::array< Segment< Point >, 0 > edges () const
 Returns the point boundary edges.
constexpr std::array< OrientedSegment< Point >, 0 > orientedEdges () const
 Returns the oriented boundary edges.
template<PointConcept OtherPoint>
constexpr bool contains (const OtherPoint &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<SegmentConcept OtherSegment>
constexpr bool contains (const OtherSegment &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool contains (const OtherOrientedSegment &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<LineConcept OtherLine>
constexpr bool contains (const OtherLine &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool contains (const OtherOrientedLine &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<RayConcept OtherRay>
constexpr bool contains (const OtherRay &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<HalfplaneConcept OtherHalfplane>
constexpr bool contains (const OtherHalfplane &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<RectangleConcept OtherRectangle>
constexpr bool contains (const OtherRectangle &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<TriangleConcept OtherTriangle>
constexpr bool contains (const OtherTriangle &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<ConvexConcept OtherConvex>
constexpr bool contains (const OtherConvex &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PolygonConcept OtherPolygon>
constexpr bool contains (const OtherPolygon &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<DiskConcept OtherDisk>
constexpr bool contains (const OtherDisk &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool contains (const Shape< Point< TNumber, TLabel > > &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool boundaryContains (const Shape< Point< TNumber, TLabel > > &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<class EmptyPoint>
constexpr bool contains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<class EmptyPoint>
constexpr bool boundaryContains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<class EmptyPoint>
constexpr bool interiorContains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PointConcept OtherPoint>
constexpr bool boundaryContains (const OtherPoint &other) 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<PointConcept OtherPoint>
constexpr bool interiorContains (const OtherPoint &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<SegmentConcept OtherSegment>
constexpr bool interiorContains (const OtherSegment &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool interiorContains (const OtherOrientedSegment &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<LineConcept OtherLine>
constexpr bool interiorContains (const OtherLine &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool interiorContains (const OtherOrientedLine &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<RayConcept OtherRay>
constexpr bool interiorContains (const OtherRay &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<HalfplaneConcept OtherHalfplane>
constexpr bool interiorContains (const OtherHalfplane &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<RectangleConcept OtherRectangle>
constexpr bool interiorContains (const OtherRectangle &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<TriangleConcept OtherTriangle>
constexpr bool interiorContains (const OtherTriangle &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<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<DiskConcept OtherDisk>
constexpr bool boundaryContains (const OtherDisk &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<PointConcept OtherPoint>
constexpr bool separates (const OtherPoint &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<HalfplaneConcept OtherHalfplane>
constexpr bool separates (const OtherHalfplane &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<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<DiskConcept OtherDisk>
constexpr bool separates (const OtherDisk &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<PointConcept OtherPoint>
constexpr bool intersects (const OtherPoint &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
constexpr bool intersects (const Shape< Point< TNumber, TLabel > > &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
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) ≠ ∅).
constexpr bool interiorsIntersect (const Shape< Point< TNumber, TLabel > > &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<Point>)
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<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<PointConcept OtherPoint>
constexpr bool crosses (const OtherPoint &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
constexpr bool crosses (const Shape< Point< TNumber, TLabel > > &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<Point>)
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 = NumberType, PointConcept OtherPoint>
constexpr std::optional< Point< ResultNumber, LabelType > > intersection (const OtherPoint &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = NumberType, typename OtherShape>
requires (!PointConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>) && requires(const OtherShape& o,
const Point& 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 = NumberType, class EmptyPoint>
constexpr EmptyShape< EmptyPoint > intersection (const EmptyShape< EmptyPoint > &) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto squaredDistance (const OtherPoint &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto squaredDistance (const OtherRectangle &other) const
 Returns the squared distance to an axis-aligned rectangle without division.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!RectangleConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>) && requires(const
OtherShape& o, const Point& self) { o.template squaredDistance<ResultNumber>(self); })
constexpr auto squaredDistance (const OtherShape &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > squaredDistance (const Disk< DiskPointType, DiskLabel > &disk) const
 Returns the squared Euclidean distance to a disk.
template<class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
requires detail::ClosestPairConcept<Point<TNumber, 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<Point<TNumber, TLabel>, OtherShape>
constexpr auto closestPoints (const OtherShape &other) const
 Returns the pair of points realizing the distance, nothing when the shapes meet.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto squaredHausdorffDistance (const OtherPoint &other) const
 Returns the squared Hausdorff distance to another point.
template<class ResultNumber = NumberType, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Point>) && requires(const OtherShape& o, const Point& self)
{ o.template squaredHausdorffDistance<ResultNumber>(self); })
constexpr auto squaredHausdorffDistance (const OtherShape &other) const
 Returns the squared Hausdorff distance to the given shape.
template<class ApproximateNumber = double, PointConcept OtherPoint>
ApproximateNumber distance (const OtherPoint &other) const
 Returns the Euclidean distance to another point.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto distanceL1 (const OtherPoint &other) const
 Returns the Manhattan distance to another point.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto distanceL1 (const OtherRectangle &other) const
 Returns the Manhattan distance to an axis-aligned rectangle without division.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && !RectangleConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>) &&
requires(const OtherShape& o, const Point& self) { o.template distanceL1<ResultNumber>(self); })
constexpr auto distanceL1 (const OtherShape &other) const
 Returns the Manhattan 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 = double, PointConcept OtherPoint>
constexpr auto distanceL1 (const Shape< OtherPoint > &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto distanceLInf (const OtherPoint &other) const
 Returns the Chebyshev distance to another point.
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
constexpr auto distanceLInf (const OtherRectangle &other) const
 Returns the Chebyshev distance to an axis-aligned rectangle without division.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && !RectangleConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>) &&
requires(const OtherShape& o, const Point& self) { o.template distanceLInf<ResultNumber>(self); })
constexpr auto distanceLInf (const OtherShape &other) const
 Returns the Chebyshev 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 &other) const
 Returns the Manhattan (L1) Hausdorff distance to another point.
template<class ResultNumber = NumberType, typename OtherShape>
requires (!PointConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>) && requires(const OtherShape& o,
const Point& 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 = 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 &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to another point.
template<class ResultNumber = NumberType, typename OtherShape>
requires (!PointConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>) && requires(const OtherShape& o,
const Point& 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 = NumberType, PointConcept OtherPoint>
constexpr auto hausdorffDistanceLInf (const Shape< OtherPoint > &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > distanceL1 (const Disk< DiskPointType, DiskLabel > &disk) const
 Returns the Manhattan (L1) distance to a disk.
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > distanceLInf (const Disk< DiskPointType, DiskLabel > &disk) const
 Returns the Chebyshev (LInf) distance to a disk.
template<class OtherShape>
requires MinkowskiSummableConcept<Point<TNumber, 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<Point<TNumber, TLabel>, OtherShape>
constexpr auto minkowskiErosion (const OtherShape &other) const
 Returns the Minkowski erosion of this shape by another (A ⊖ B).
template<PointConcept OtherPoint>
constexpr Pointoperator+= (const OtherPoint &other)
 Translates a point by another point in place.
template<PointConcept OtherPoint>
constexpr Pointoperator-= (const OtherPoint &other)
 Translates a point by the opposite of another point in place.
template<class OtherNumber>
constexpr Pointoperator*= (const OtherNumber scalar)
 Scales a point by a scalar in place.
template<class OtherNumber>
constexpr Pointoperator/= (const OtherNumber scalar)
 Scales a point by a scalar division in place.
constexpr Point swapped () const
 Returns the point with x and y swapped.
constexpr Point rotated90 (int k=1) const
 Returns the point rotated by 90k degrees around the origin.
constexpr void rotate90 (int k=1)
 Rotates the point by 90k degrees around the origin in place.
template<class OtherNumber>
constexpr Point scaledUpX (const OtherNumber scalar) const
 Returns the point with its x-coordinate multiplied by a scalar.
template<class OtherNumber>
constexpr void scaleUpX (const OtherNumber scalar)
 Multiplies the point's x-coordinate by a scalar in place.
template<class OtherNumber>
constexpr Point scaledUpY (const OtherNumber scalar) const
 Returns the point with its y-coordinate multiplied by a scalar.
template<class OtherNumber>
constexpr void scaleUpY (const OtherNumber scalar)
 Multiplies the point's y-coordinate by a scalar in place.
template<class OtherNumber>
constexpr Point scaledDownX (const OtherNumber scalar) const
 Returns the point with its x-coordinate divided by a scalar.
template<class OtherNumber>
constexpr void scaleDownX (const OtherNumber scalar)
 Divides the point's x-coordinate by a scalar in place.
template<class OtherNumber>
constexpr Point scaledDownY (const OtherNumber scalar) const
 Returns the point with its y-coordinate divided by a scalar.
template<class OtherNumber>
constexpr void scaleDownY (const OtherNumber scalar)
 Divides the point's y-coordinate by a scalar in place.
constexpr HalfplaneIntersection< Point< NumberType, LabelType > > asHalfplaneIntersection () const
 Returns the point as a (degenerate) half-plane intersection.
template<class ResultNumber = NumberType>
constexpr Line< Point< ResultNumber, LabelType > > dual () const
 Returns the dual Line.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Line< Point< ResultNumber, LabelType > > polar () const
 Returns the polar Line.
template<class ResultNumber>
constexpr Line< Point< ResultNumber, Label > > dual () const
 Returns the projective dual line of a point.
template<class ResultNumber>
constexpr Line< Point< ResultNumber, Label > > polar () const
 Returns the polar line of a point with respect to the unit parabola model used here.
template<class ResultNumber, PointConcept OtherPoint>
constexpr std::optional< Point< ResultNumber, Label > > intersection (const OtherPoint &other) const
template<PointConcept OtherPoint>
constexpr Point< Number, Label > & operator+= (const OtherPoint &other)
template<PointConcept OtherPoint>
constexpr Point< Number, Label > & operator-= (const OtherPoint &other)
template<class OtherNumber>
constexpr Point< Number, Label > & operator*= (const OtherNumber scalar)
template<class OtherNumber>
constexpr Point< Number, Label > & operator/= (const OtherNumber scalar)
template<class OtherNumber>
constexpr Point< Number, Label > scaledUpX (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Point< Number, Label > scaledUpY (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Point< Number, Label > scaledDownX (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Point< Number, Label > scaledDownY (const OtherNumber scalar) const

Static Public Member Functions

static constexpr std::size_t size ()
 Returns the number of coordinates (always 2).

Detailed Description

template<class TNumber, class TLabel>
struct pgl::Point< TNumber, TLabel >

Two-dimensional point with optional label payload.

2D point with optional label storage.

Template Parameters
NumberCoordinate type.
LabelLabel type.
NumberCoordinate type.
LabelOptional label or metadata type. The label is ignored when comparing points.

Member Typedef Documentation

◆ LabelType

template<class TNumber, class TLabel>
using pgl::Point< TNumber, TLabel >::LabelType = TLabel

Type of the point label.

◆ NumberType

template<class TNumber, class TLabel>
using pgl::Point< TNumber, TLabel >::NumberType = TNumber

Type of the point coordinates.

Constructor & Destructor Documentation

◆ Point() [1/4]

template<class TNumber, class TLabel>
pgl::Point< TNumber, TLabel >::Point ( )
constexprdefault

Creates the origin point (0, 0).

◆ Point() [2/4]

template<class TNumber, class TLabel>
pgl::Point< TNumber, TLabel >::Point ( NumberType x,
NumberType y )
inlineconstexpr

Creates a point from its x and y coordinates.

Parameters
xX coordinate.
yY coordinate.

◆ Point() [3/4]

template<class TNumber, class TLabel>
template<class X, class Y, class A>
requires (std::constructible_from<NumberType, const X&> && std::constructible_from<NumberType, const Y&> &&
std::constructible_from<LabelType, A&&>)
pgl::Point< TNumber, TLabel >::Point ( const X & x,
const Y & y,
A && label )
inlineconstexpr

Creates a point from its coordinates and label.

Coordinates are converted to NumberType with an explicit cast, so explicit-only conversions (e.g. widening a Rational) are accepted. When LabelType is NoLabel the label argument must itself be a NoLabel and is discarded; otherwise it constructs the stored label.

Template Parameters
XType of the x coordinate expression.
YType of the y coordinate expression.
AType used to construct the label.
Parameters
xX coordinate.
yY coordinate.
labelLabel value.

◆ Point() [4/4]

template<class TNumber, class TLabel>
template<PointConcept OtherPoint>
pgl::Point< TNumber, TLabel >::Point ( const OtherPoint< TNumber, TLabel > & other)
inlineconstexpr

Converts a point with different coordinate and label types.

Template Parameters
OtherNumberCoordinate type of the source point.
OtherPoint::LabelTypeLabel type of the source point.
Parameters
otherSource point.

Member Function Documentation

◆ asHalfplaneIntersection()

template<class TNumber, class TLabel>
HalfplaneIntersection< Point< NumberType, LabelType > > pgl::Point< TNumber, TLabel >::asHalfplaneIntersection ( ) const
inlinenodiscardconstexpr

Returns the point as a (degenerate) half-plane intersection.

The region is an axis-aligned point slab (four half-planes) pinning this point; it has empty interior.

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

◆ bbox()

template<class Number, class Label>
Rectangle< Point< Number, Label > > pgl::Point< Number, Label >::bbox ( ) const
nodiscardconstexpr

Returns the bounding box of the point.

Returns
A degenerate rectangle containing only this point.

◆ begin() [1/2]

template<class TNumber, class TLabel>
auto pgl::Point< TNumber, TLabel >::begin ( )
inlineconstexpr

Returns an iterator to the first coordinate.

Returns
Iterator to the first coordinate.

◆ begin() [2/2]

template<class TNumber, class TLabel>
auto pgl::Point< TNumber, TLabel >::begin ( ) const
inlineconstexpr

◆ boundaryContains() [1/19]

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

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

◆ boundaryContains() [2/19]

template<class Number, class Label>
template<MonotoneChainConcept OtherChain>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherChain & other) const
nodiscardconstexpr

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

◆ boundaryContains() [3/19]

template<class Number, class Label>
template<ConvexConcept OtherConvex>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherConvex & other) const
nodiscardconstexpr

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

◆ boundaryContains() [4/19]

template<class Number, class Label>
template<DiskConcept OtherDisk>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherDisk & other) const
nodiscardconstexpr

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

◆ boundaryContains() [5/19]

template<class Number, class Label>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ boundaryContains() [6/19]

template<class Number, class Label>
template<LineConcept OtherLine>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherLine & other) const
nodiscardconstexpr

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

◆ boundaryContains() [7/19]

template<class Number, class Label>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ boundaryContains() [8/19]

template<class Number, class Label>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ boundaryContains() [9/19]

template<class Number, class Label>
template<PointConcept OtherPoint>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

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

The documented boundary of a point is empty.

Returns
Always false.

Point

Point equality and the point-vs-shape predicates. This section also contains the cases where removing a point disconnects a 1D primitive.

◆ boundaryContains() [10/19]

template<class Number, class Label>
template<PolygonConcept OtherPolygon>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherPolygon & other) const
nodiscardconstexpr

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

◆ boundaryContains() [11/19]

template<class Number, class Label>
template<PolylineConcept OtherPolyline>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherPolyline & other) const
nodiscardconstexpr

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

◆ boundaryContains() [12/19]

template<class Number, class Label>
template<RayConcept OtherRay>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherRay & other) const
nodiscardconstexpr

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

◆ boundaryContains() [13/19]

template<class Number, class Label>
template<RectangleConcept OtherRectangle>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherRectangle & other) const
nodiscardconstexpr

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

◆ boundaryContains() [14/19]

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

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

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

◆ boundaryContains() [15/19]

template<class Number, class Label>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ boundaryContains() [16/19]

template<class Number, class Label>
template<SegmentConcept OtherSegment>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ boundaryContains() [17/19]

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

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

◆ boundaryContains() [18/19]

template<class Number, class Label>
template<TriangleConcept OtherTriangle>
bool pgl::Point< Number, Label >::boundaryContains ( const OtherTriangle & other) const
nodiscardconstexpr

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

◆ boundaryContains() [19/19]

template<class TNumber, class TLabel>
bool pgl::Point< TNumber, TLabel >::boundaryContains ( const Shape< Point< TNumber, TLabel > > & other) const
nodiscardconstexpr

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

◆ cbegin()

template<class TNumber, class TLabel>
auto pgl::Point< TNumber, TLabel >::cbegin ( ) const
inlineconstexpr

Returns an iterator to the first coordinate.

Returns
Const iterator to the first coordinate.

◆ cend()

template<class TNumber, class TLabel>
auto pgl::Point< TNumber, TLabel >::cend ( ) const
inlineconstexpr

Returns an iterator past the last coordinate.

Returns
Pointer past the last coordinate.

◆ closestPoints()

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

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

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

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

◆ closestSegments()

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

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

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

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

◆ contains() [1/19]

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

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

◆ contains() [2/19]

template<class Number, class Label>
template<MonotoneChainConcept OtherChain>
bool pgl::Point< Number, Label >::contains ( const OtherChain & other) const
nodiscardconstexpr

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

◆ contains() [3/19]

template<class Number, class Label>
template<ConvexConcept OtherConvex>
bool pgl::Point< Number, Label >::contains ( const OtherConvex & other) const
nodiscardconstexpr

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

◆ contains() [4/19]

template<class Number, class Label>
template<DiskConcept OtherDisk>
bool pgl::Point< Number, Label >::contains ( const OtherDisk & other) const
nodiscardconstexpr

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

◆ contains() [5/19]

template<class Number, class Label>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Point< Number, Label >::contains ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ contains() [6/19]

template<class Number, class Label>
template<LineConcept OtherLine>
bool pgl::Point< Number, Label >::contains ( const OtherLine & other) const
nodiscardconstexpr

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

◆ contains() [7/19]

template<class Number, class Label>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Point< Number, Label >::contains ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ contains() [8/19]

template<class Number, class Label>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Point< Number, Label >::contains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ contains() [9/19]

template<class Number, class Label>
template<PointConcept OtherPoint>
bool pgl::Point< Number, Label >::contains ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

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

Point containment is coordinate equality. Labels are ignored.

Template Parameters
OtherNumberCoordinate type of the other point.
OtherPoint::LabelTypeLabel type of the other point.
Parameters
otherOther point.
Returns
true if both points have the same coordinates.

Point

Point equality and the point-vs-shape predicates. This section also contains the cases where removing a point disconnects a 1D primitive.

◆ contains() [10/19]

template<class Number, class Label>
template<PolygonConcept OtherPolygon>
bool pgl::Point< Number, Label >::contains ( const OtherPolygon & other) const
nodiscardconstexpr

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

◆ contains() [11/19]

template<class Number, class Label>
template<PolylineConcept OtherPolyline>
bool pgl::Point< Number, Label >::contains ( const OtherPolyline & other) const
nodiscardconstexpr

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

◆ contains() [12/19]

template<class Number, class Label>
template<RayConcept OtherRay>
bool pgl::Point< Number, Label >::contains ( const OtherRay & other) const
nodiscardconstexpr

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

◆ contains() [13/19]

template<class Number, class Label>
template<RectangleConcept OtherRectangle>
bool pgl::Point< Number, Label >::contains ( const OtherRectangle & other) const
nodiscardconstexpr

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

◆ contains() [14/19]

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

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

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

◆ contains() [15/19]

template<class Number, class Label>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Point< Number, Label >::contains ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ contains() [16/19]

template<class Number, class Label>
template<SegmentConcept OtherSegment>
bool pgl::Point< Number, Label >::contains ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ contains() [17/19]

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

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

◆ contains() [18/19]

template<class Number, class Label>
template<TriangleConcept OtherTriangle>
bool pgl::Point< Number, Label >::contains ( const OtherTriangle & other) const
nodiscardconstexpr

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

◆ contains() [19/19]

template<class TNumber, class TLabel>
bool pgl::Point< TNumber, TLabel >::contains ( const Shape< Point< TNumber, TLabel > > & other) const
nodiscardconstexpr

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

◆ convexHull()

template<class TNumber, class TLabel>
Convex< Point > pgl::Point< TNumber, TLabel >::convexHull ( ) const
inlinenodiscardconstexpr

Returns the convex hull of the point.

Returns
A degenerate one-vertex convex polygon at this point.

◆ crosses() [1/4]

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

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

◆ crosses() [2/4]

template<class Number, class Label>
template<PointConcept OtherPoint>
bool pgl::Point< Number, Label >::crosses ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

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

Point

Point equality and the point-vs-shape predicates. This section also contains the cases where removing a point disconnects a 1D primitive.

◆ crosses() [3/4]

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

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

◆ crosses() [4/4]

template<class TNumber, class TLabel>
bool pgl::Point< TNumber, TLabel >::crosses ( const Shape< Point< TNumber, TLabel > > & other) const
nodiscardconstexpr

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

◆ distance()

template<class Number, class Label>
template<class ApproximateNumber, PointConcept OtherPoint>
ApproximateNumber pgl::Point< Number, Label >::distance ( const OtherPoint< TNumber, TLabel > & other) const
nodiscard

Returns the Euclidean distance to another point.

Template Parameters
ApproximateNumberFloating-point return type.
OtherNumberCoordinate type of the other point.
OtherPoint::LabelTypeLabel type of the other point.
Parameters
otherOther point.
Returns
Euclidean distance.

◆ distanceL1() [1/5]

template<class TNumber, class TLabel>
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > pgl::Point< TNumber, TLabel >::distanceL1 ( const Disk< DiskPointType, DiskLabel > & disk) const
inlinenodiscard

Returns the Manhattan (L1) distance to a disk.

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

◆ distanceL1() [2/5]

template<class Number, class Label>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Point< Number, Label >::distanceL1 ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

Returns the Manhattan distance to another point.

Template Parameters
ResultNumberCoordinate type of the result (default: NumberType).
OtherNumberCoordinate type of the other point.
OtherPoint::LabelTypeLabel type of the other point.
Parameters
otherOther point.
Returns
Manhattan distance.

◆ distanceL1() [3/5]

template<class TNumber, class TLabel>
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
auto pgl::Point< TNumber, TLabel >::distanceL1 ( const OtherRectangle & other) const
inlinenodiscardconstexpr

Returns the Manhattan distance to an axis-aligned rectangle without division.

◆ distanceL1() [4/5]

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

Returns the Manhattan distance to the given shape.

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

◆ distanceL1() [5/5]

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

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

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

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

◆ distanceLInf() [1/5]

template<class TNumber, class TLabel>
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > pgl::Point< TNumber, TLabel >::distanceLInf ( const Disk< DiskPointType, DiskLabel > & disk) const
inlinenodiscard

Returns the Chebyshev (LInf) distance to a disk.

◆ distanceLInf() [2/5]

template<class Number, class Label>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Point< Number, Label >::distanceLInf ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

Returns the Chebyshev distance to another point.

Template Parameters
ResultNumberCoordinate type of the result (default: NumberType).
OtherNumberCoordinate type of the other point.
OtherPoint::LabelTypeLabel type of the other point.
Parameters
otherOther point.
Returns
Chebyshev distance.

◆ distanceLInf() [3/5]

template<class TNumber, class TLabel>
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
auto pgl::Point< TNumber, TLabel >::distanceLInf ( const OtherRectangle & other) const
inlinenodiscardconstexpr

Returns the Chebyshev distance to an axis-aligned rectangle without division.

◆ distanceLInf() [4/5]

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

Returns the Chebyshev distance to the given shape.

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

◆ distanceLInf() [5/5]

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

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

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

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

◆ dual() [1/2]

template<class TNumber, class TLabel>
template<class ResultNumber>
Line< Point< ResultNumber, Label > > pgl::Point< TNumber, TLabel >::dual ( ) const
constexpr

Returns the projective dual line of a point.

Template Parameters
ResultNumberCoordinate type of the dual line.
Returns
Dual line associated with this point.

◆ dual() [2/2]

template<class TNumber, class TLabel>
template<class ResultNumber = NumberType>
Line< Point< ResultNumber, LabelType > > pgl::Point< TNumber, TLabel >::dual ( ) const
constexpr

Returns the dual Line.

Template Parameters
ResultNumberCoordinate type of the returned line.
Returns
Line y = ax - b for point (a,b).

◆ edges()

template<class Number, class Label>
std::array< Segment< Point< Number, Label > >, 0 > pgl::Point< Number, Label >::edges ( ) const
nodiscardconstexpr

Returns the point boundary edges.

Returns
Empty array because a point has no edges.

◆ end() [1/2]

template<class TNumber, class TLabel>
auto pgl::Point< TNumber, TLabel >::end ( )
inlineconstexpr

Returns an iterator past the last coordinate.

Returns
Iterator past the last coordinate.

◆ end() [2/2]

template<class TNumber, class TLabel>
auto pgl::Point< TNumber, TLabel >::end ( ) const
inlineconstexpr

◆ fbox()

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

Returns a floating-point bounding box containing the point.

Template Parameters
ResultNumberFloating-point coordinate type.
Returns
A rectangle whose bounds contain this point.

◆ get() [1/2]

template<class TNumber, class TLabel>
NumberType & pgl::Point< TNumber, TLabel >::get ( std::ptrdiff_t index)
inlineconstexpr

◆ get() [2/2]

template<class TNumber, class TLabel>
const NumberType & pgl::Point< TNumber, TLabel >::get ( std::ptrdiff_t index) const
inlineconstexpr

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

◆ hausdorffDistanceL1() [1/3]

template<class Number, class Label>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Point< Number, Label >::hausdorffDistanceL1 ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to another point.

Hausdorff distance between two single-point sets is just their distance.

◆ hausdorffDistanceL1() [2/3]

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

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

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

◆ hausdorffDistanceL1() [3/3]

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

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

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

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

◆ hausdorffDistanceLInf() [1/3]

template<class Number, class Label>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Point< Number, Label >::hausdorffDistanceLInf ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to another point.

Hausdorff distance between two single-point sets is just their distance.

◆ hausdorffDistanceLInf() [2/3]

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

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

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

◆ hausdorffDistanceLInf() [3/3]

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

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

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

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

◆ index()

template<class TNumber, class TLabel>
std::ptrdiff_t pgl::Point< TNumber, TLabel >::index ( const NumberType & value) const
inlineconstexpr

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

◆ interiorContains() [1/18]

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

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

◆ interiorContains() [2/18]

template<class Number, class Label>
template<MonotoneChainConcept OtherChain>
bool pgl::Point< Number, Label >::interiorContains ( const OtherChain & other) const
nodiscardconstexpr

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

◆ interiorContains() [3/18]

template<class Number, class Label>
template<ConvexConcept OtherConvex>
bool pgl::Point< Number, Label >::interiorContains ( const OtherConvex & other) const
nodiscardconstexpr

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

◆ interiorContains() [4/18]

template<class Number, class Label>
template<DiskConcept OtherDisk>
bool pgl::Point< Number, Label >::interiorContains ( const OtherDisk & other) const
nodiscardconstexpr

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

◆ interiorContains() [5/18]

template<class Number, class Label>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Point< Number, Label >::interiorContains ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ interiorContains() [6/18]

template<class Number, class Label>
template<LineConcept OtherLine>
bool pgl::Point< Number, Label >::interiorContains ( const OtherLine & other) const
nodiscardconstexpr

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

◆ interiorContains() [7/18]

template<class Number, class Label>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Point< Number, Label >::interiorContains ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ interiorContains() [8/18]

template<class Number, class Label>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Point< Number, Label >::interiorContains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ interiorContains() [9/18]

template<class Number, class Label>
template<PointConcept OtherPoint>
bool pgl::Point< Number, Label >::interiorContains ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

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

Since the documented point boundary is empty, this matches contains.

Template Parameters
OtherNumberCoordinate type of the other point.
OtherPoint::LabelTypeLabel type of the other point.
Parameters
otherOther point.
Returns
true if both points have the same coordinates.

Point

Point equality and the point-vs-shape predicates. This section also contains the cases where removing a point disconnects a 1D primitive.

◆ interiorContains() [10/18]

template<class Number, class Label>
template<PolygonConcept OtherPolygon>
bool pgl::Point< Number, Label >::interiorContains ( const OtherPolygon & other) const
nodiscardconstexpr

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

◆ interiorContains() [11/18]

template<class Number, class Label>
template<PolylineConcept OtherPolyline>
bool pgl::Point< Number, Label >::interiorContains ( const OtherPolyline & other) const
nodiscardconstexpr

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

◆ interiorContains() [12/18]

template<class Number, class Label>
template<RayConcept OtherRay>
bool pgl::Point< Number, Label >::interiorContains ( const OtherRay & other) const
nodiscardconstexpr

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

◆ interiorContains() [13/18]

template<class Number, class Label>
template<RectangleConcept OtherRectangle>
bool pgl::Point< Number, Label >::interiorContains ( const OtherRectangle & other) const
nodiscardconstexpr

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

◆ interiorContains() [14/18]

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

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

◆ interiorContains() [15/18]

template<class Number, class Label>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Point< Number, Label >::interiorContains ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ interiorContains() [16/18]

template<class Number, class Label>
template<SegmentConcept OtherSegment>
bool pgl::Point< Number, Label >::interiorContains ( const OtherSegment & other) const
nodiscardconstexpr

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

◆ interiorContains() [17/18]

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

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

◆ interiorContains() [18/18]

template<class Number, class Label>
template<TriangleConcept OtherTriangle>
bool pgl::Point< Number, Label >::interiorContains ( const OtherTriangle & other) const
nodiscardconstexpr

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

◆ interiorsIntersect() [1/4]

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

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

◆ interiorsIntersect() [2/4]

template<class Number, class Label>
template<PointConcept OtherPoint>
bool pgl::Point< Number, Label >::interiorsIntersect ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

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

Point

Point equality and the point-vs-shape predicates. This section also contains the cases where removing a point disconnects a 1D primitive.

◆ interiorsIntersect() [3/4]

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

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

◆ interiorsIntersect() [4/4]

template<class TNumber, class TLabel>
bool pgl::Point< TNumber, TLabel >::interiorsIntersect ( const Shape< Point< TNumber, TLabel > > & other) const
nodiscardconstexpr

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

◆ intersection() [1/5]

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

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

◆ intersection() [2/5]

template<class TNumber, class TLabel>
template<class ResultNumber, PointConcept OtherPoint>
std::optional< Point< ResultNumber, Label > > pgl::Point< TNumber, TLabel >::intersection ( const OtherPoint< TNumber, TLabel > & other) const
constexpr

◆ intersection() [3/5]

template<class TNumber, class TLabel>
template<class ResultNumber = NumberType, PointConcept OtherPoint>
std::optional< Point< ResultNumber, LabelType > > pgl::Point< TNumber, TLabel >::intersection ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

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

◆ intersection() [4/5]

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

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

◆ intersection() [5/5]

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

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

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

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

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

◆ intersects() [1/4]

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

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

◆ intersects() [2/4]

template<class Number, class Label>
template<PointConcept OtherPoint>
bool pgl::Point< Number, Label >::intersects ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

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

Returns
true if both points have the same coordinates.

Point

Point equality and the point-vs-shape predicates. This section also contains the cases where removing a point disconnects a 1D primitive.

◆ intersects() [3/4]

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

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

◆ intersects() [4/4]

template<class TNumber, class TLabel>
bool pgl::Point< TNumber, TLabel >::intersects ( const Shape< Point< TNumber, TLabel > > & other) const
nodiscardconstexpr

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

◆ label()

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

Returns the stored label.

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

Template Parameters
ALabel type.
Returns
Reference to the stored label.

◆ minkowskiErosion()

template<class Number, class Label>
requires MinkowskiSummableConcept<Point<TNumber, TLabel>, OtherShape>
template<class OtherShape>
requires MinkowskiSummableConcept<Point<TNumber, TLabel>, OtherShape>
auto pgl::Point< Number, Label >::minkowskiErosion ( const OtherShape & other) const
nodiscardconstexpr

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

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

Eroding by a Point is the translation by its negation, so it returns this shape's own type; the other pairs come back as the convex region they are, a HalfplaneIntersection, which holds a lower-dimensional erosion and the empty one as readily as a two-dimensional one. A point erodes to itself translated, and to nothing at all by anything wider.

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

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

◆ minkowskiSum()

template<class Number, class Label>
requires MinkowskiSummableConcept<Point<TNumber, TLabel>, OtherShape>
template<class OtherShape>
requires MinkowskiSummableConcept<Point<TNumber, TLabel>, OtherShape>
auto pgl::Point< Number, Label >::minkowskiSum ( const OtherShape & other) const
nodiscardconstexpr

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

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

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

◆ operator*=() [1/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point< Number, Label > & pgl::Point< TNumber, TLabel >::operator*= ( const OtherNumber scalar)
constexpr

◆ operator*=() [2/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point & pgl::Point< TNumber, TLabel >::operator*= ( const OtherNumber scalar)
constexpr

Scales a point by a scalar in place.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale factor.
Returns
Scaled point.

◆ operator+=() [1/2]

template<class TNumber, class TLabel>
template<PointConcept OtherPoint>
Point< Number, Label > & pgl::Point< TNumber, TLabel >::operator+= ( const OtherPoint< TNumber, TLabel > & other)
constexpr

◆ operator+=() [2/2]

template<class TNumber, class TLabel>
template<PointConcept OtherPoint>
Point & pgl::Point< TNumber, TLabel >::operator+= ( const OtherPoint< TNumber, TLabel > & other)
constexpr

Translates a point by another point in place.

Template Parameters
OtherNumberCoordinate type of the other point.
OtherPoint::LabelTypeLabel type of the other point.
Parameters
otherOther point.
Returns
Translated point.

◆ operator-()

template<class Number, class Label>
Point< Number, Label > pgl::Point< Number, Label >::operator- ( ) const
nodiscardconstexpr

Returns the point mirrored through the origin.

Returns
The negated point.

◆ operator-=() [1/2]

template<class TNumber, class TLabel>
template<PointConcept OtherPoint>
Point< Number, Label > & pgl::Point< TNumber, TLabel >::operator-= ( const OtherPoint< TNumber, TLabel > & other)
constexpr

◆ operator-=() [2/2]

template<class TNumber, class TLabel>
template<PointConcept OtherPoint>
Point & pgl::Point< TNumber, TLabel >::operator-= ( const OtherPoint< TNumber, TLabel > & other)
constexpr

Translates a point by the opposite of another point in place.

Template Parameters
OtherNumberCoordinate type of the other point.
OtherPoint::LabelTypeLabel type of the other point.
Parameters
otherOther point.
Returns
Translated point.

◆ operator/=() [1/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point< Number, Label > & pgl::Point< TNumber, TLabel >::operator/= ( const OtherNumber scalar)
constexpr

◆ operator/=() [2/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point & pgl::Point< TNumber, TLabel >::operator/= ( const OtherNumber scalar)
constexpr

Scales a point by a scalar division in place.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale divider.
Returns
Scaled point.

◆ operator<=>()

template<class Number, class Label>
template<PointConcept OtherPoint>
std::strong_ordering pgl::Point< Number, Label >::operator<=> ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

Provides lexicographic ordering on (x, y).

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

◆ operator==()

template<class Number, class Label>
template<PointConcept OtherPoint>
bool pgl::Point< Number, Label >::operator== ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

Tests coordinate equality.

Parameters
otherPoint to compare with.
Returns
true if both points are equal.

Point

Point equality and the point-vs-shape predicates. This section also contains the cases where removing a point disconnects a 1D primitive.

◆ operator[]() [1/2]

template<class TNumber, class TLabel>
NumberType & pgl::Point< TNumber, TLabel >::operator[] ( std::size_t index)
inline

Returns coordinate 0 for x and 1 for y.

Parameters
indexCoordinate index.
Returns
Reference to the selected coordinate.

◆ operator[]() [2/2]

template<class TNumber, class TLabel>
const NumberType & pgl::Point< TNumber, TLabel >::operator[] ( std::size_t index) const
inlineconstexpr

Returns coordinate 0 for x and 1 for y.

Parameters
indexCoordinate index.
Returns
Reference to the selected coordinate.

◆ orientedEdges()

template<class Number, class Label>
std::array< OrientedSegment< Point< Number, Label > >, 0 > pgl::Point< Number, Label >::orientedEdges ( ) const
nodiscardconstexpr

Returns the oriented boundary edges.

Returns
Empty array because a point has no edges.

◆ polar() [1/2]

template<class TNumber, class TLabel>
template<class ResultNumber>
Line< Point< ResultNumber, Label > > pgl::Point< TNumber, TLabel >::polar ( ) const
constexpr

Returns the polar line of a point with respect to the unit parabola model used here.

The origin has no polar in this construction.

Template Parameters
ResultNumberCoordinate type of the polar line.
Returns
Polar line of this point.

◆ polar() [2/2]

template<class TNumber, class TLabel>
template<class ResultNumber = division_result_t<NumberType>>
Line< Point< ResultNumber, LabelType > > pgl::Point< TNumber, TLabel >::polar ( ) const
constexpr

Returns the polar Line.

Template Parameters
ResultNumberCoordinate type of the returned line.
Returns
Line ax + by = 1 for point (a,b).
Warning
Uses division.

◆ rotate90()

template<class Number, class Label>
void pgl::Point< Number, Label >::rotate90 ( int k = 1)
constexpr

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

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

◆ rotated90()

template<class Number, class Label>
Point< Number, Label > pgl::Point< Number, Label >::rotated90 ( int k = 1) const
nodiscardconstexpr

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

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

◆ samePointSet()

template<class Number, class Label>
template<AnyShapeConcept OtherShape>
bool pgl::Point< Number, Label >::samePointSet ( const OtherShape & other) const
nodiscardconstexpr

Tests whether another shape defines exactly the same point set.

◆ scaledDownX() [1/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point< Number, Label > pgl::Point< TNumber, TLabel >::scaledDownX ( const OtherNumber scalar) const
constexpr

◆ scaledDownX() [2/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point pgl::Point< TNumber, TLabel >::scaledDownX ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the point with its x-coordinate divided by a scalar.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale divider.
Returns
Point with scaled x-coordinate.

◆ scaledDownY() [1/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point< Number, Label > pgl::Point< TNumber, TLabel >::scaledDownY ( const OtherNumber scalar) const
constexpr

◆ scaledDownY() [2/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point pgl::Point< TNumber, TLabel >::scaledDownY ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the point with its y-coordinate divided by a scalar.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale divider.
Returns
Point with scaled y-coordinate.

◆ scaleDownX()

template<class Number, class Label>
template<class OtherNumber>
void pgl::Point< Number, Label >::scaleDownX ( const OtherNumber scalar)
constexpr

Divides the point's x-coordinate by a scalar in place.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale divider.

◆ scaleDownY()

template<class Number, class Label>
template<class OtherNumber>
void pgl::Point< Number, Label >::scaleDownY ( const OtherNumber scalar)
constexpr

Divides the point's y-coordinate by a scalar in place.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale divider.

◆ scaledUpX() [1/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point< Number, Label > pgl::Point< TNumber, TLabel >::scaledUpX ( const OtherNumber scalar) const
constexpr

◆ scaledUpX() [2/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point pgl::Point< TNumber, TLabel >::scaledUpX ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the point with its x-coordinate multiplied by a scalar.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale factor.
Returns
Point with scaled x-coordinate.

◆ scaledUpY() [1/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point< Number, Label > pgl::Point< TNumber, TLabel >::scaledUpY ( const OtherNumber scalar) const
constexpr

◆ scaledUpY() [2/2]

template<class TNumber, class TLabel>
template<class OtherNumber>
Point pgl::Point< TNumber, TLabel >::scaledUpY ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the point with its y-coordinate multiplied by a scalar.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale factor.
Returns
Point with scaled y-coordinate.

◆ scaleUpX()

template<class Number, class Label>
template<class OtherNumber>
void pgl::Point< Number, Label >::scaleUpX ( const OtherNumber scalar)
constexpr

Multiplies the point's x-coordinate by a scalar in place.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale factor.

◆ scaleUpY()

template<class Number, class Label>
template<class OtherNumber>
void pgl::Point< Number, Label >::scaleUpY ( const OtherNumber scalar)
constexpr

Multiplies the point's y-coordinate by a scalar in place.

Template Parameters
OtherNumberScalar type.
Parameters
scalarScale factor.

◆ separates() [1/17]

template<class Number, class Label>
template<MonotoneChainConcept OtherChain>
bool pgl::Point< Number, Label >::separates ( const OtherChain & other) const
nodiscardconstexpr

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

◆ separates() [2/17]

template<class Number, class Label>
template<ConvexConcept OtherConvex>
bool pgl::Point< Number, Label >::separates ( const OtherConvex & other) const
nodiscardconstexpr

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

◆ separates() [3/17]

template<class Number, class Label>
template<DiskConcept OtherDisk>
bool pgl::Point< Number, Label >::separates ( const OtherDisk & other) const
nodiscardconstexpr

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

◆ separates() [4/17]

template<class Number, class Label>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Point< Number, Label >::separates ( const OtherHalfplane & other) const
nodiscardconstexpr

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

◆ separates() [5/17]

template<class Number, class Label>
template<LineConcept OtherLine>
bool pgl::Point< Number, Label >::separates ( const OtherLine & other) const
nodiscardconstexpr

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

◆ separates() [6/17]

template<class Number, class Label>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Point< Number, Label >::separates ( const OtherOrientedLine & other) const
nodiscardconstexpr

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

◆ separates() [7/17]

template<class Number, class Label>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Point< Number, Label >::separates ( const OtherOrientedSegment & other) const
nodiscardconstexpr

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

◆ separates() [8/17]

template<class Number, class Label>
template<PointConcept OtherPoint>
bool pgl::Point< Number, Label >::separates ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

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

◆ separates() [9/17]

template<class Number, class Label>
template<PolygonConcept OtherPolygon>
bool pgl::Point< Number, Label >::separates ( const OtherPolygon & other) const
nodiscardconstexpr

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

◆ separates() [10/17]

template<class Number, class Label>
template<PolylineConcept OtherPolyline>
bool pgl::Point< Number, Label >::separates ( const OtherPolyline & other) const
nodiscardconstexpr

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

◆ separates() [11/17]

template<class Number, class Label>
template<RayConcept OtherRay>
bool pgl::Point< Number, Label >::separates ( const OtherRay & other) const
nodiscardconstexpr

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

◆ separates() [12/17]

template<class Number, class Label>
template<RectangleConcept OtherRectangle>
bool pgl::Point< Number, Label >::separates ( const OtherRectangle & other) const
nodiscardconstexpr

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

◆ separates() [13/17]

template<class Number, class Label>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Point< Number, Label >::separates ( const OtherRegion & other) const
nodiscard

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

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

◆ separates() [14/17]

template<class Number, class Label>
template<HalfplaneIntersectionConcept OtherRegion>
bool pgl::Point< Number, Label >::separates ( const OtherRegion & other) const
nodiscardconstexpr

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

◆ separates() [15/17]

template<class Number, class Label>
template<SegmentConcept OtherSegment>
bool pgl::Point< Number, Label >::separates ( const OtherSegment & other) const
nodiscardconstexpr

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

Point

Point equality and the point-vs-shape predicates. This section also contains the cases where removing a point disconnects a 1D primitive.

◆ separates() [16/17]

template<class Number, class Label>
template<PolygonSetConcept OtherSet>
bool pgl::Point< Number, Label >::separates ( const OtherSet & other) const
nodiscard

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

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

◆ separates() [17/17]

template<class Number, class Label>
template<TriangleConcept OtherTriangle>
bool pgl::Point< Number, Label >::separates ( const OtherTriangle & other) const
nodiscardconstexpr

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

◆ size()

template<class TNumber, class TLabel>
constexpr std::size_t pgl::Point< TNumber, TLabel >::size ( )
inlinestaticconstexpr

Returns the number of coordinates (always 2).

◆ squaredDistance() [1/4]

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

Returns the squared Euclidean distance to a disk.

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

◆ squaredDistance() [2/4]

template<class Number, class Label>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Point< Number, Label >::squaredDistance ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Point-to-point distance involves no division and is therefore exact for every ResultNumber.

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

◆ squaredDistance() [3/4]

template<class TNumber, class TLabel>
template<class ResultNumber = NumberType, RectangleConcept OtherRectangle>
auto pgl::Point< TNumber, TLabel >::squaredDistance ( const OtherRectangle & other) const
inlinenodiscardconstexpr

Returns the squared distance to an axis-aligned rectangle without division.

◆ squaredDistance() [4/4]

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

Returns the squared Euclidean distance to the given shape.

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

◆ squaredHausdorffDistance() [1/2]

template<class Number, class Label>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Point< Number, Label >::squaredHausdorffDistance ( const OtherPoint< TNumber, TLabel > & other) const
nodiscardconstexpr

Returns the squared Hausdorff distance to another point.

Hausdorff distance between two single-point sets is just their distance.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).
OtherPointType of the other point.
Parameters
otherOther point.
Returns
Squared Hausdorff distance.

◆ squaredHausdorffDistance() [2/2]

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

Returns the squared Hausdorff distance to the given shape.

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

◆ swapped()

template<class Number, class Label>
Point< Number, Label > pgl::Point< Number, Label >::swapped ( ) const
constexpr

Returns the point with x and y swapped.

Returns
Point with x and y swapped.

◆ vertices()

template<class Number, class Label>
std::array< Point< Number, Label >, 1 > pgl::Point< Number, Label >::vertices ( ) const
nodiscardconstexpr

Returns the unique vertex of the point-shaped object.

Returns
Array containing only this point.

◆ x() [1/2]

template<class TNumber, class TLabel>
NumberType & pgl::Point< TNumber, TLabel >::x ( )
inline

◆ x() [2/2]

template<class TNumber, class TLabel>
const NumberType & pgl::Point< TNumber, TLabel >::x ( ) const
inlineconstexpr

Returns the x coordinate.

Returns
Reference to the x coordinate.

◆ y() [1/2]

template<class TNumber, class TLabel>
NumberType & pgl::Point< TNumber, TLabel >::y ( )
inline

◆ y() [2/2]

template<class TNumber, class TLabel>
const NumberType & pgl::Point< TNumber, TLabel >::y ( ) const
inlineconstexpr

Returns the y coordinate.

Returns
Reference to the y coordinate.