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

Directed segment preserving source-to-target order plus optional segment label. More...

#include <orientedsegment.hpp>

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

Public Types

using PointType = PointType_
using NumberType = PointType::NumberType
using LabelType = TLabel

Public Member Functions

constexpr OrientedSegment ()=default
 Creates the degenerate oriented segment (0,0)->(0,0).
constexpr OrientedSegment (PointType source, PointType target)
 Creates an oriented segment from a source and target.
constexpr OrientedSegment (NumberType x1, NumberType y1, NumberType x2, NumberType y2)
 Creates an oriented segment from four coordinates.
template<class A>
requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
constexpr OrientedSegment (PointType source, PointType target, A &&label)
 Creates an oriented segment from a source and target and stores a label.
template<class A>
requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
constexpr OrientedSegment (NumberType x1, NumberType y1, NumberType x2, NumberType y2, A &&label)
 Same as the four-coordinate constructor, and stores a label.
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
constexpr OrientedSegment (const OrientedSegment< OtherPointType, OtherLabelType > &other)
 Converts an oriented segment with a different point and/or label type.
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
constexpr OrientedSegmentoperator= (const OrientedSegment< OtherPointType, OtherLabelType > &other)
 Assigns from an oriented segment with compatible point and label types.
constexpr const PointTypeoperator[] (std::size_t index) const
 Returns endpoint 0 for the source and 1 for the target.
constexpr PointTypeoperator[] (std::size_t index)
 Returns endpoint 0 for the source and 1 for the target.
constexpr const PointTypeget (std::ptrdiff_t index) const
 Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the end.
constexpr PointTypeget (std::ptrdiff_t index)
constexpr std::ptrdiff_t index (const PointType &point) const
 Returns the smallest index i with (*this)[i] == point, or -1 if no endpoint equals point.
constexpr const PointTypesource () const
 Returns the source endpoint.
constexpr PointTypesource ()
constexpr const PointTypetarget () const
 Returns the target endpoint.
constexpr PointTypetarget ()
constexpr const PointTypemin () const
 Returns the lexicographically smallest endpoint.
constexpr const PointTypemax () const
 Returns the lexicographically largest endpoint.
constexpr OrientedSegment opposite () const
 Returns the opposite orientation of the same geometric segment.
constexpr auto begin () const
 Returns an iterator to the source endpoint.
constexpr auto begin ()
constexpr auto cbegin () const
 Returns an iterator to the source endpoint.
constexpr auto end () const
 Returns an iterator past the target endpoint.
constexpr auto end ()
constexpr auto cend () const
 Returns an iterator past the target endpoint.
constexpr bool operator== (const OrientedSegment &other) const
 Compares two oriented segments by their endpoints; the label is ignored.
template<AnyShapeConcept OtherShape>
constexpr bool samePointSet (const OtherShape &other) const
 Tests whether another shape defines exactly the same point set.
constexpr auto operator<=> (const OrientedSegment &other) const
 Provides lexicographic ordering on (source, target).
template<class A = LabelType>
requires (detail::has_label_v<A>)
constexpr A & label () const
 Returns the segment label.
constexpr operator Segment< PointType > () const
 Converts to the unordered geometric segment with the same endpoints.
constexpr Segment< PointTypeasSegment () const
 Returns the segment without orientation.
constexpr operator OrientedLine< PointType > () const
 Converts to the oriented supporting line.
constexpr OrientedLine< PointTypeasOrientedLine () const
 Returns the oriented supporting line.
constexpr Line< PointTypeasLine () const
 Returns the supporting line without orientation.
constexpr operator Ray< PointType > () const
 Converts to the ray with the same source and direction.
constexpr Ray< PointTypeasRay () const
 Returns the ray with the same source and direction.
constexpr OrientedSegment rotated90 (int k=1) const
 Returns the segment rotated by 90k degrees around the origin.
constexpr void rotate90 (int k=1)
 Rotates the segment by 90k degrees around the origin in place.
template<class OtherNumber>
constexpr OrientedSegment scaledUpX (const OtherNumber scalar) const
 Returns the segment with its x-coordinates multiplied by a factor.
template<class OtherNumber>
constexpr void scaleUpX (const OtherNumber scalar)
 Multiplies the segment's x-coordinates by a factor in place.
template<class OtherNumber>
constexpr OrientedSegment scaledUpY (const OtherNumber scalar) const
 Returns the segment with its y-coordinates multiplied by a factor.
template<class OtherNumber>
constexpr void scaleUpY (const OtherNumber scalar)
 Multiplies the segment's y-coordinates by a factor in place.
template<class OtherNumber>
constexpr OrientedSegment scaledDownX (const OtherNumber scalar) const
 Returns the segment with its x-coordinates divided by a divisor.
template<class OtherNumber>
constexpr void scaleDownX (const OtherNumber scalar)
 Divides the segment's x-coordinates by a divisor in place.
template<class OtherNumber>
constexpr OrientedSegment scaledDownY (const OtherNumber scalar) const
 Returns the segment with its y-coordinates divided by a divisor.
template<class OtherNumber>
constexpr void scaleDownY (const OtherNumber scalar)
 Divides the segment's y-coordinates by a divisor in place.
constexpr bool isDegenerate () const
 Returns whether both endpoints coincide.
constexpr bool isPoint () const
 Returns whether the segment collapses to a single point.
constexpr std::optional< PointTypegetIfPoint () const
 Returns the point the segment collapses to, if it does.
constexpr bool isUndefined () const
 Returns whether the segment is degenerate without collapsing to a point or to a segment.
constexpr bool isVertical () const
 Returns whether the segment is vertical.
constexpr bool isHorizontal () const
 Returns whether the segment is horizontal.
template<class ResultNumber = NumberType>
constexpr ResultNumber area () const
 Returns the area of the segment.
constexpr NumberType twiceArea () const
 Returns twice the area of the segment.
constexpr auto squaredLength () const
 Returns the squared Euclidean length.
template<class ApproximateNumber = double>
ApproximateNumber length () const
 Returns the Euclidean length.
constexpr auto lengthL1 () const
 Returns the Manhattan length.
constexpr auto lengthLInf () const
 Returns the Chebyshev length.
template<PointConcept OtherPoint>
constexpr bool verticesContain (const OtherPoint &point) const
 Returns whether one endpoint equals the given point.
template<PointConcept OtherPoint>
constexpr bool containsEndpoint (const OtherPoint &point) const
 Returns whether the given point is one endpoint.
template<PointConcept OtherPoint>
constexpr bool boundaryContains (const OtherPoint &point) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<SegmentConcept OtherSegment>
constexpr bool boundaryContains (const OtherSegment &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool boundaryContains (const OtherOrientedSegment &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<LineConcept OtherLine>
constexpr bool boundaryContains (const OtherLine &) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<OrientedLineConcept OtherOrientedLine>
constexpr bool boundaryContains (const OtherOrientedLine &) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<RayConcept OtherRay>
constexpr bool boundaryContains (const OtherRay &) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<HalfplaneConcept OtherHalfplane>
constexpr bool boundaryContains (const OtherHalfplane &) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<RectangleConcept OtherRectangle>
constexpr bool boundaryContains (const OtherRectangle &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<TriangleConcept OtherTriangle>
constexpr bool boundaryContains (const OtherTriangle &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<ConvexConcept OtherConvex>
constexpr bool boundaryContains (const OtherConvex &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PolygonConcept OtherPolygon>
constexpr bool boundaryContains (const OtherPolygon &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<DiskConcept OtherDisk>
constexpr bool boundaryContains (const OtherDisk &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PointConcept OtherPoint>
constexpr bool containsCollinear (const OtherPoint &point) const
 Returns whether the segment contains the given point that is collinear with the segment.
template<PointConcept OtherPoint>
constexpr bool contains (const OtherPoint &point) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<SegmentConcept OtherSegment>
constexpr bool contains (const OtherSegment &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool contains (const OtherOrientedSegment &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<LineConcept OtherLine>
constexpr bool contains (const OtherLine &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< PointType > &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool boundaryContains (const Shape< PointType > &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<class EmptyPoint>
constexpr bool contains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<class EmptyPoint>
constexpr bool boundaryContains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<class EmptyPoint>
constexpr bool interiorContains (const EmptyShape< EmptyPoint > &) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<class EmptyPoint>
constexpr bool separates (const EmptyShape< EmptyPoint > &) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PointConcept OtherPoint>
constexpr bool interiorContains (const OtherPoint &point) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<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<PointConcept OtherPoint>
constexpr bool collinear (const OtherPoint &point) const
 Returns whether the given point is collinear with the oriented segment.
template<SegmentConcept OtherSegment>
constexpr bool collinear (const OtherSegment &other) const
 Returns whether the given segment is collinear with the oriented segment.
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool collinear (const OtherOrientedSegment &other) const
 Returns whether another oriented segment is collinear with this oriented segment.
template<LineConcept OtherLine>
constexpr bool collinear (const OtherLine &other) const
 Returns whether the given line is collinear with the oriented segment.
template<OrientedLineConcept OtherOrientedLine>
constexpr bool collinear (const OtherOrientedLine &other) const
 Returns whether the given oriented line is collinear with the oriented segment.
template<RayConcept OtherRay>
constexpr bool collinear (const OtherRay &other) const
 Returns whether the given ray is collinear with the oriented segment.
template<PointConcept OtherPoint>
constexpr std::partial_ordering orientation (const OtherPoint &point) const
 Returns the orientation sign of a point with respect to the segment.
template<class ResultNumber = division_result_t<NumberType>>
constexpr ResultNumber slope () const
 Returns the slope of the segment.
constexpr Halfplane< PointTyperightHalfplane () const
 Returns the half-plane on the right of the segment direction.
constexpr Halfplane< PointTypeleftHalfplane () const
 Returns the half-plane on the left of the segment direction.
template<SegmentConcept OtherSegment>
constexpr bool parallel (const OtherSegment &other) const
 Returns whether the given segment is parallel to the oriented segment.
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool parallel (const OtherOrientedSegment &other) const
 Returns whether another oriented segment is parallel to this oriented segment.
template<LineConcept OtherLine>
constexpr bool parallel (const OtherLine &other) const
 Returns whether the given line is parallel to the oriented segment.
template<OrientedLineConcept OtherOrientedLine>
constexpr bool parallel (const OtherOrientedLine &other) const
 Returns whether the given oriented line is parallel to the oriented segment.
template<RayConcept OtherRay>
constexpr bool parallel (const OtherRay &other) const
 Returns whether the given ray is parallel to the oriented segment.
template<PointConcept OtherPoint>
constexpr bool intersects (const OtherPoint &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<SegmentConcept OtherSegment>
constexpr bool intersects (const OtherSegment &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool intersects (const OtherOrientedSegment &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
constexpr bool intersects (const Shape< PointType > &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
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<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr std::optional< Point< ResultNumber, typename PointType::LabelType > > intersection (const OtherPoint &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto intersection (const OtherSegment &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto intersection (const OtherOrientedSegment &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>) && requires(const
OtherShape& o, const OrientedSegment& 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 = division_result_t<NumberType>, class OtherNumber>
constexpr std::optional< ResultNumber > yAtX (const OtherNumber &x) const
 Returns the value of the y coordinate for a given x, if it exists.
template<class ResultNumber = division_result_t<NumberType>, class OtherNumber>
constexpr std::optional< ResultNumber > xAtY (const OtherNumber &y) const
 Returns the value of the x coordinate for a given y, if it exists.
template<PointConcept OtherPoint>
constexpr bool separates (const OtherPoint &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<SegmentConcept OtherSegment>
constexpr bool separates (const OtherSegment &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool separates (const OtherOrientedSegment &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<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<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<HalfplaneConcept OtherHalfplane>
constexpr bool separates (const OtherHalfplane &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<ConvexConcept OtherConvex>
constexpr bool separates (const OtherConvex &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PolygonConcept OtherPolygon>
constexpr bool separates (const OtherPolygon &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<MonotoneChainConcept OtherChain>
constexpr bool contains (const OtherChain &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<MonotoneChainConcept OtherChain>
constexpr bool boundaryContains (const OtherChain &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<MonotoneChainConcept OtherChain>
constexpr bool interiorContains (const OtherChain &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<MonotoneChainConcept OtherChain>
constexpr bool separates (const OtherChain &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PolylineConcept OtherPolyline>
constexpr bool contains (const OtherPolyline &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PolylineConcept OtherPolyline>
constexpr bool boundaryContains (const OtherPolyline &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PolylineConcept OtherPolyline>
constexpr bool interiorContains (const OtherPolyline &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PolylineConcept OtherPolyline>
constexpr bool separates (const OtherPolyline &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<HalfplaneIntersectionConcept OtherRegion>
constexpr bool contains (const OtherRegion &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<HalfplaneIntersectionConcept OtherRegion>
constexpr bool boundaryContains (const OtherRegion &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<HalfplaneIntersectionConcept OtherRegion>
constexpr bool interiorContains (const OtherRegion &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<HalfplaneIntersectionConcept OtherRegion>
constexpr bool separates (const OtherRegion &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PolygonWithHolesConcept OtherRegion>
constexpr bool contains (const OtherRegion &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PolygonWithHolesConcept OtherRegion>
constexpr bool boundaryContains (const OtherRegion &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PolygonWithHolesConcept OtherRegion>
constexpr bool interiorContains (const OtherRegion &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PolygonWithHolesConcept OtherRegion>
bool separates (const OtherRegion &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PolygonSetConcept OtherSet>
constexpr bool contains (const OtherSet &other) const
 Tests whether this shape contains the other shape (A ⊇ B).
template<PolygonSetConcept OtherSet>
constexpr bool boundaryContains (const OtherSet &other) const
 Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
template<PolygonSetConcept OtherSet>
constexpr bool interiorContains (const OtherSet &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PolygonSetConcept OtherSet>
bool separates (const OtherSet &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<DiskConcept OtherDisk>
constexpr bool separates (const OtherDisk &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
constexpr bool separates (const Shape< PointType > &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<DiskConcept OtherDisk>
constexpr bool interiorContains (const OtherDisk &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<ConvexConcept OtherConvex>
constexpr bool interiorContains (const OtherConvex &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PolygonConcept OtherPolygon>
constexpr bool interiorContains (const OtherPolygon &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<PointConcept OtherPoint>
constexpr bool interiorsIntersect (const OtherPoint &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<SegmentConcept OtherSegment>
constexpr bool interiorsIntersect (const OtherSegment &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool interiorsIntersect (const OtherOrientedSegment &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
constexpr bool interiorsIntersect (const OtherShape &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<class EmptyPoint>
constexpr bool interiorsIntersect (const EmptyShape< EmptyPoint > &) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
constexpr bool interiorsIntersect (const Shape< PointType > &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<SegmentConcept OtherSegment>
constexpr bool crosses (const OtherSegment &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<OrientedSegmentConcept OtherOrientedSegment>
constexpr bool crosses (const OtherOrientedSegment &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<PointConcept OtherPoint>
constexpr bool crosses (const OtherPoint &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
constexpr bool crosses (const OtherShape &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<class EmptyPoint>
constexpr bool crosses (const EmptyShape< EmptyPoint > &) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
constexpr bool crosses (const Shape< PointType > &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto squaredDistance (const OtherPoint &point) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto squaredDistance (const OtherSegment &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto squaredDistance (const OtherOrientedSegment &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>) && requires(const OtherShape& o, const
OrientedSegment& 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<OrientedSegment<PointType_, TLabel>, OtherShape>
constexpr auto closestSegments (const OtherShape &other) const
 Returns the pair of elements realizing the distance, nothing when the shapes meet.
template<class ResultNumber = division_result_t<NumberType>, class OtherShape>
requires detail::ClosestPointsPairConcept<OrientedSegment<PointType_, TLabel>, OtherShape>
constexpr auto closestPoints (const OtherShape &other) const
 Returns the pair of points realizing the distance, nothing when the shapes meet.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto distanceL1 (const OtherPoint &point) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto distanceL1 (const OtherSegment &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto distanceL1 (const OtherOrientedSegment &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>) && requires(const OtherShape& o, const
OrientedSegment& self) { o.template distanceL1<ResultNumber>(self); })
constexpr auto distanceL1 (const OtherShape &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto intersection (const Shape< OtherPoint > &other) const
 Returns the intersection of the two shapes (A ∩ B), re-dispatching through the wrapper's own intersection.
template<class ResultNumber = double, PointConcept OtherPoint>
constexpr auto distanceL1 (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceL1.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto distanceLInf (const OtherPoint &point) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto distanceLInf (const OtherSegment &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto distanceLInf (const OtherOrientedSegment &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>) && requires(const OtherShape& o, const
OrientedSegment& self) { o.template distanceLInf<ResultNumber>(self); })
constexpr auto distanceLInf (const OtherShape &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = double, PointConcept OtherPoint>
constexpr auto distanceLInf (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceLInf.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto hausdorffDistanceL1 (const OtherSegment &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto hausdorffDistanceL1 (const OtherOrientedSegment &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto hausdorffDistanceL1 (const OtherPoint &point) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>) && requires(const OtherShape& o, const
OrientedSegment& self) { o.template hausdorffDistanceL1<ResultNumber>(self); })
constexpr auto hausdorffDistanceL1 (const OtherShape &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto hausdorffDistanceL1 (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceL1.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto hausdorffDistanceLInf (const OtherSegment &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto hausdorffDistanceLInf (const OtherOrientedSegment &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto hausdorffDistanceLInf (const OtherPoint &point) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>) && requires(const OtherShape& o, const
OrientedSegment& self) { o.template hausdorffDistanceLInf<ResultNumber>(self); })
constexpr auto hausdorffDistanceLInf (const OtherShape &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto hausdorffDistanceLInf (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceLInf.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto squaredHausdorffDistance (const OtherSegment &other) const
 Returns the squared Hausdorff distance to another unordered segment.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto squaredHausdorffDistance (const OtherOrientedSegment &other) const
 Returns the squared Hausdorff distance to another oriented segment.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto squaredHausdorffDistance (const OtherPoint &point) const
 Returns the squared Hausdorff distance to a point.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>) && requires(const OtherShape& o, const
OrientedSegment& self) { o.template squaredHausdorffDistance<ResultNumber>(self); })
constexpr auto squaredHausdorffDistance (const OtherShape &other) const
 Returns the squared Hausdorff distance to the given shape.
constexpr Segment< PointTypediameter () const
 Returns an unordered segment defining the diameter.
template<class ResultNumber = grid_number_t<typename PointType_::NumberType>>
requires (detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints () const
 Returns the integer points the oriented segment contains.
constexpr Rectangle< PointTypebbox () const
 Returns the bounding box of the oriented segment.
template<std::floating_point ResultNumber = double>
constexpr Rectangle< Point< ResultNumber > > fbox () const
 Returns a bounding box of the oriented segment with floating point coordinates.
constexpr std::array< PointType, 2 > vertices () const
 Returns the two endpoints in source-to-target order.
constexpr Convex< PointTypeconvexHull () const
 Returns the convex hull of the segment's endpoints.
constexpr std::array< Segment< PointType >, 1 > edges () const
 Returns the unique geometric edge of the oriented segment.
constexpr std::array< OrientedSegment, 1 > orientedEdges () const
 Returns the unique oriented edge of the oriented segment.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Point< ResultNumber > midpoint () const
 Returns the midpoint of the segment.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Point< ResultNumber > pointInside () const
 Returns a point inside the segment.
template<class OtherShape>
constexpr bool pointInsideInteriorContainedIn (const OtherShape &shape) const
 Tests whether some point in this shape's relative interior lies in the strict interior of shape.
template<class OtherShape>
requires MinkowskiSummableConcept<OrientedSegment<PointType_, TLabel>, OtherShape>
constexpr auto minkowskiSum (const OtherShape &other) const
 Returns the Minkowski sum of this shape and another (A ⊕ B).
template<class OtherShape>
requires MinkowskiSummableConcept<OrientedSegment<PointType_, TLabel>, OtherShape>
constexpr auto minkowskiErosion (const OtherShape &other) const
 Returns the Minkowski erosion of this shape by another (A ⊖ B).
template<class OtherShape>
requires (!MinkowskiSummableConcept<OrientedSegment<PointType_, TLabel>, OtherShape> && BoundedPolygonalConcept<OtherShape>)
constexpr auto minkowskiErosion (const OtherShape &other) const
 Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!MinkowskiSummableConcept<OrientedSegment<PointType_, TLabel>, OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<OrientedSegment>) && requires(const OtherShape& o, const OrientedSegment& self) { o.template
minkowskiSum<ResultNumber>(self); })
auto minkowskiSum (const OtherShape &other) const
 Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
template<PointConcept OtherPoint>
constexpr OrientedSegmentoperator+= (const OtherPoint &translation)
 Translates the oriented segment by the given point in place.
template<PointConcept OtherPoint>
constexpr OrientedSegmentoperator-= (const OtherPoint &translation)
 Translates the oriented segment by the negation of the given point in place.
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr OrientedSegmentoperator*= (const Scalar &scalar)
 Scales the oriented segment around the origin by a scalar in place.
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr OrientedSegmentoperator/= (const Scalar &scalar)
 Divides the oriented segment coordinates by a scalar in place.
template<PointConcept OtherPoint>
constexpr OrientedSegment< PointType, LabelType > & operator+= (const OtherPoint &translation)
template<PointConcept OtherPoint>
constexpr OrientedSegment< PointType, LabelType > & operator-= (const OtherPoint &translation)
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr OrientedSegment< PointType, LabelType > & operator*= (const Scalar &scalar)
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr OrientedSegment< PointType, LabelType > & operator/= (const Scalar &scalar)
template<class OtherNumber>
constexpr OrientedSegment< PointType, LabelTypescaledUpX (const OtherNumber scalar) const
template<class OtherNumber>
constexpr OrientedSegment< PointType, LabelTypescaledUpY (const OtherNumber scalar) const
template<class OtherNumber>
constexpr OrientedSegment< PointType, LabelTypescaledDownX (const OtherNumber scalar) const
template<class OtherNumber>
constexpr OrientedSegment< PointType, LabelTypescaledDownY (const OtherNumber scalar) const

Static Public Member Functions

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

Public Attributes

std::array< PointType, 2 > points_ {}
LabelType label_ {}

Detailed Description

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

Directed segment preserving source-to-target order plus optional segment label.

Oriented segment connecting two endpoints in source-to-target order.

Unlike Segment, the stored endpoint order is preserved.

Like Segment, an oriented segment may carry an optional LabelType value, independent of the endpoint point label. The label is metadata: it is ignored by equality, ordering and hashing, but it is copied across conversions and preserved by in-place transformations.

Template Parameters
PointTypeEndpoint point type.
TLabelOptional label type carried with the segment (NoLabel to omit).

Member Typedef Documentation

◆ LabelType

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

◆ NumberType

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

◆ PointType

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

Constructor & Destructor Documentation

◆ OrientedSegment() [1/6]

template<class PointType_, class TLabel>
pgl::OrientedSegment< PointType_, TLabel >::OrientedSegment ( )
constexprdefault

Creates the degenerate oriented segment (0,0)->(0,0).

◆ OrientedSegment() [2/6]

template<class PointType_, class TLabel>
pgl::OrientedSegment< PointType_, TLabel >::OrientedSegment ( PointType source,
PointType target )
inlineconstexpr

Creates an oriented segment from a source and target.

The endpoint order is preserved exactly as provided.

Parameters
sourceSource endpoint.
targetTarget endpoint.

◆ OrientedSegment() [3/6]

template<class PointType_, class TLabel>
pgl::OrientedSegment< PointType_, TLabel >::OrientedSegment ( NumberType x1,
NumberType y1,
NumberType x2,
NumberType y2 )
inlineconstexpr

Creates an oriented segment from four coordinates.

Parameters
x1X coordinate of the source.
y1Y coordinate of the source.
x2X coordinate of the target.
y2Y coordinate of the target.

◆ OrientedSegment() [4/6]

template<class PointType_, class TLabel>
template<class A>
requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
pgl::OrientedSegment< PointType_, TLabel >::OrientedSegment ( PointType source,
PointType target,
A && label )
inlineconstexpr

Creates an oriented segment from a source and target and stores a label.

The endpoint order is preserved exactly as provided.

Template Parameters
AType convertible to LabelType.
Parameters
sourceSource endpoint.
targetTarget endpoint.
labelSegment label, forwarded into the stored label.

◆ OrientedSegment() [5/6]

template<class PointType_, class TLabel>
template<class A>
requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
pgl::OrientedSegment< PointType_, TLabel >::OrientedSegment ( NumberType x1,
NumberType y1,
NumberType x2,
NumberType y2,
A && label )
inlineconstexpr

Same as the four-coordinate constructor, and stores a label.

◆ OrientedSegment() [6/6]

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

Converts an oriented segment with a different point and/or label type.

The endpoints are converted to PointType, preserving their order, and the label is copied when both sides carry one.

Member Function Documentation

◆ area()

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

Returns the area of the segment.

A segment is one-dimensional, so its area is always zero.

Template Parameters
ResultNumberResult type (default: NumberType).
Returns
Zero.

◆ asLine()

template<class PointType_, class TLabel>
Line< PointType > pgl::OrientedSegment< PointType_, TLabel >::asLine ( ) const
inlinenodiscardconstexpr

Returns the supporting line without orientation.

Returns
Line containing the segment.

◆ asOrientedLine()

template<class PointType_, class TLabel>
OrientedLine< PointType > pgl::OrientedSegment< PointType_, TLabel >::asOrientedLine ( ) const
inlinenodiscardconstexpr

Returns the oriented supporting line.

Returns
Oriented line containing the segment and preserving its direction.

◆ asRay()

template<class PointType_, class TLabel>
Ray< PointType > pgl::OrientedSegment< PointType_, TLabel >::asRay ( ) const
inlinenodiscardconstexpr

Returns the ray with the same source and direction.

Returns
Ray starting at source and going through target.

◆ asSegment()

template<class PointType_, class TLabel>
Segment< PointType > pgl::OrientedSegment< PointType_, TLabel >::asSegment ( ) const
inlinenodiscardconstexpr

Returns the segment without orientation.

Returns
Unordered segment spanning the same endpoints.

◆ bbox()

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

Returns the bounding box of the oriented segment.

Returns
The minimum axis-aligned rectangle that contains the segment.

◆ begin() [1/2]

template<class PointType_, class TLabel>
auto pgl::OrientedSegment< PointType_, TLabel >::begin ( )
inlineconstexpr

◆ begin() [2/2]

template<class PointType_, class TLabel>
auto pgl::OrientedSegment< PointType_, TLabel >::begin ( ) const
inlineconstexpr

Returns an iterator to the source endpoint.

Returns
Pointer to the source endpoint.

◆ boundaryContains() [1/19]

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

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

◆ boundaryContains() [2/19]

template<class PointType_, class TLabel>
template<MonotoneChainConcept OtherChain>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherChain & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [3/19]

template<class PointType_, class TLabel>
template<ConvexConcept OtherConvex>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherConvex & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [4/19]

template<class PointType_, class TLabel>
template<DiskConcept OtherDisk>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherDisk & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [5/19]

template<class PointType_, class TLabel>
template<HalfplaneConcept OtherHalfplane>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherHalfplane & ) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [6/19]

template<class PointType_, class TLabel>
template<LineConcept OtherLine>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherLine & ) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [7/19]

template<class PointType_, class TLabel>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherOrientedLine & ) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [8/19]

template<class PointType_, class TLabel>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherOrientedSegment< PointType_, TLabel > & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [9/19]

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

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

For segments, the boundary is exactly the two endpoints.

Template Parameters
OtherPointType of the point.
Parameters
pointPoint to test.
Returns
true if the point is one of the endpoints.

OrientedSegment

Oriented-segment predicates. Most topology delegates to the unoriented segment view, with local methods kept for orientation-sensitive behavior.

◆ boundaryContains() [10/19]

template<class PointType_, class TLabel>
template<PolygonConcept OtherPolygon>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherPolygon & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [11/19]

template<class PointType_, class TLabel>
template<PolylineConcept OtherPolyline>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherPolyline & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [12/19]

template<class PointType_, class TLabel>
template<RayConcept OtherRay>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherRay & ) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [13/19]

template<class PointType_, class TLabel>
template<RectangleConcept OtherRectangle>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherRectangle & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [14/19]

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

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

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

◆ boundaryContains() [15/19]

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

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

◆ boundaryContains() [16/19]

template<class PointType_, class TLabel>
template<SegmentConcept OtherSegment>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherSegment & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [17/19]

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

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

◆ boundaryContains() [18/19]

template<class PointType_, class TLabel>
template<TriangleConcept OtherTriangle>
bool pgl::OrientedSegment< PointType_, TLabel >::boundaryContains ( const OtherTriangle & other) const
inlinenodiscardconstexpr

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

◆ boundaryContains() [19/19]

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

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

◆ cbegin()

template<class PointType_, class TLabel>
auto pgl::OrientedSegment< PointType_, TLabel >::cbegin ( ) const
inlineconstexpr

Returns an iterator to the source endpoint.

Returns
Pointer to the source endpoint.

◆ cend()

template<class PointType_, class TLabel>
auto pgl::OrientedSegment< PointType_, TLabel >::cend ( ) const
inlineconstexpr

Returns an iterator past the target endpoint.

Returns
Pointer past the target endpoint.

◆ closestPoints()

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

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

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

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

◆ closestSegments()

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

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

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

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

◆ collinear() [1/6]

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

Returns whether the given line is collinear with the oriented segment.

◆ collinear() [2/6]

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

Returns whether the given oriented line is collinear with the oriented segment.

◆ collinear() [3/6]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::OrientedSegment< PointType, LabelType >::collinear ( const OtherOrientedSegment< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns whether another oriented segment is collinear with this oriented segment.

◆ collinear() [4/6]

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

Returns whether the given point is collinear with the oriented segment.

◆ collinear() [5/6]

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

Returns whether the given ray is collinear with the oriented segment.

◆ collinear() [6/6]

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

Returns whether the given segment is collinear with the oriented segment.

◆ contains() [1/19]

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

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

◆ contains() [2/19]

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

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

◆ contains() [3/19]

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

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

◆ contains() [4/19]

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

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

◆ contains() [5/19]

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

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

◆ contains() [6/19]

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

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

◆ contains() [7/19]

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

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

◆ contains() [8/19]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther oriented segment.
Returns
true if both endpoints of other lie on this segment.

◆ contains() [9/19]

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

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

Endpoints are included.

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

OrientedSegment

Oriented-segment predicates. Most topology delegates to the unoriented segment view, with local methods kept for orientation-sensitive behavior.

◆ contains() [10/19]

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

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

◆ contains() [11/19]

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

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

◆ contains() [12/19]

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

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

◆ contains() [13/19]

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

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

◆ contains() [14/19]

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

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

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

◆ contains() [15/19]

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

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

◆ contains() [16/19]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther segment.
Returns
true if both endpoints of other lie on this segment.

◆ contains() [17/19]

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

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

◆ contains() [18/19]

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

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

◆ contains() [19/19]

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

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

◆ containsCollinear()

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

Returns whether the segment contains the given point that is collinear with the segment.

Endpoints are included. Undefined behavior if the point is not collinear with the segment.

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

◆ containsEndpoint()

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

Returns whether the given point is one endpoint.

This is a segment-specific alias for verticesContain.

Template Parameters
OtherPointType of the point.
Parameters
pointPoint to test.
Returns
true if the point equals source or target.

◆ convexHull()

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

Returns the convex hull of the segment's endpoints.

Returns
A degenerate two-vertex convex polygon spanning the segment.

◆ crosses() [1/6]

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

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

◆ crosses() [2/6]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther oriented segment.
Returns
true if the segments cross through their interiors.

◆ crosses() [3/6]

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

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

◆ crosses() [4/6]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther segment.
Returns
true if the segments cross through their interiors.

OrientedSegment

Oriented-segment predicates. Most topology delegates to the unoriented segment view, with local methods kept for orientation-sensitive behavior.

◆ crosses() [5/6]

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

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

◆ crosses() [6/6]

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

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

◆ diameter()

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

Returns an unordered segment defining the diameter.

Returns
Unordered segment spanning the same endpoints.

◆ distanceL1() [1/5]

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

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

◆ distanceL1() [2/5]

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

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

◆ distanceL1() [3/5]

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

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

◆ distanceL1() [4/5]

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

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

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

◆ distanceL1() [5/5]

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

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

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

◆ distanceLInf() [1/5]

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

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

◆ distanceLInf() [2/5]

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

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

◆ distanceLInf() [3/5]

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

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

◆ distanceLInf() [4/5]

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

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

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

◆ distanceLInf() [5/5]

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

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

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

◆ edges()

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

Returns the unique geometric edge of the oriented segment.

Returns
Array containing the underlying unoriented segment.

◆ end() [1/2]

template<class PointType_, class TLabel>
auto pgl::OrientedSegment< PointType_, TLabel >::end ( )
inlineconstexpr

◆ end() [2/2]

template<class PointType_, class TLabel>
auto pgl::OrientedSegment< PointType_, TLabel >::end ( ) const
inlineconstexpr

Returns an iterator past the target endpoint.

Returns
Pointer past the target endpoint.

◆ fbox()

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

Returns a bounding box of the oriented segment with floating point coordinates.

Template Parameters
ResultNumberFloating point type.
Returns
A rectangle that contains the segment.

◆ get() [1/2]

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

◆ get() [2/2]

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

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

◆ getIfPoint()

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

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

Complexity: O(1).

Returns
The common endpoint if isPoint, std::nullopt otherwise.

◆ hausdorffDistanceL1() [1/5]

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

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

◆ hausdorffDistanceL1() [2/5]

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

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

◆ hausdorffDistanceL1() [3/5]

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

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

◆ hausdorffDistanceL1() [4/5]

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

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

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

◆ hausdorffDistanceL1() [5/5]

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

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

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

◆ hausdorffDistanceLInf() [1/5]

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

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

◆ hausdorffDistanceLInf() [2/5]

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

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

◆ hausdorffDistanceLInf() [3/5]

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

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

◆ hausdorffDistanceLInf() [4/5]

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

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

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

◆ hausdorffDistanceLInf() [5/5]

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

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

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

◆ index()

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

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

◆ interiorContains() [1/18]

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

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

◆ interiorContains() [2/18]

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

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

◆ interiorContains() [3/18]

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

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

◆ interiorContains() [4/18]

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

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

◆ interiorContains() [5/18]

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

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

◆ interiorContains() [6/18]

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

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

◆ interiorContains() [7/18]

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

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

◆ interiorContains() [8/18]

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

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

◆ interiorContains() [9/18]

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

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

OrientedSegment

Oriented-segment predicates. Most topology delegates to the unoriented segment view, with local methods kept for orientation-sensitive behavior.

◆ interiorContains() [10/18]

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

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

◆ interiorContains() [11/18]

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

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

◆ interiorContains() [12/18]

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

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

◆ interiorContains() [13/18]

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

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

◆ interiorContains() [14/18]

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

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

◆ interiorContains() [15/18]

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

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

◆ interiorContains() [16/18]

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

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

◆ interiorContains() [17/18]

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

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

◆ interiorContains() [18/18]

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

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

◆ interiorsIntersect() [1/6]

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

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

◆ interiorsIntersect() [2/6]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther oriented segment.
Returns
true if the segments share at least one point interior to both.

◆ interiorsIntersect() [3/6]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther segment.
Returns
true if the segments share at least one point interior to both.

OrientedSegment

Oriented-segment predicates. Most topology delegates to the unoriented segment view, with local methods kept for orientation-sensitive behavior.

◆ interiorsIntersect() [4/6]

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

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

◆ interiorsIntersect() [5/6]

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

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

◆ interiorsIntersect() [6/6]

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

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

◆ intersection() [1/6]

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

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

◆ intersection() [2/6]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::OrientedSegment< PointType, LabelType >::intersection ( const OtherOrientedSegment< PointType_, TLabel > & other) const
nodiscardconstexpr

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

Template Parameters
ResultNumberCoordinate type of the returned point or segment.
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther oriented segment.
Returns
Empty if disjoint, otherwise a point or an unordered segment.
Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [3/6]

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

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

Template Parameters
ResultNumberCoordinate type of the returned point or segment.
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther segment.
Returns
Empty if disjoint, otherwise a point or an unordered segment.

◆ intersection() [4/6]

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

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [5/6]

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

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

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [6/6]

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

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

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

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

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

◆ intersects() [1/6]

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

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

◆ intersects() [2/6]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther oriented segment.
Returns
true if the segments share at least one point.

◆ intersects() [3/6]

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

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

OrientedSegment

Oriented-segment predicates. Most topology delegates to the unoriented segment view, with local methods kept for orientation-sensitive behavior.

◆ intersects() [4/6]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther segment.
Returns
true if the segments share at least one point.

◆ intersects() [5/6]

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

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

◆ intersects() [6/6]

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

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

◆ isDegenerate()

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

Returns whether both endpoints coincide.

Returns
true if the segment is a single point.

OrientedSegment

Oriented-segment predicates. Most topology delegates to the unoriented segment view, with local methods kept for orientation-sensitive behavior.

◆ isHorizontal()

template<class PointType, class LabelType>
bool pgl::OrientedSegment< PointType, LabelType >::isHorizontal ( ) const
nodiscardconstexpr

Returns whether the segment is horizontal.

Returns
true if both endpoints share the same y-coordinate.

◆ isPoint()

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

Returns whether the segment collapses to a single point.

Equivalent to isDegenerate for an oriented segment, which always has two defining points.

Complexity: O(1).

Returns
true if source and target coincide.

◆ isUndefined()

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

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

An oriented segment is never undefined: its only degeneracy is collapsing to a point, so this always returns false. Provided for uniformity with the other shapes.

Complexity: O(1).

Returns
false.

◆ isVertical()

template<class PointType, class LabelType>
bool pgl::OrientedSegment< PointType, LabelType >::isVertical ( ) const
nodiscardconstexpr

Returns whether the segment is vertical.

Returns
true if both endpoints share the same x-coordinate.

◆ label()

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

Returns the segment label.

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

Returns
Reference to the stored label.

◆ latticePoints()

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

Returns the integer points the oriented segment contains.

Exactly pgl::Segment::latticePoints of the same endpoints, listed from source to target rather than in increasing order.

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

◆ leftHalfplane()

template<class PointType, class LabelType>
Halfplane< PointType > pgl::OrientedSegment< PointType, LabelType >::leftHalfplane ( ) const
nodiscardconstexpr

Returns the half-plane on the left of the segment direction.

Returns
Closed left half-plane.

◆ length()

template<class PointType, class LabelType>
template<class ApproximateNumber>
ApproximateNumber pgl::OrientedSegment< PointType, LabelType >::length ( ) const
nodiscard

Returns the Euclidean length.

Template Parameters
ApproximateNumberFloating-point return type.
Returns
Euclidean length.

◆ lengthL1()

template<class PointType, class LabelType>
auto pgl::OrientedSegment< PointType, LabelType >::lengthL1 ( ) const
nodiscardconstexpr

Returns the Manhattan length.

Returns
L1 length.

◆ lengthLInf()

template<class PointType, class LabelType>
auto pgl::OrientedSegment< PointType, LabelType >::lengthLInf ( ) const
nodiscardconstexpr

Returns the Chebyshev length.

Returns
L infinity length.

◆ max()

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

Returns the lexicographically largest endpoint.

Returns
Reference to the larger endpoint.

◆ midpoint()

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

Returns the midpoint of the segment.

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

◆ min()

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

Returns the lexicographically smallest endpoint.

Returns
Reference to the smaller endpoint.

◆ minkowskiErosion() [1/2]

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

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

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

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

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

◆ minkowskiErosion() [2/2]

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

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

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

Eroding by a Point is the translation by its negation, so it returns this shape's own type; the other pairs come back as the convex region they are, a HalfplaneIntersection, which holds a lower-dimensional erosion and the empty one as readily as a two-dimensional one. A segment erodes to the sub-segment of itself the operand's width leaves.

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

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

◆ minkowskiSum() [1/2]

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

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

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

◆ minkowskiSum() [2/2]

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

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

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

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

◆ operator OrientedLine< PointType >()

template<class PointType, class LabelType>
pgl::OrientedSegment< PointType, LabelType >::operator OrientedLine< PointType > ( ) const
explicitnodiscardconstexpr

Converts to the oriented supporting line.

Returns
Oriented line containing the segment and preserving its direction.

◆ operator Ray< PointType >()

template<class PointType, class LabelType>
pgl::OrientedSegment< PointType, LabelType >::operator Ray< PointType > ( ) const
explicitnodiscardconstexpr

Converts to the ray with the same source and direction.

Returns
Ray starting at source and going through target.

◆ operator Segment< PointType >()

template<class PointType_, class TLabel>
pgl::OrientedSegment< PointType_, TLabel >::operator Segment< PointType > ( ) const
inlineexplicitnodiscardconstexpr

Converts to the unordered geometric segment with the same endpoints.

Direct initialization and explicit casts are allowed.

Returns
Unordered segment spanning the same endpoints.

◆ operator*=() [1/2]

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

◆ operator*=() [2/2]

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

Scales the oriented segment around the origin by a scalar in place.

◆ operator+=() [1/2]

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

◆ operator+=() [2/2]

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

Translates the oriented segment by the given point in place.

◆ operator-=() [1/2]

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

◆ operator-=() [2/2]

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

Translates the oriented segment by the negation of the given point in place.

◆ operator/=() [1/2]

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

◆ operator/=() [2/2]

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

Divides the oriented segment coordinates by a scalar in place.

◆ operator<=>()

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

Provides lexicographic ordering on (source, target).

The label is ignored, mirroring Point and Segment.

Parameters
otherOriented segment to compare with.
Returns
-1, 0, or 1.

◆ operator=()

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

Assigns from an oriented segment with compatible point and label types.

◆ operator==()

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

Compares two oriented segments by their endpoints; the label is ignored.

Parameters
otherOriented segment to compare with.
Returns
true if both segments have the same ordered endpoints.

◆ operator[]() [1/2]

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

Returns endpoint 0 for the source and 1 for the target.

Parameters
indexEndpoint index.
Returns
Reference to the selected endpoint.

◆ operator[]() [2/2]

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

Returns endpoint 0 for the source and 1 for the target.

Parameters
indexEndpoint index.
Returns
Reference to the selected endpoint.

◆ opposite()

template<class PointType_, class TLabel>
OrientedSegment pgl::OrientedSegment< PointType_, TLabel >::opposite ( ) const
inlineconstexpr

Returns the opposite orientation of the same geometric segment.

Returns
Reversed oriented segment.

◆ orientation()

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
std::partial_ordering pgl::OrientedSegment< PointType, LabelType >::orientation ( const OtherPoint & point) const
nodiscardconstexpr

Returns the orientation sign of a point with respect to the segment.

Negative means the point lies on the right of the segment direction, positive on the left, and equivalent to zero when the point is collinear.

Template Parameters
OtherPointType of the point.
Parameters
pointPoint to classify.
Returns
Orientation sign of (source, target, point).

◆ orientedEdges()

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

Returns the unique oriented edge of the oriented segment.

Returns
Array containing this segment.

◆ parallel() [1/5]

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

Returns whether the given line is parallel to the oriented segment.

◆ parallel() [2/5]

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

Returns whether the given oriented line is parallel to the oriented segment.

◆ parallel() [3/5]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::OrientedSegment< PointType, LabelType >::parallel ( const OtherOrientedSegment< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns whether another oriented segment is parallel to this oriented segment.

◆ parallel() [4/5]

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

Returns whether the given ray is parallel to the oriented segment.

◆ parallel() [5/5]

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

Returns whether the given segment is parallel to the oriented segment.

◆ pointInside()

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

Returns a point inside the segment.

For a segment, this is its midpoint.

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

◆ pointInsideInteriorContainedIn()

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

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

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

◆ rightHalfplane()

template<class PointType, class LabelType>
Halfplane< PointType > pgl::OrientedSegment< PointType, LabelType >::rightHalfplane ( ) const
nodiscardconstexpr

Returns the half-plane on the right of the segment direction.

Returns
Closed right half-plane.

◆ rotate90()

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

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

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

◆ rotated90()

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

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

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

◆ samePointSet()

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

Tests whether another shape defines exactly the same point set.

◆ scaledDownX() [1/2]

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

◆ scaledDownX() [2/2]

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

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

◆ scaledDownY() [1/2]

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

◆ scaledDownY() [2/2]

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

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

◆ scaleDownX()

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

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

◆ scaleDownY()

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

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

◆ scaledUpX() [1/2]

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

◆ scaledUpX() [2/2]

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

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

◆ scaledUpY() [1/2]

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

◆ scaledUpY() [2/2]

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

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

◆ scaleUpX()

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

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

◆ scaleUpY()

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

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

◆ separates() [1/19]

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

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

◆ separates() [2/19]

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

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

◆ separates() [3/19]

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

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

◆ separates() [4/19]

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

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

◆ separates() [5/19]

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

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

◆ separates() [6/19]

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

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

◆ separates() [7/19]

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

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

◆ separates() [8/19]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther oriented segment.
Returns
true if removing this segment splits the other one.

◆ separates() [9/19]

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

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

Template Parameters
OtherNumberCoordinate type of the other segment endpoints.
OtherPoint::LabelTypeLabel type of the other segment endpoints.
Parameters
otherOther segment.
Returns
true if removing this segment splits the other one.

OrientedSegment

Oriented-segment predicates. Most topology delegates to the unoriented segment view, with local methods kept for orientation-sensitive behavior.

◆ separates() [10/19]

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

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

◆ separates() [11/19]

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

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

◆ separates() [12/19]

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

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

◆ separates() [13/19]

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

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

◆ separates() [14/19]

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

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

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

◆ separates() [15/19]

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

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

◆ separates() [16/19]

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

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

◆ separates() [17/19]

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

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

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

◆ separates() [18/19]

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

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

◆ separates() [19/19]

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

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

◆ size()

template<class PointType_, class TLabel>
constexpr std::size_t pgl::OrientedSegment< PointType_, TLabel >::size ( )
inlinestaticconstexpr

Returns the number of endpoints (always 2).

◆ slope()

template<class PointType, class LabelType>
template<class ResultNumber>
ResultNumber pgl::OrientedSegment< PointType, LabelType >::slope ( ) const
nodiscardconstexpr

Returns the slope of the segment.

Undefined behavior for vertical segments.

Template Parameters
ResultNumberCoordinate type of the returned slope.
Returns
Slope.

◆ source() [1/2]

template<class PointType_, class TLabel>
PointType & pgl::OrientedSegment< PointType_, TLabel >::source ( )
inlineconstexpr

◆ source() [2/2]

template<class PointType_, class TLabel>
const PointType & pgl::OrientedSegment< PointType_, TLabel >::source ( ) const
inlineconstexpr

Returns the source endpoint.

Returns
Reference to the source.

◆ squaredDistance() [1/5]

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

Returns the squared Euclidean distance to a disk.

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

◆ squaredDistance() [2/5]

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

Returns the squared Euclidean distance to the given shape.

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

◆ squaredDistance() [3/5]

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

Returns the squared Euclidean distance to the given shape.

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

◆ squaredDistance() [4/5]

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

Returns the squared Euclidean distance to the given shape.

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

◆ squaredDistance() [5/5]

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

Returns the squared Euclidean distance to the given shape.

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

◆ squaredHausdorffDistance() [1/4]

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

Returns the squared Hausdorff distance to another oriented segment.

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

◆ squaredHausdorffDistance() [2/4]

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

Returns the squared Hausdorff distance to a point.

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

◆ squaredHausdorffDistance() [3/4]

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

Returns the squared Hausdorff distance to another unordered segment.

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

◆ squaredHausdorffDistance() [4/4]

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

Returns the squared Hausdorff distance to the given shape.

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

◆ squaredLength()

template<class PointType, class LabelType>
auto pgl::OrientedSegment< PointType, LabelType >::squaredLength ( ) const
nodiscardconstexpr

Returns the squared Euclidean length.

Returns
Squared Euclidean length.

◆ target() [1/2]

template<class PointType_, class TLabel>
PointType & pgl::OrientedSegment< PointType_, TLabel >::target ( )
inlineconstexpr

◆ target() [2/2]

template<class PointType_, class TLabel>
const PointType & pgl::OrientedSegment< PointType_, TLabel >::target ( ) const
inlineconstexpr

Returns the target endpoint.

Returns
Reference to the target.

◆ twiceArea()

template<class PointType, class LabelType>
OrientedSegment< PointType, LabelType >::NumberType pgl::OrientedSegment< PointType, LabelType >::twiceArea ( ) const
nodiscardconstexpr

Returns twice the area of the segment.

A segment is one-dimensional, so this is always zero.

Returns
Zero.

◆ vertices()

template<class PointType, class LabelType>
std::array< PointType, 2 > pgl::OrientedSegment< PointType, LabelType >::vertices ( ) const
nodiscardconstexpr

Returns the two endpoints in source-to-target order.

Returns
Array {source(), target()}.

◆ verticesContain()

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

Returns whether one endpoint equals the given point.

Template Parameters
OtherPointType of the point.
Parameters
pointPoint to test.
Returns
true if the point is an endpoint of the segment.

◆ xAtY()

template<class PointType, class LabelType>
template<class ResultNumber, class OtherNumber>
std::optional< ResultNumber > pgl::OrientedSegment< PointType, LabelType >::xAtY ( const OtherNumber & y) const
nodiscardconstexpr

Returns the value of the x coordinate for a given y, if it exists.

Evaluates the x-coordinate of the supporting unordered segment.

Delegates to the unordered segment with the same endpoints.

Template Parameters
ResultNumberNumber type of the return value.
OtherNumberCoordinate type of the y coordinate.
Parameters
yGiven y coordinate.
Returns
An std::optional of ResultNumber corresponding to the x coordinate.
Warning
Divides coordinates after casting to ResultNumber.

The orientation does not affect the returned geometric point, so this delegates to the corresponding unordered segment.

◆ yAtX()

template<class PointType, class LabelType>
template<class ResultNumber, class OtherNumber>
std::optional< ResultNumber > pgl::OrientedSegment< PointType, LabelType >::yAtX ( const OtherNumber & x) const
nodiscardconstexpr

Returns the value of the y coordinate for a given x, if it exists.

Evaluates the y-coordinate of the supporting unordered segment.

Delegates to the unordered segment with the same endpoints.

Template Parameters
ResultNumberNumber type of the return value.
OtherNumberCoordinate type of the x coordinate.
Parameters
xGiven x coordinate.
Returns
An std::optional of ResultNumber corresponding to the y coordinate.
Warning
Divides coordinates after casting to ResultNumber.

The orientation does not affect the returned geometric point, so this delegates to the corresponding unordered segment.

Member Data Documentation

◆ label_

template<class PointType_, class TLabel>
LabelType pgl::OrientedSegment< PointType_, TLabel >::label_ {}
mutable

◆ points_

template<class PointType_, class TLabel>
std::array<PointType, 2> pgl::OrientedSegment< PointType_, TLabel >::points_ {}