Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
orientedsegment.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "shape/segment.hpp"
4
12
13
14namespace pgl {
15
16template <class PointType = Point<>, class Label>
17struct OrientedSegment;
18
20
21template <class PointType>
23
24template <class PointType, class A>
26
27template <class Number>
28OrientedSegment(Number, Number, Number, Number) -> OrientedSegment<Point<Number>, NoLabel>;
29
43template <class PointType_, class TLabel>
45 using PointType = PointType_;
46 using NumberType = PointType::NumberType;
47 using LabelType = TLabel;
48
49 static_assert(detail::is_point_v<PointType>, "OrientedSegment requires pgl::Point endpoints");
50
54 constexpr OrientedSegment() = default;
55
65 : points_{std::move(source), std::move(target)} {}
66
76 : OrientedSegment(PointType(x1, y1), PointType(x2, y2)) {}
77
88 template <class A>
89 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
91 : points_{std::move(source), std::move(target)}, label_(std::forward<A>(label)) {}
92
94 template <class A>
95 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
97 : OrientedSegment(PointType(x1, y1), PointType(x2, y2), std::forward<A>(label)) {}
98
105 template<PointConcept OtherPointType, class OtherLabelType>
106 requires(std::constructible_from<PointType, const OtherPointType&>)
108 : OrientedSegment(PointType(other.source()), PointType(other.target())) {
109 label_ = detail::copyLabel<LabelType>(other);
110 }
111
115 template<PointConcept OtherPointType, class OtherLabelType>
116 requires(std::constructible_from<PointType, const OtherPointType&>)
118 points_[0] = PointType(other.source());
119 points_[1] = PointType(other.target());
120 label_ = detail::copyLabel<LabelType>(other);
121 return *this;
122 }
123
130 constexpr const PointType& operator[](std::size_t index) const {
131 assert(index < size());
132 return points_[index];
133 }
134
135 constexpr PointType& operator[](std::size_t index) {
136 assert(index < size());
137 return points_[index];
138 }
139
143 static constexpr std::size_t size() {
144 return 2;
145 }
146
151 constexpr const PointType& get(std::ptrdiff_t index) const {
152 const std::ptrdiff_t n = static_cast<std::ptrdiff_t>(size());
153 return (*this)[static_cast<std::size_t>(((index % n) + n) % n)];
154 }
155 constexpr PointType& get(std::ptrdiff_t index) {
156 const std::ptrdiff_t n = static_cast<std::ptrdiff_t>(size());
157 return (*this)[static_cast<std::size_t>(((index % n) + n) % n)];
158 }
159
164 constexpr std::ptrdiff_t index(const PointType& point) const {
165 for (std::ptrdiff_t i = 0; i < static_cast<std::ptrdiff_t>(size()); ++i) {
166 if ((*this)[static_cast<std::size_t>(i)] == point) {
167 return i;
168 }
169 }
170 return -1;
171 }
172
178 constexpr const PointType& source() const {
179 return points_[0];
180 }
181 constexpr PointType& source() {
182 return points_[0];
183 }
184
190 constexpr const PointType& target() const {
191 return points_[1];
192 }
193 constexpr PointType& target() {
194 return points_[1];
195 }
196
202 constexpr const PointType& min() const {
203 return target() < source() ? target() : source();
204 }
205
211 constexpr const PointType& max() const {
212 return source() < target() ? target() : source();
213 }
214
220 constexpr OrientedSegment opposite() const {
221 return OrientedSegment(target(), source());
222 }
223
229 constexpr auto begin() const {
230 return points_.cbegin();
231 }
232 constexpr auto begin() {
233 return points_.begin();
234 }
235
241 constexpr auto cbegin() const {
242 return points_.cbegin();
243 }
244
250 constexpr auto end() const {
251 return points_.cend();
252 }
253 constexpr auto end() {
254 return points_.end();
255 }
256
262 constexpr auto cend() const {
263 return points_.cend();
264 }
265
272 constexpr bool operator==(const OrientedSegment& other) const {
273 return points_ == other.points_;
274 }
275
277 template<AnyShapeConcept OtherShape>
278 [[nodiscard]] constexpr bool samePointSet(const OtherShape& other) const;
279
288 constexpr auto operator<=>(const OrientedSegment& other) const {
289 return points_ <=> other.points_;
290 }
291
300 template <class A = LabelType>
301 requires(detail::has_label_v<A>)
302 constexpr A& label() const {
303 return label_;
304 }
305
313 [[nodiscard]] constexpr explicit operator Segment<PointType>() const {
314 return Segment(source(), target());
315 }
316
322 [[nodiscard]] constexpr Segment<PointType> asSegment() const {
323 return static_cast<Segment<PointType>>(*this);
324 }
325
331 [[nodiscard]] constexpr explicit operator OrientedLine<PointType>() const;
332
338 [[nodiscard]] constexpr OrientedLine<PointType> asOrientedLine() const {
339 return static_cast<OrientedLine<PointType>>(*this);
340 }
341
347 [[nodiscard]] constexpr Line<PointType> asLine() const {
348 return Line<PointType>(source(), target());
349 }
350
356 [[nodiscard]] constexpr explicit operator Ray<PointType>() const;
357
363 [[nodiscard]] constexpr Ray<PointType> asRay() const {
364 return static_cast<Ray<PointType>>(*this);
365 }
366
373 [[nodiscard]] constexpr OrientedSegment rotated90(int k = 1) const;
374
380 constexpr void rotate90(int k = 1);
381
383 template <class OtherNumber>
384 [[nodiscard]] constexpr OrientedSegment scaledUpX(const OtherNumber scalar) const;
385
387 template <class OtherNumber>
388 constexpr void scaleUpX(const OtherNumber scalar);
389
391 template <class OtherNumber>
392 [[nodiscard]] constexpr OrientedSegment scaledUpY(const OtherNumber scalar) const;
393
395 template <class OtherNumber>
396 constexpr void scaleUpY(const OtherNumber scalar);
397
399 template <class OtherNumber>
400 [[nodiscard]] constexpr OrientedSegment scaledDownX(const OtherNumber scalar) const;
401
403 template <class OtherNumber>
404 constexpr void scaleDownX(const OtherNumber scalar);
405
407 template <class OtherNumber>
408 [[nodiscard]] constexpr OrientedSegment scaledDownY(const OtherNumber scalar) const;
409
411 template <class OtherNumber>
412 constexpr void scaleDownY(const OtherNumber scalar);
413
419 [[nodiscard]] constexpr bool isDegenerate() const;
420
431 [[nodiscard]] constexpr bool isPoint() const;
432
440 [[nodiscard]] constexpr std::optional<PointType> getIfPoint() const;
441
454 [[nodiscard]] constexpr bool isUndefined() const;
455
461 [[nodiscard]] constexpr bool isVertical() const;
462
468 [[nodiscard]] constexpr bool isHorizontal() const;
469
478 template <class ResultNumber = NumberType>
479 [[nodiscard]] constexpr ResultNumber area() const;
480
488 [[nodiscard]] constexpr NumberType twiceArea() const;
489
495 [[nodiscard]] constexpr auto squaredLength() const;
496
503 template <class ApproximateNumber = double>
504 [[nodiscard]] ApproximateNumber length() const;
505
511 [[nodiscard]] constexpr auto lengthL1() const;
512
518 [[nodiscard]] constexpr auto lengthLInf() const;
519
528 template<PointConcept OtherPoint>
529 [[nodiscard]] constexpr bool verticesContain(const OtherPoint& point) const;
530
541 template<PointConcept OtherPoint>
542 [[nodiscard]] constexpr bool containsEndpoint(const OtherPoint& point) const;
543
554 template<PointConcept OtherPoint>
555 [[nodiscard]] constexpr bool boundaryContains(const OtherPoint& point) const;
556
557 // The boundary of an oriented segment is its two endpoints, a finite point
558 // set, so it contains no positive-length or two-dimensional shape.
560 template<SegmentConcept OtherSegment>
561 [[nodiscard]] constexpr bool boundaryContains(const OtherSegment& other) const {
562 return detail::reduceDegenerateToPoint(
563 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
564 }
565
566 template<OrientedSegmentConcept OtherOrientedSegment>
567 [[nodiscard]] constexpr bool boundaryContains(const OtherOrientedSegment& other) const {
568 return detail::reduceDegenerateToPoint(
569 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
570 }
571
572 template<LineConcept OtherLine>
573 [[nodiscard]] constexpr bool boundaryContains(const OtherLine&) const { return false; }
575 template<OrientedLineConcept OtherOrientedLine>
576 [[nodiscard]] constexpr bool boundaryContains(const OtherOrientedLine&) const { return false; }
578 template<RayConcept OtherRay>
579 [[nodiscard]] constexpr bool boundaryContains(const OtherRay&) const { return false; }
581 template<HalfplaneConcept OtherHalfplane>
582 [[nodiscard]] constexpr bool boundaryContains(const OtherHalfplane&) const { return false; }
584 template<RectangleConcept OtherRectangle>
585 [[nodiscard]] constexpr bool boundaryContains(const OtherRectangle& other) const {
586 return detail::reduceDegenerateToPoint(
587 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
588 }
589
590 template<TriangleConcept OtherTriangle>
591 [[nodiscard]] constexpr bool boundaryContains(const OtherTriangle& other) const {
592 return detail::reduceDegenerateToPoint(
593 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
594 }
595
596 template<ConvexConcept OtherConvex>
597 [[nodiscard]] constexpr bool boundaryContains(const OtherConvex& other) const {
598 return detail::reduceDegenerateToPoint(
599 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
600 }
601
602 template<PolygonConcept OtherPolygon>
603 [[nodiscard]] constexpr bool boundaryContains(const OtherPolygon& other) const {
604 return detail::reduceDegenerateToPoint(
605 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
606 }
607
608 template<DiskConcept OtherDisk>
609 [[nodiscard]] constexpr bool boundaryContains(const OtherDisk& other) const {
610 return detail::reduceDegenerateToPoint(
611 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
612 }
613
624 template<PointConcept OtherPoint>
625 [[nodiscard]] constexpr bool containsCollinear(const OtherPoint& point) const;
626
637 template<PointConcept OtherPoint>
638 [[nodiscard]] constexpr bool contains(const OtherPoint& point) const;
639
648 template<SegmentConcept OtherSegment>
649 [[nodiscard]] constexpr bool contains(const OtherSegment& other) const;
650
659 template<OrientedSegmentConcept OtherOrientedSegment>
660 [[nodiscard]] constexpr bool contains(const OtherOrientedSegment& other) const;
661
663 template<LineConcept OtherLine>
664 [[nodiscard]] constexpr bool contains(const OtherLine& other) const;
665
667 template<OrientedLineConcept OtherOrientedLine>
668 [[nodiscard]] constexpr bool contains(const OtherOrientedLine& other) const;
669
671 template<RayConcept OtherRay>
672 [[nodiscard]] constexpr bool contains(const OtherRay& other) const;
673
675 template<HalfplaneConcept OtherHalfplane>
676 [[nodiscard]] constexpr bool contains(const OtherHalfplane& other) const;
677
679 template<RectangleConcept OtherRectangle>
680 [[nodiscard]] constexpr bool contains(const OtherRectangle& other) const;
681
683 template<TriangleConcept OtherTriangle>
684 [[nodiscard]] constexpr bool contains(const OtherTriangle& other) const;
685
687 template<ConvexConcept OtherConvex>
688 [[nodiscard]] constexpr bool contains(const OtherConvex& other) const;
689
691 template<PolygonConcept OtherPolygon>
692 [[nodiscard]] constexpr bool contains(const OtherPolygon& other) const;
693
695 template<DiskConcept OtherDisk>
696 [[nodiscard]] constexpr bool contains(const OtherDisk& other) const;
697
699 [[nodiscard]] constexpr bool contains(const Shape<PointType>& other) const;
700
702 [[nodiscard]] constexpr bool boundaryContains(const Shape<PointType>& other) const;
703
704 // The empty set is a subset of every shape (contained in all of them) and
705 // disjoint from all of them, so containment is true while separation is
706 // false. These overloads let an EmptyShape flow through Shape's variant
707 // dispatch without special-casing.
709 template <class EmptyPoint>
710 [[nodiscard]] constexpr bool contains(const EmptyShape<EmptyPoint>&) const {
711 return true;
712 }
713
714 template <class EmptyPoint>
715 [[nodiscard]] constexpr bool boundaryContains(const EmptyShape<EmptyPoint>&) const {
716 return true;
717 }
718
719 template <class EmptyPoint>
720 [[nodiscard]] constexpr bool interiorContains(const EmptyShape<EmptyPoint>&) const {
721 return true;
722 }
723
724 template <class EmptyPoint>
725 [[nodiscard]] constexpr bool separates(const EmptyShape<EmptyPoint>&) const {
726 return false;
727 }
728
730 template<PointConcept OtherPoint>
731 [[nodiscard]] constexpr bool interiorContains(const OtherPoint& point) const;
732
734 template<SegmentConcept OtherSegment>
735 [[nodiscard]] constexpr bool interiorContains(const OtherSegment& other) const;
736
738 template<OrientedSegmentConcept OtherOrientedSegment>
739 [[nodiscard]] constexpr bool interiorContains(const OtherOrientedSegment& other) const;
740
742 template<LineConcept OtherLine>
743 [[nodiscard]] constexpr bool interiorContains(const OtherLine& other) const;
744
746 template<OrientedLineConcept OtherOrientedLine>
747 [[nodiscard]] constexpr bool interiorContains(const OtherOrientedLine& other) const;
748
750 template<RayConcept OtherRay>
751 [[nodiscard]] constexpr bool interiorContains(const OtherRay& other) const;
752
754 template<HalfplaneConcept OtherHalfplane>
755 [[nodiscard]] constexpr bool interiorContains(const OtherHalfplane& other) const;
756
758 template<RectangleConcept OtherRectangle>
759 [[nodiscard]] constexpr bool interiorContains(const OtherRectangle& other) const;
760
762 template<TriangleConcept OtherTriangle>
763 [[nodiscard]] constexpr bool interiorContains(const OtherTriangle& other) const;
764
766 template<PointConcept OtherPoint>
767 [[nodiscard]] constexpr bool collinear(const OtherPoint& point) const;
768
770 template<SegmentConcept OtherSegment>
771 [[nodiscard]] constexpr bool collinear(const OtherSegment& other) const;
772
774 template<OrientedSegmentConcept OtherOrientedSegment>
775 [[nodiscard]] constexpr bool collinear(const OtherOrientedSegment& other) const;
776
778 template<LineConcept OtherLine>
779 [[nodiscard]] constexpr bool collinear(const OtherLine& other) const;
780
782 template<OrientedLineConcept OtherOrientedLine>
783 [[nodiscard]] constexpr bool collinear(const OtherOrientedLine& other) const;
784
786 template<RayConcept OtherRay>
787 [[nodiscard]] constexpr bool collinear(const OtherRay& other) const;
788
800 template<PointConcept OtherPoint>
801 [[nodiscard]] constexpr std::partial_ordering orientation(const OtherPoint& point) const;
802
811 template <class ResultNumber = division_result_t<NumberType>>
812 [[nodiscard]] constexpr ResultNumber slope() const;
813
819 [[nodiscard]] constexpr Halfplane<PointType> rightHalfplane() const;
820
826 [[nodiscard]] constexpr Halfplane<PointType> leftHalfplane() const;
827
829 template<SegmentConcept OtherSegment>
830 [[nodiscard]] constexpr bool parallel(const OtherSegment& other) const;
831
833 template<OrientedSegmentConcept OtherOrientedSegment>
834 [[nodiscard]] constexpr bool parallel(const OtherOrientedSegment& other) const;
835
837 template<LineConcept OtherLine>
838 [[nodiscard]] constexpr bool parallel(const OtherLine& other) const;
839
841 template<OrientedLineConcept OtherOrientedLine>
842 [[nodiscard]] constexpr bool parallel(const OtherOrientedLine& other) const;
843
845 template<RayConcept OtherRay>
846 [[nodiscard]] constexpr bool parallel(const OtherRay& other) const;
847
849 template<PointConcept OtherPoint>
850 [[nodiscard]] constexpr bool intersects(const OtherPoint& other) const;
851
860 template<SegmentConcept OtherSegment>
861 [[nodiscard]] constexpr bool intersects(const OtherSegment& other) const;
862
871 template<OrientedSegmentConcept OtherOrientedSegment>
872 [[nodiscard]] constexpr bool intersects(const OtherOrientedSegment& other) const;
873
875 [[nodiscard]] constexpr bool intersects(const Shape<PointType>& other) const;
876
878 template<typename OtherShape>
879 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
880 [[nodiscard]] constexpr bool intersects(const OtherShape& other) const {
881 return other.intersects(*this);
882 }
883
885 template <class EmptyPoint>
886 [[nodiscard]] constexpr bool intersects(const EmptyShape<EmptyPoint>&) const {
887 return false;
888 }
889
899 template <class ResultNumber = NumberType, PointConcept OtherPoint>
900 [[nodiscard]] constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
901 intersection(const OtherPoint& other) const;
902
904 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
905 [[nodiscard]] constexpr auto intersection(const OtherSegment& other) const;
906
917 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
918 [[nodiscard]] constexpr auto intersection(const OtherOrientedSegment& other) const;
919
921 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
922 requires (!PointConcept<OtherShape>
923 && (detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
924 && requires(const OtherShape& o, const OrientedSegment& self) {
925 o.template intersection<ResultNumber>(self);
926 })
927 [[nodiscard]] constexpr auto intersection(const OtherShape& other) const {
928 return other.template intersection<ResultNumber>(*this);
929 }
930
932 template <class ResultNumber = NumberType, class EmptyPoint>
933 [[nodiscard]] constexpr EmptyShape<EmptyPoint> intersection(const EmptyShape<EmptyPoint>&) const {
934 return {};
935 }
936
948 template <class ResultNumber = division_result_t<NumberType>, class OtherNumber>
949 [[nodiscard]] constexpr std::optional<ResultNumber>
950 yAtX(const OtherNumber &x) const;
951
963 template <class ResultNumber = division_result_t<NumberType>, class OtherNumber>
964 [[nodiscard]] constexpr std::optional<ResultNumber>
965 xAtY(const OtherNumber &y) const;
966
975 template<PointConcept OtherPoint>
976 [[nodiscard]] constexpr bool separates(const OtherPoint& other) const;
977
979 template<SegmentConcept OtherSegment>
980 [[nodiscard]] constexpr bool separates(const OtherSegment& other) const;
981
990 template<OrientedSegmentConcept OtherOrientedSegment>
991 [[nodiscard]] constexpr bool separates(const OtherOrientedSegment& other) const;
992
994 template<LineConcept OtherLine>
995 [[nodiscard]] constexpr bool separates(const OtherLine& other) const;
996
998 template<OrientedLineConcept OtherOrientedLine>
999 [[nodiscard]] constexpr bool separates(const OtherOrientedLine& other) const;
1000
1002 template<RayConcept OtherRay>
1003 [[nodiscard]] constexpr bool separates(const OtherRay& other) const;
1004
1006 template<RectangleConcept OtherRectangle>
1007 [[nodiscard]] constexpr bool separates(const OtherRectangle& other) const;
1008
1010 template<TriangleConcept OtherTriangle>
1011 [[nodiscard]] constexpr bool separates(const OtherTriangle& other) const;
1012
1014 template<HalfplaneConcept OtherHalfplane>
1015 [[nodiscard]] constexpr bool separates(const OtherHalfplane& other) const;
1016
1018 template<ConvexConcept OtherConvex>
1019 [[nodiscard]] constexpr bool separates(const OtherConvex& other) const;
1020
1022 template<PolygonConcept OtherPolygon>
1023 [[nodiscard]] constexpr bool separates(const OtherPolygon& other) const;
1024
1026 template<MonotoneChainConcept OtherChain>
1027 [[nodiscard]] constexpr bool contains(const OtherChain& other) const;
1028
1030 template<MonotoneChainConcept OtherChain>
1031 [[nodiscard]] constexpr bool boundaryContains(const OtherChain& other) const {
1032 return detail::reduceDegenerateToPoint(
1033 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
1034 }
1035
1037 template<MonotoneChainConcept OtherChain>
1038 [[nodiscard]] constexpr bool interiorContains(const OtherChain& other) const;
1039
1041 template<MonotoneChainConcept OtherChain>
1042 [[nodiscard]] constexpr bool separates(const OtherChain& other) const;
1043
1045 template<PolylineConcept OtherPolyline>
1046 [[nodiscard]] constexpr bool contains(const OtherPolyline& other) const;
1047
1049 template<PolylineConcept OtherPolyline>
1050 [[nodiscard]] constexpr bool boundaryContains(const OtherPolyline& other) const {
1051 return detail::reduceDegenerateToPoint(
1052 other, [this](const auto& vertex) { return this->boundaryContains(vertex); });
1053 }
1054
1056 template<PolylineConcept OtherPolyline>
1057 [[nodiscard]] constexpr bool interiorContains(const OtherPolyline& other) const;
1058
1060 template<PolylineConcept OtherPolyline>
1061 [[nodiscard]] constexpr bool separates(const OtherPolyline& other) const;
1062
1064 template<HalfplaneIntersectionConcept OtherRegion>
1065 [[nodiscard]] constexpr bool contains(const OtherRegion& other) const;
1066
1068 template<HalfplaneIntersectionConcept OtherRegion>
1069 [[nodiscard]] constexpr bool boundaryContains(const OtherRegion& other) const;
1070
1072 template<HalfplaneIntersectionConcept OtherRegion>
1073 [[nodiscard]] constexpr bool interiorContains(const OtherRegion& other) const;
1074
1076 template<HalfplaneIntersectionConcept OtherRegion>
1077 [[nodiscard]] constexpr bool separates(const OtherRegion& other) const;
1078
1086 template<PolygonWithHolesConcept OtherRegion>
1087 [[nodiscard]] constexpr bool contains(const OtherRegion& other) const;
1088
1095 template<PolygonWithHolesConcept OtherRegion>
1096 [[nodiscard]] constexpr bool boundaryContains(const OtherRegion& other) const;
1097
1099 template<PolygonWithHolesConcept OtherRegion>
1100 [[nodiscard]] constexpr bool interiorContains(const OtherRegion& other) const;
1101
1109 template<PolygonWithHolesConcept OtherRegion>
1110 [[nodiscard]] bool separates(const OtherRegion& other) const;
1111
1112 // -------------------------------------------------------------------------
1113 // A set of regions
1114 //
1115 // It outranks every other shape, so the symmetric relations reach it through
1116 // the rank-based forwarders and only the asymmetric ones are answered here.
1117 // A set is the union of its components, so it is contained exactly when
1118 // every component is — no matter what this shape is.
1119
1121 template<PolygonSetConcept OtherSet>
1122 [[nodiscard]] constexpr bool contains(const OtherSet& other) const {
1123 for (const auto& component : other) {
1124 if (!contains(component)) {
1125 return false;
1126 }
1127 }
1128 return true;
1129 }
1130
1132 template<PolygonSetConcept OtherSet>
1133 [[nodiscard]] constexpr bool boundaryContains(const OtherSet& other) const {
1134 for (const auto& component : other) {
1135 if (!boundaryContains(component)) {
1136 return false;
1137 }
1138 }
1139 return true;
1140 }
1141
1143 template<PolygonSetConcept OtherSet>
1144 [[nodiscard]] constexpr bool interiorContains(const OtherSet& other) const {
1145 for (const auto& component : other) {
1146 if (!interiorContains(component)) {
1147 return false;
1148 }
1149 }
1150 return true;
1151 }
1152
1161 template<PolygonSetConcept OtherSet>
1162 [[nodiscard]] bool separates(const OtherSet& other) const;
1163
1165 template<DiskConcept OtherDisk>
1166 [[nodiscard]] constexpr bool separates(const OtherDisk& other) const;
1167
1169 [[nodiscard]] constexpr bool separates(const Shape<PointType>& other) const;
1170
1171 // --- not-yet-implemented predicate pairs (throw); see implementation ---
1173 template<DiskConcept OtherDisk>
1174 [[nodiscard]] constexpr bool interiorContains(const OtherDisk& other) const;
1175
1177 template<ConvexConcept OtherConvex>
1178 [[nodiscard]] constexpr bool interiorContains(const OtherConvex& other) const;
1179
1181 template<PolygonConcept OtherPolygon>
1182 [[nodiscard]] constexpr bool interiorContains(const OtherPolygon& other) const;
1183
1184
1193 template<PointConcept OtherPoint>
1194 [[nodiscard]] constexpr bool interiorsIntersect(const OtherPoint& other) const;
1195
1197 template<SegmentConcept OtherSegment>
1198 [[nodiscard]] constexpr bool interiorsIntersect(const OtherSegment& other) const;
1199
1208 template<OrientedSegmentConcept OtherOrientedSegment>
1209 [[nodiscard]] constexpr bool interiorsIntersect(const OtherOrientedSegment& other) const;
1210
1212 template<typename OtherShape>
1213 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1214 [[nodiscard]] constexpr bool interiorsIntersect(const OtherShape& other) const {
1215 return other.interiorsIntersect(*this);
1216 }
1217
1219 template <class EmptyPoint>
1220 [[nodiscard]] constexpr bool interiorsIntersect(const EmptyShape<EmptyPoint>&) const {
1221 return false;
1222 }
1223
1225 [[nodiscard]] constexpr bool interiorsIntersect(const Shape<PointType>& other) const;
1226
1235 template<SegmentConcept OtherSegment>
1236 [[nodiscard]] constexpr bool crosses(const OtherSegment& other) const;
1237
1246 template<OrientedSegmentConcept OtherOrientedSegment>
1247 [[nodiscard]] constexpr bool crosses(const OtherOrientedSegment& other) const;
1248
1250 template<PointConcept OtherPoint>
1251 [[nodiscard]] constexpr bool crosses(const OtherPoint& other) const;
1252
1254 template<typename OtherShape>
1255 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1256 [[nodiscard]] constexpr bool crosses(const OtherShape& other) const {
1257 return other.crosses(*this);
1258 }
1259
1261 template <class EmptyPoint>
1262 [[nodiscard]] constexpr bool crosses(const EmptyShape<EmptyPoint>&) const {
1263 return false;
1264 }
1265
1267 [[nodiscard]] constexpr bool crosses(const Shape<PointType>& other) const;
1268
1284 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1285 [[nodiscard]] constexpr auto squaredDistance(const OtherPoint& point) const;
1286
1302 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1303 [[nodiscard]] constexpr auto squaredDistance(const OtherSegment& other) const;
1304
1320 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1321 [[nodiscard]] constexpr auto squaredDistance(const OtherOrientedSegment& other) const;
1322
1329 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1330 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1331 && requires(const OtherShape& o, const OrientedSegment& self) {
1332 o.template squaredDistance<ResultNumber>(self);
1333 })
1334 [[nodiscard]] constexpr auto squaredDistance(const OtherShape& other) const {
1335 return other.template squaredDistance<ResultNumber>(*this);
1336 }
1337
1345 template <class ResultNumber = double, class DiskPointType, class DiskLabel>
1346 [[nodiscard]] detail::floating_result_t<ResultNumber> squaredDistance(const Disk<DiskPointType, DiskLabel>& disk) const {
1347 return disk.template squaredDistance<ResultNumber>(*this);
1348 }
1349
1362 template <class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
1363 requires detail::ClosestPairConcept<OrientedSegment<PointType_, TLabel>, OtherShape>
1364 [[nodiscard]] constexpr auto closestSegments(const OtherShape& other) const;
1365
1382 template <class ResultNumber = division_result_t<NumberType>, class OtherShape>
1383 requires detail::ClosestPointsPairConcept<OrientedSegment<PointType_, TLabel>, OtherShape>
1384 [[nodiscard]] constexpr auto closestPoints(const OtherShape& other) const;
1385
1387 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1388 [[nodiscard]] constexpr auto distanceL1(const OtherPoint& point) const;
1389
1391 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1392 [[nodiscard]] constexpr auto distanceL1(const OtherSegment& other) const;
1393
1395 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1396 [[nodiscard]] constexpr auto distanceL1(const OtherOrientedSegment& other) const;
1397
1404 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1405 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1406 && requires(const OtherShape& o, const OrientedSegment& self) {
1407 o.template distanceL1<ResultNumber>(self);
1408 })
1409 [[nodiscard]] constexpr auto distanceL1(const OtherShape& other) const {
1410 return other.template distanceL1<ResultNumber>(*this);
1411 }
1412
1428 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1429 [[nodiscard]] constexpr auto intersection(const Shape<OtherPoint>& other) const {
1430 return other.template intersection<ResultNumber>(*this);
1431 }
1432
1441 template <class ResultNumber = double, PointConcept OtherPoint>
1442 [[nodiscard]] constexpr auto distanceL1(const Shape<OtherPoint>& other) const {
1443 return other.template distanceL1<ResultNumber>(*this);
1444 }
1445
1447 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1448 [[nodiscard]] constexpr auto distanceLInf(const OtherPoint& point) const;
1449
1451 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1452 [[nodiscard]] constexpr auto distanceLInf(const OtherSegment& other) const;
1453
1455 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1456 [[nodiscard]] constexpr auto distanceLInf(const OtherOrientedSegment& other) const;
1457
1464 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1465 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1466 && requires(const OtherShape& o, const OrientedSegment& self) {
1467 o.template distanceLInf<ResultNumber>(self);
1468 })
1469 [[nodiscard]] constexpr auto distanceLInf(const OtherShape& other) const {
1470 return other.template distanceLInf<ResultNumber>(*this);
1471 }
1472
1481 template <class ResultNumber = double, PointConcept OtherPoint>
1482 [[nodiscard]] constexpr auto distanceLInf(const Shape<OtherPoint>& other) const {
1483 return other.template distanceLInf<ResultNumber>(*this);
1484 }
1485
1487 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1488 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherSegment& other) const;
1489
1491 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1492 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherOrientedSegment& other) const;
1493
1495 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1496 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherPoint& point) const;
1497
1504 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1505 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1506 && requires(const OtherShape& o, const OrientedSegment& self) {
1507 o.template hausdorffDistanceL1<ResultNumber>(self);
1508 })
1509 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherShape& other) const {
1510 return other.template hausdorffDistanceL1<ResultNumber>(*this);
1511 }
1512
1521 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1522 [[nodiscard]] constexpr auto hausdorffDistanceL1(const Shape<OtherPoint>& other) const {
1523 return other.template hausdorffDistanceL1<ResultNumber>(*this);
1524 }
1525
1527 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1528 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherSegment& other) const;
1529
1531 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1532 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherOrientedSegment& other) const;
1533
1535 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1536 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherPoint& point) const;
1537
1544 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1545 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1546 && requires(const OtherShape& o, const OrientedSegment& self) {
1547 o.template hausdorffDistanceLInf<ResultNumber>(self);
1548 })
1549 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherShape& other) const {
1550 return other.template hausdorffDistanceLInf<ResultNumber>(*this);
1551 }
1552
1561 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1562 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const Shape<OtherPoint>& other) const {
1563 return other.template hausdorffDistanceLInf<ResultNumber>(*this);
1564 }
1565
1581 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1582 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherSegment& other) const;
1583
1599 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1600 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherOrientedSegment& other) const;
1601
1610 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1611 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherPoint& point) const;
1612
1619 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1620 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1621 && requires(const OtherShape& o, const OrientedSegment& self) {
1623 })
1624 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherShape& other) const {
1625 return other.template squaredHausdorffDistance<ResultNumber>(*this);
1626 }
1627
1633 [[nodiscard]] constexpr Segment<PointType> diameter() const;
1634
1649 template <class ResultNumber = grid_number_t<typename PointType_::NumberType>>
1650 requires(detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
1653
1659 [[nodiscard]] constexpr Rectangle<PointType> bbox() const;
1660
1667 template <std::floating_point ResultNumber = double>
1668 [[nodiscard]] constexpr Rectangle<Point<ResultNumber>> fbox() const;
1669
1675 [[nodiscard]] constexpr std::array<PointType, 2> vertices() const;
1676
1682 [[nodiscard]] constexpr Convex<PointType> convexHull() const {
1683 return Convex<PointType>(vertices());
1684 }
1685
1691 [[nodiscard]] constexpr std::array<Segment<PointType>, 1> edges() const;
1692
1698 [[nodiscard]] constexpr std::array<OrientedSegment, 1> orientedEdges() const;
1699
1707 template <class ResultNumber = division_result_t<NumberType>>
1708 [[nodiscard]] constexpr Point<ResultNumber> midpoint() const;
1709
1719 template <class ResultNumber = division_result_t<NumberType>>
1720 [[nodiscard]] constexpr Point<ResultNumber> pointInside() const;
1721
1730 template <class OtherShape>
1731 [[nodiscard]] constexpr bool pointInsideInteriorContainedIn(const OtherShape& shape) const;
1732
1746 template <class OtherShape>
1748 [[nodiscard]] constexpr auto minkowskiSum(const OtherShape& other) const;
1749
1772 template <class OtherShape>
1774 [[nodiscard]] constexpr auto minkowskiErosion(const OtherShape& other) const;
1775
1798 template <class OtherShape>
1801 [[nodiscard]] constexpr auto minkowskiErosion(const OtherShape& other) const;
1802
1813 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1815 && (detail::shapeRank<OtherShape> > detail::shapeRank<OrientedSegment>)
1816 && requires(const OtherShape& o, const OrientedSegment& self) {
1817 o.template minkowskiSum<ResultNumber>(self);
1818 })
1819 [[nodiscard]] auto minkowskiSum(const OtherShape& other) const {
1820 return other.template minkowskiSum<ResultNumber>(*this);
1821 }
1822
1824 template<PointConcept OtherPoint>
1825 constexpr OrientedSegment& operator+=(const OtherPoint& translation);
1826
1828 template<PointConcept OtherPoint>
1829 constexpr OrientedSegment& operator-=(const OtherPoint& translation);
1830
1832 template <class Scalar>
1833 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1834 constexpr OrientedSegment& operator*=(const Scalar& scalar);
1835
1837 template <class Scalar>
1838 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1839 constexpr OrientedSegment& operator/=(const Scalar& scalar);
1840
1841 public:
1842 std::array<PointType, 2> points_{};
1843 [[no_unique_address]] mutable LabelType label_{};
1844};
1845
1857template <class PointType, class LabelType, class TranslationNumber, class TranslationLabel>
1858constexpr auto operator-(const OrientedSegment<PointType, LabelType>& segment, const Point<TranslationNumber, TranslationLabel>& translation);
1859
1870template <class PointType, class LabelType, class Scalar>
1871 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1872constexpr auto operator*(const OrientedSegment<PointType, LabelType>& segment, const Scalar& scalar);
1873
1884template <class Scalar, class PointType, class LabelType>
1885 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1886constexpr auto operator*(const Scalar& scalar, const OrientedSegment<PointType, LabelType>& segment);
1887
1898template <class PointType, class LabelType, class Scalar>
1899 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1900constexpr auto operator/(const OrientedSegment<PointType, LabelType>& segment, const Scalar& scalar);
1901
1911template <class PointType, class LabelType>
1912std::ostream& operator<<(std::ostream& stream, const OrientedSegment<PointType, LabelType>& segment);
1913
1914} // namespace pgl
1915
1916#include "halfplane.hpp"
Bounded polygonal primitives, convex or not.
Definition forward.hpp:373
Shape pairs whose Minkowski sum Pangolin can represent.
Definition forward.hpp:476
Definition forward.hpp:306
Definition forward.hpp:324
Public declaration of pgl::Halfplane.
Definition arrangement.hpp:67
@ y
Definition intervaltree.hpp:24
@ x
Definition intervaltree.hpp:24
@ vertex
Definition bitmatrix.hpp:37
Line() -> Line< Point<>, NoLabel >
Point() -> Point< int >
constexpr auto operator-(const Point< LeftNumber, LeftLabel > &left, const Point< RightNumber, RightLabel > &right)
Translates a point by the opposite of another point.
Definition transformations.hpp:130
OrientedSegment() -> OrientedSegment< Point<>, NoLabel >
std::ostream & operator<<(std::ostream &stream, const Point< Number, Label > &point)
Streams a point as (x,y) or label:(x,y).
Definition io.hpp:27
Segment() -> Segment< Point<>, NoLabel >
Ray() -> Ray< Point<>, NoLabel >
OrientedLine() -> OrientedLine< Point<>, NoLabel >
Public declaration of pgl::Segment.
Closed convex polygon stored by its vertices.
Definition convex.hpp:170
Closed Euclidean disk stored by boundary points plus optional disk label.
Definition disk.hpp:66
The empty set of points in the plane.
Definition emptyshape.hpp:33
Closed half-plane defined by an oriented boundary line.
Definition halfplane.hpp:51
Unoriented infinite line.
Definition line.hpp:52
Sentinel type used when a point carries no extra label.
Definition point.hpp:31
Directed infinite line with left/right side semantics plus optional line label.
Definition orientedline.hpp:53
Directed segment preserving source-to-target order plus optional segment label.
Definition orientedsegment.hpp:44
ApproximateNumber length() const
Returns the Euclidean length.
Definition measures.hpp:125
constexpr bool intersects(const OtherSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:284
PointType::NumberType NumberType
Definition orientedsegment.hpp:46
constexpr bool intersects(const Shape< PointType > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:296
constexpr bool boundaryContains(const OtherRectangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:585
constexpr const PointType & operator[](std::size_t index) const
Returns endpoint 0 for the source and 1 for the target.
Definition orientedsegment.hpp:130
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5921
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
constexpr void rotate90(int k=1)
Rotates the segment by 90k degrees around the origin in place.
Definition transformations.hpp:369
constexpr OrientedSegment(NumberType x1, NumberType y1, NumberType x2, NumberType y2)
Creates an oriented segment from four coordinates.
Definition orientedsegment.hpp:75
constexpr bool boundaryContains(const OtherSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:561
constexpr bool pointInsideInteriorContainedIn(const OtherShape &shape) const
Tests whether some point in this shape's relative interior lies in the strict interior of shape.
Definition measures.hpp:168
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:1953
constexpr std::array< OrientedSegment, 1 > orientedEdges() const
Returns the unique oriented edge of the oriented segment.
Definition bounding.hpp:132
constexpr std::ptrdiff_t index(const PointType &point) const
Definition orientedsegment.hpp:164
constexpr auto lengthL1() const
Returns the Manhattan length.
Definition measures.hpp:130
constexpr bool contains(const OtherOrientedLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:370
constexpr bool boundaryContains(const OtherPolygon &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:603
constexpr bool interiorsIntersect(const OtherPoint &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:295
constexpr PointType & source()
Definition orientedsegment.hpp:181
constexpr Halfplane< PointType > rightHalfplane() const
Returns the half-plane on the right of the segment direction.
Definition predicates.hpp:407
constexpr auto squaredHausdorffDistance(const OtherShape &other) const
Returns the squared Hausdorff distance to the given shape.
Definition orientedsegment.hpp:1624
constexpr bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:767
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:294
std::array< PointType, 2 > points_
Definition orientedsegment.hpp:1842
constexpr auto distanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:241
constexpr auto hausdorffDistanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:988
constexpr const PointType & min() const
Returns the lexicographically smallest endpoint.
Definition orientedsegment.hpp:202
constexpr bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:715
constexpr bool crosses(const OtherSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:178
constexpr auto distanceL1(const OtherShape &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition orientedsegment.hpp:1409
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether one endpoint equals the given point.
Definition predicates.hpp:315
constexpr auto hausdorffDistanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:975
constexpr bool containsEndpoint(const OtherPoint &point) const
Returns whether the given point is one endpoint.
Definition predicates.hpp:321
constexpr Rectangle< PointType > bbox() const
Returns the bounding box of the oriented segment.
Definition bounding.hpp:111
constexpr bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:773
constexpr PointType & get(std::ptrdiff_t index)
Definition orientedsegment.hpp:155
constexpr void scaleUpX(const OtherNumber scalar)
Multiplies the segment's x-coordinates by a factor in place.
Definition transformations.hpp:382
constexpr ResultNumber slope() const
Returns the slope of the segment.
Definition measures.hpp:141
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition orientedsegment.hpp:1214
constexpr const PointType & source() const
Definition orientedsegment.hpp:178
constexpr bool interiorsIntersect(const OtherSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:301
constexpr bool contains(const Shape< PointType > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:416
constexpr Rectangle< Point< ResultNumber > > fbox() const
Returns a bounding box of the oriented segment with floating point coordinates.
Definition bounding.hpp:117
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1226
constexpr bool boundaryContains(const OtherPoint &point) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:216
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1232
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2057
constexpr OrientedLine< PointType > asOrientedLine() const
Returns the oriented supporting line.
Definition orientedsegment.hpp:338
auto minkowskiSum(const OtherShape &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
Definition orientedsegment.hpp:1819
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition orientedsegment.hpp:1220
constexpr auto hausdorffDistanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:969
constexpr bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3155
constexpr bool boundaryContains(const OtherConvex &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:597
constexpr auto operator<=>(const OrientedSegment &other) const
Provides lexicographic ordering on (source, target).
Definition orientedsegment.hpp:288
constexpr bool collinear(const OtherOrientedLine &other) const
Returns whether the given oriented line is collinear with the oriented segment.
Definition predicates.hpp:360
constexpr OrientedSegment rotated90(int k=1) const
Returns the segment rotated by 90k degrees around the origin.
Definition transformations.hpp:364
constexpr auto cbegin() const
Returns an iterator to the source endpoint.
Definition orientedsegment.hpp:241
constexpr auto lengthLInf() const
Returns the Chebyshev length.
Definition measures.hpp:135
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:358
constexpr auto distanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:247
constexpr Convex< PointType > convexHull() const
Returns the convex hull of the segment's endpoints.
Definition orientedsegment.hpp:1682
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.
Definition intersection.hpp:180
constexpr auto distanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:247
constexpr bool isUndefined() const
Returns whether the segment is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:299
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:715
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2015
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1650
constexpr auto end()
Definition orientedsegment.hpp:253
constexpr auto squaredDistance(const OtherOrientedSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:190
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:252
constexpr bool interiorContains(const OtherOrientedLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:264
static constexpr std::size_t size()
Returns the number of endpoints (always 2).
Definition orientedsegment.hpp:143
detail::floating_result_t< ResultNumber > squaredDistance(const Disk< DiskPointType, DiskLabel > &disk) const
Returns the squared Euclidean distance to a disk.
Definition orientedsegment.hpp:1346
constexpr auto squaredHausdorffDistance(const OtherSegment &other) const
Returns the squared Hausdorff distance to another unordered segment.
Definition distance.hpp:197
constexpr bool collinear(const OtherSegment &other) const
Returns whether the given segment is collinear with the oriented segment.
Definition predicates.hpp:342
constexpr bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1997
constexpr bool crosses(const Shape< PointType > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:195
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:795
constexpr bool boundaryContains(const OtherOrientedLine &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:576
constexpr bool isDegenerate() const
Returns whether both endpoints coincide.
Definition predicates.hpp:281
constexpr PointType & target()
Definition orientedsegment.hpp:193
constexpr const PointType & max() const
Returns the lexicographically largest endpoint.
Definition orientedsegment.hpp:211
constexpr std::partial_ordering orientation(const OtherPoint &point) const
Returns the orientation sign of a point with respect to the segment.
Definition predicates.hpp:372
constexpr OrientedSegment scaledDownY(const OtherNumber scalar) const
Returns the segment with its y-coordinates divided by a divisor.
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:405
constexpr A & label() const
Definition orientedsegment.hpp:302
constexpr OrientedSegment & operator+=(const OtherPoint &translation)
Translates the oriented segment by the given point in place.
constexpr bool interiorContains(const OtherHalfplane &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:276
constexpr bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:739
constexpr std::optional< PointType > getIfPoint() const
Returns the point the segment collapses to, if it does.
Definition predicates.hpp:291
constexpr Point< ResultNumber > pointInside() const
Returns a point inside the segment.
Definition measures.hpp:162
constexpr bool boundaryContains(const OtherChain &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:1031
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 dist...
Definition orientedsegment.hpp:1442
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition orientedsegment.hpp:933
constexpr OrientedSegment(PointType source, PointType target)
Creates an oriented segment from a source and target.
Definition orientedsegment.hpp:64
constexpr ResultNumber area() const
Returns the area of the segment.
Definition measures.hpp:109
constexpr auto begin() const
Returns an iterator to the source endpoint.
Definition orientedsegment.hpp:229
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool crosses(const OtherOrientedSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:184
constexpr bool separates(const EmptyShape< EmptyPoint > &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition orientedsegment.hpp:725
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition orientedsegment.hpp:710
constexpr bool isPoint() const
Returns whether the segment collapses to a single point.
Definition predicates.hpp:286
constexpr bool intersects(const OtherOrientedSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:290
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr bool boundaryContains(const OtherPolyline &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:1050
constexpr auto intersection(const OtherShape &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition orientedsegment.hpp:927
constexpr bool interiorContains(const OtherSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:246
constexpr const PointType & target() const
Definition orientedsegment.hpp:190
constexpr void scaleDownX(const OtherNumber scalar)
Divides the segment's x-coordinates by a divisor in place.
Definition transformations.hpp:408
constexpr auto end() const
Returns an iterator past the target endpoint.
Definition orientedsegment.hpp:250
constexpr auto squaredHausdorffDistance(const OtherOrientedSegment &other) const
Returns the squared Hausdorff distance to another oriented segment.
Definition distance.hpp:203
constexpr bool isVertical() const
Returns whether the segment is vertical.
Definition predicates.hpp:304
constexpr bool parallel(const OtherLine &other) const
Returns whether the given line is parallel to the oriented segment.
Definition predicates.hpp:390
constexpr auto distanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:253
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints() const
Returns the integer points the oriented segment contains.
Definition lattice.hpp:508
constexpr bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4585
constexpr bool collinear(const OtherRay &other) const
Returns whether the given ray is collinear with the oriented segment.
Definition predicates.hpp:366
constexpr auto hausdorffDistanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:981
constexpr const PointType & get(std::ptrdiff_t index) const
Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the en...
Definition orientedsegment.hpp:151
constexpr bool parallel(const OtherOrientedLine &other) const
Returns whether the given oriented line is parallel to the oriented segment.
Definition predicates.hpp:396
constexpr auto intersection(const Shape< OtherPoint > &other) const
Returns the intersection of the two shapes (A ∩ B), re-dispatching through the wrapper's own intersec...
Definition orientedsegment.hpp:1429
constexpr auto distanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition orientedsegment.hpp:1469
constexpr bool boundaryContains(const OtherRay &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:579
constexpr Segment< PointType > asSegment() const
Returns the segment without orientation.
Definition orientedsegment.hpp:322
constexpr bool boundaryContains(const OtherDisk &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:609
constexpr Halfplane< PointType > leftHalfplane() const
Returns the half-plane on the left of the segment direction.
Definition predicates.hpp:412
TLabel LabelType
Definition orientedsegment.hpp:47
constexpr bool operator==(const OrientedSegment &other) const
Compares two oriented segments by their endpoints; the label is ignored.
Definition orientedsegment.hpp:272
constexpr NumberType twiceArea() const
Returns twice the area of the segment.
Definition measures.hpp:114
constexpr bool contains(const OtherHalfplane &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:382
constexpr bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:721
constexpr std::array< Segment< PointType >, 1 > edges() const
Returns the unique geometric edge of the oriented segment.
Definition bounding.hpp:127
constexpr OrientedSegment & operator-=(const OtherPoint &translation)
Translates the oriented segment by the negation of the given point in place.
constexpr bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:745
constexpr std::optional< ResultNumber > yAtX(const OtherNumber &x) const
Returns the value of the y coordinate for a given x, if it exists.
Definition atxy.hpp:95
constexpr bool crosses(const OtherPoint &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:190
constexpr auto distanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:235
constexpr auto cend() const
Returns an iterator past the target endpoint.
Definition orientedsegment.hpp:262
PointType PointType
Definition orientedsegment.hpp:45
constexpr auto squaredLength() const
Returns the squared Euclidean length.
Definition measures.hpp:119
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition orientedsegment.hpp:1262
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:411
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition orientedsegment.hpp:1144
constexpr bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:755
constexpr PointType & operator[](std::size_t index)
Returns endpoint 0 for the source and 1 for the target.
Definition orientedsegment.hpp:135
constexpr bool interiorContains(const OtherLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:258
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:388
constexpr bool boundaryContains(const OtherOrientedSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:567
constexpr Point< ResultNumber > midpoint() const
Returns the midpoint of the segment.
Definition measures.hpp:154
constexpr bool collinear(const OtherOrientedSegment &other) const
Returns whether another oriented segment is collinear with this oriented segment.
Definition predicates.hpp:348
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition orientedsegment.hpp:1256
constexpr auto closestSegments(const OtherShape &other) const
Returns the pair of elements realizing the distance, nothing when the shapes meet.
Definition closest.hpp:328
constexpr bool collinear(const OtherLine &other) const
Returns whether the given line is collinear with the oriented segment.
Definition predicates.hpp:354
LabelType label_
Definition orientedsegment.hpp:1843
constexpr bool interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:282
constexpr std::array< PointType, 2 > vertices() const
Returns the two endpoints in source-to-target order.
Definition bounding.hpp:122
constexpr bool boundaryContains(const Shape< PointType > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1089
constexpr auto closestPoints(const OtherShape &other) const
Returns the pair of points realizing the distance, nothing when the shapes meet.
Definition closest.hpp:335
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:1133
constexpr bool contains(const OtherRay &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:376
constexpr auto intersection(const OtherSegment &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:186
constexpr bool parallel(const OtherRay &other) const
Returns whether the given ray is parallel to the oriented segment.
Definition predicates.hpp:402
constexpr OrientedSegment()=default
Creates the degenerate oriented segment (0,0)->(0,0).
constexpr bool intersects(const OtherPoint &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:278
constexpr auto squaredDistance(const OtherShape &other) const
Returns the squared Euclidean distance to the given shape.
Definition orientedsegment.hpp:1334
constexpr void scaleUpY(const OtherNumber scalar)
Multiplies the segment's y-coordinates by a factor in place.
Definition transformations.hpp:395
constexpr bool separates(const OtherPoint &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:709
constexpr bool boundaryContains(const OtherHalfplane &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:582
constexpr bool separates(const OtherHalfplane &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:761
constexpr OrientedSegment scaledUpX(const OtherNumber scalar) const
Returns the segment with its x-coordinates multiplied by a factor.
constexpr bool containsCollinear(const OtherPoint &point) const
Returns whether the segment contains the given point that is collinear with the segment.
Definition predicates.hpp:327
constexpr OrientedSegment(const OrientedSegment< OtherPointType, OtherLabelType > &other)
Converts an oriented segment with a different point and/or label type.
Definition orientedsegment.hpp:107
constexpr Ray< PointType > asRay() const
Returns the ray with the same source and direction.
Definition orientedsegment.hpp:363
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:346
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:628
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).
constexpr OrientedSegment opposite() const
Returns the opposite orientation of the same geometric segment.
Definition orientedsegment.hpp:220
constexpr OrientedSegment(NumberType x1, NumberType y1, NumberType x2, NumberType y2, A &&label)
Same as the four-coordinate constructor, and stores a label.
Definition orientedsegment.hpp:96
constexpr auto hausdorffDistanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition orientedsegment.hpp:1549
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1717
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:300
constexpr auto squaredDistance(const OtherPoint &point) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:178
constexpr bool parallel(const OtherOrientedSegment &other) const
Returns whether another oriented segment is parallel to this oriented segment.
Definition predicates.hpp:384
constexpr bool isHorizontal() const
Returns whether the segment is horizontal.
Definition predicates.hpp:309
constexpr OrientedSegment scaledDownX(const OtherNumber scalar) const
Returns the segment with its x-coordinates divided by a divisor.
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 haus...
Definition orientedsegment.hpp:1522
constexpr auto distanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:259
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:399
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition orientedsegment.hpp:880
constexpr auto hausdorffDistanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:976
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5659
constexpr void scaleDownY(const OtherNumber scalar)
Divides the segment's y-coordinates by a divisor in place.
Definition transformations.hpp:421
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition orientedsegment.hpp:1122
constexpr auto squaredHausdorffDistance(const OtherPoint &point) const
Returns the squared Hausdorff distance to a point.
Definition distance.hpp:210
constexpr OrientedSegment scaledUpY(const OtherNumber scalar) const
Returns the segment with its y-coordinates multiplied by a factor.
constexpr auto hausdorffDistanceL1(const OtherShape &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition orientedsegment.hpp:1509
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition orientedsegment.hpp:720
constexpr Segment< PointType > diameter() const
Returns an unordered segment defining the diameter.
Definition measures.hpp:148
constexpr bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:733
constexpr bool boundaryContains(const OtherTriangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:591
constexpr std::optional< ResultNumber > xAtY(const OtherNumber &y) const
Returns the value of the x coordinate for a given y, if it exists.
Definition atxy.hpp:108
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2752
constexpr bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:727
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1693
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition orientedsegment.hpp:886
constexpr bool boundaryContains(const OtherLine &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition orientedsegment.hpp:573
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:352
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 dist...
Definition orientedsegment.hpp:1482
constexpr bool interiorsIntersect(const Shape< PointType > &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:312
constexpr bool collinear(const OtherPoint &point) const
Returns whether the given point is collinear with the oriented segment.
Definition predicates.hpp:333
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2373
constexpr auto begin()
Definition orientedsegment.hpp:232
constexpr OrientedSegment(PointType source, PointType target, A &&label)
Creates an oriented segment from a source and target and stores a label.
Definition orientedsegment.hpp:90
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1470
constexpr bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3960
constexpr auto squaredDistance(const OtherSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:184
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 haus...
Definition orientedsegment.hpp:1562
constexpr bool interiorContains(const OtherRay &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:270
constexpr auto hausdorffDistanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:963
constexpr Line< PointType > asLine() const
Returns the supporting line without orientation.
Definition orientedsegment.hpp:347
constexpr bool interiorContains(const OtherPoint &point) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:240
constexpr bool interiorsIntersect(const OtherOrientedSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:307
constexpr bool separates(const Shape< PointType > &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:778
constexpr bool parallel(const OtherSegment &other) const
Returns whether the given segment is parallel to the oriented segment.
Definition predicates.hpp:378
constexpr bool contains(const OtherLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:364
constexpr auto intersection(const OtherOrientedSegment &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:192
Two-dimensional point with optional label payload.
Definition point.hpp:129
Half-infinite line starting from one source point plus optional ray label.
Definition ray.hpp:51
Axis-aligned rectangle stored by minimum and maximum corners.
Definition rectangle.hpp:75
Unoriented closed segment between two endpoints plus optional segment label.
Definition segment.hpp:58
Runtime variant wrapper over the supported primitive shapes.
Definition shape.hpp:160