Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
point.hpp
Go to the documentation of this file.
1#pragma once
2
4
12
13#include <cassert>
14#include <cmath>
15#include <concepts>
16#include <cstddef>
17#include <functional>
18#include <optional>
19#include <ostream>
20#include <type_traits>
21#include <utility>
22#include <array>
23#include <vector>
24
25
26namespace pgl {
27
31struct NoLabel {};
32
33template <class Number = int, class Label = NoLabel>
34struct Point;
35
37
38template <class Number>
39Point(Number, Number) -> Point<Number>;
40
41template <class Number, class Label>
42Point(Number, Number, Label) -> Point<Number, std::decay_t<Label>>;
43
44namespace detail {
50 template <class Label>
51 inline constexpr bool has_label_v = !std::same_as<Label, NoLabel>;
52
53
68 template <class Label>
69 struct LabelStorage {
70 [[no_unique_address]] mutable Label value_{};
71
72 constexpr LabelStorage() = default;
73
74 template <class A>
75 requires(std::constructible_from<Label, A&&>)
76 constexpr LabelStorage(A&& label) : value_(std::forward<A>(label)) {}
77 };
78
80 template <>
81 struct LabelStorage<NoLabel> {
82 constexpr LabelStorage() = default;
83 constexpr LabelStorage(NoLabel) {}
84 };
85
86
93 template <class TargetLabel, class SourceLabel>
94 inline constexpr bool can_copy_label_v =
95 !has_label_v<TargetLabel> ||
96 (has_label_v<SourceLabel> && std::constructible_from<TargetLabel, const SourceLabel&>) ||
97 (!has_label_v<SourceLabel> && std::default_initializable<TargetLabel>);
98
108 template <class TargetLabel, class OtherPoint>
109 constexpr auto copyLabel(const OtherPoint& other) {
110 if constexpr (!has_label_v<TargetLabel>) {
111 return NoLabel{};
112 } else if constexpr (!has_label_v<typename OtherPoint::LabelType>) {
113 return TargetLabel{};
114 } else {
115 return TargetLabel(other.label());
116 }
117 }
118
119} //detail
120
121
128template <class TNumber, class TLabel>
129struct Point {
131 using NumberType = TNumber;
133 using LabelType = TLabel;
134
138 constexpr Point() = default;
139
147 : coords_{x, y} {}
148
164 template <class X, class Y, class A>
165 requires(std::constructible_from<NumberType, const X&> &&
166 std::constructible_from<NumberType, const Y&> &&
167 std::constructible_from<LabelType, A&&>)
168 constexpr Point(const X& x, const Y& y, A&& label)
169 : coords_{static_cast<NumberType>(x), static_cast<NumberType>(y)},
170 label_(std::forward<A>(label)) {}
171
179 template <PointConcept OtherPoint>
180 // requires(std::convertible_to<typename OtherPoint::Number, NumberType> && detail::can_copy_label_v<LabelType, typename OtherPoint::LabelType>)
181 constexpr Point(const OtherPoint& other)
182 : coords_{
183 detail::convertCoordinate<NumberType>(other.x()),
184 detail::convertCoordinate<NumberType>(other.y()),
185 },
186 label_(detail::copyLabel<LabelType>(other)) {}
187
193 constexpr const NumberType& x() const {
194 return coords_[0];
195 }
197 return coords_[0];
198 }
199
205 constexpr const NumberType& y() const {
206 return coords_[1];
207 }
209 return coords_[1];
210 }
211
221 template <class A = LabelType>
222 requires(detail::has_label_v<A>)
223 constexpr A& label() const {
224 return label_.value_;
225 }
226
233 constexpr const NumberType& operator[](std::size_t index) const {
234 assert(index < size());
235 return coords_[index];
236 }
237
239 assert(index < size());
240 return coords_[index];
241 }
242
246 static constexpr std::size_t size() {
247 return 2;
248 }
249
254 constexpr const NumberType& get(std::ptrdiff_t index) const {
255 const std::ptrdiff_t n = static_cast<std::ptrdiff_t>(size());
256 return (*this)[static_cast<std::size_t>(((index % n) + n) % n)];
257 }
258 constexpr NumberType& get(std::ptrdiff_t index) {
259 const std::ptrdiff_t n = static_cast<std::ptrdiff_t>(size());
260 return (*this)[static_cast<std::size_t>(((index % n) + n) % n)];
261 }
262
267 constexpr std::ptrdiff_t index(const NumberType& value) const {
268 for (std::ptrdiff_t i = 0; i < static_cast<std::ptrdiff_t>(size()); ++i) {
269 if ((*this)[static_cast<std::size_t>(i)] == value) {
270 return i;
271 }
272 }
273 return -1;
274 }
275
281 constexpr auto begin() {
282 return coords_.begin();
283 }
284 constexpr auto begin() const {
285 return coords_.cbegin();
286 }
287
293 constexpr auto cbegin() const {
294 return coords_.cbegin();
295 }
296
302 constexpr auto end() {
303 return coords_.end();
304 }
305 constexpr auto end() const {
306 return coords_.cend();
307 }
308
314 constexpr auto cend() const {
315 return coords_.cend();
316 }
317
323 [[nodiscard]] constexpr Point operator-() const;
324
331 template<PointConcept OtherPoint>
332 [[nodiscard]] constexpr bool operator==(const OtherPoint& other) const;
333
335 template<AnyShapeConcept OtherShape>
336 [[nodiscard]] constexpr bool samePointSet(const OtherShape& other) const;
337
344 template<PointConcept OtherPoint>
345 [[nodiscard]] constexpr std::strong_ordering operator<=>(const OtherPoint& other) const;
346
352 [[nodiscard]] constexpr Rectangle<Point> bbox() const;
353
360 template <std::floating_point ResultNumber = double>
361 [[nodiscard]] constexpr Rectangle<Point<ResultNumber>> fbox() const;
362
368 [[nodiscard]] constexpr std::array<Point, 1> vertices() const;
369
375 [[nodiscard]] constexpr Convex<Point> convexHull() const {
376 return Convex<Point>(vertices());
377 }
378
384 [[nodiscard]] constexpr std::array<Segment<Point>, 0> edges() const;
385
391 [[nodiscard]] constexpr std::array<OrientedSegment<Point>, 0> orientedEdges() const;
392
403 template<PointConcept OtherPoint>
404 [[nodiscard]] constexpr bool contains(const OtherPoint& other) const;
405
407 template<SegmentConcept OtherSegment>
408 [[nodiscard]] constexpr bool contains(const OtherSegment& other) const;
409
411 template<OrientedSegmentConcept OtherOrientedSegment>
412 [[nodiscard]] constexpr bool contains(const OtherOrientedSegment& other) const;
413
415 template<LineConcept OtherLine>
416 [[nodiscard]] constexpr bool contains(const OtherLine& other) const;
417
419 template<OrientedLineConcept OtherOrientedLine>
420 [[nodiscard]] constexpr bool contains(const OtherOrientedLine& other) const;
421
423 template<RayConcept OtherRay>
424 [[nodiscard]] constexpr bool contains(const OtherRay& other) const;
425
427 template<HalfplaneConcept OtherHalfplane>
428 [[nodiscard]] constexpr bool contains(const OtherHalfplane& other) const;
429
431 template<RectangleConcept OtherRectangle>
432 [[nodiscard]] constexpr bool contains(const OtherRectangle& other) const;
433
435 template<TriangleConcept OtherTriangle>
436 [[nodiscard]] constexpr bool contains(const OtherTriangle& other) const;
437
439 template<ConvexConcept OtherConvex>
440 [[nodiscard]] constexpr bool contains(const OtherConvex& other) const;
441
443 template<PolygonConcept OtherPolygon>
444 [[nodiscard]] constexpr bool contains(const OtherPolygon& other) const;
445
447 template<DiskConcept OtherDisk>
448 [[nodiscard]] constexpr bool contains(const OtherDisk& other) const;
449
451 [[nodiscard]] constexpr bool contains(const Shape<Point<TNumber, TLabel>>& other) const;
452
454 [[nodiscard]] constexpr bool boundaryContains(const Shape<Point<TNumber, TLabel>>& other) const;
455
456 // The empty set is a subset of every shape, so it is contained in all of
457 // them. This lets an EmptyShape flow through Shape's variant dispatch
458 // without special-casing.
460 template <class EmptyPoint>
461 [[nodiscard]] constexpr bool contains(const EmptyShape<EmptyPoint>&) const {
462 return true;
463 }
464
465 template <class EmptyPoint>
466 [[nodiscard]] constexpr bool boundaryContains(const EmptyShape<EmptyPoint>&) const {
467 return true;
468 }
469
470 template <class EmptyPoint>
471 [[nodiscard]] constexpr bool interiorContains(const EmptyShape<EmptyPoint>&) const {
472 return true;
473 }
474
482 template<PointConcept OtherPoint>
483 [[nodiscard]] constexpr bool boundaryContains(const OtherPoint& other) const;
484
486 template<SegmentConcept OtherSegment>
487 [[nodiscard]] constexpr bool boundaryContains(const OtherSegment& other) const;
488
490 template<OrientedSegmentConcept OtherOrientedSegment>
491 [[nodiscard]] constexpr bool boundaryContains(const OtherOrientedSegment& other) const;
492
494 template<LineConcept OtherLine>
495 [[nodiscard]] constexpr bool boundaryContains(const OtherLine& other) const;
496
498 template<OrientedLineConcept OtherOrientedLine>
499 [[nodiscard]] constexpr bool boundaryContains(const OtherOrientedLine& other) const;
500
502 template<RayConcept OtherRay>
503 [[nodiscard]] constexpr bool boundaryContains(const OtherRay& other) const;
504
506 template<HalfplaneConcept OtherHalfplane>
507 [[nodiscard]] constexpr bool boundaryContains(const OtherHalfplane& other) const;
508
510 template<RectangleConcept OtherRectangle>
511 [[nodiscard]] constexpr bool boundaryContains(const OtherRectangle& other) const;
512
514 template<TriangleConcept OtherTriangle>
515 [[nodiscard]] constexpr bool boundaryContains(const OtherTriangle& other) const;
516
528 template<PointConcept OtherPoint>
529 [[nodiscard]] constexpr bool interiorContains(const OtherPoint& other) const;
530
532 template<SegmentConcept OtherSegment>
533 [[nodiscard]] constexpr bool interiorContains(const OtherSegment& other) const;
534
536 template<OrientedSegmentConcept OtherOrientedSegment>
537 [[nodiscard]] constexpr bool interiorContains(const OtherOrientedSegment& other) const;
538
540 template<LineConcept OtherLine>
541 [[nodiscard]] constexpr bool interiorContains(const OtherLine& other) const;
542
544 template<OrientedLineConcept OtherOrientedLine>
545 [[nodiscard]] constexpr bool interiorContains(const OtherOrientedLine& other) const;
546
548 template<RayConcept OtherRay>
549 [[nodiscard]] constexpr bool interiorContains(const OtherRay& other) const;
550
552 template<HalfplaneConcept OtherHalfplane>
553 [[nodiscard]] constexpr bool interiorContains(const OtherHalfplane& other) const;
554
556 template<RectangleConcept OtherRectangle>
557 [[nodiscard]] constexpr bool interiorContains(const OtherRectangle& other) const;
558
560 template<TriangleConcept OtherTriangle>
561 [[nodiscard]] constexpr bool interiorContains(const OtherTriangle& other) const;
562
564 template<ConvexConcept OtherConvex>
565 [[nodiscard]] constexpr bool interiorContains(const OtherConvex& other) const;
566
568 template<PolygonConcept OtherPolygon>
569 [[nodiscard]] constexpr bool interiorContains(const OtherPolygon& other) const;
570
572 template<DiskConcept OtherDisk>
573 [[nodiscard]] constexpr bool interiorContains(const OtherDisk& other) const;
574
575 // --- not-yet-implemented predicate pairs (throw); see implementation ---
577 template<DiskConcept OtherDisk>
578 [[nodiscard]] constexpr bool boundaryContains(const OtherDisk& other) const;
579
581 template<ConvexConcept OtherConvex>
582 [[nodiscard]] constexpr bool boundaryContains(const OtherConvex& other) const;
583
585 template<PolygonConcept OtherPolygon>
586 [[nodiscard]] constexpr bool boundaryContains(const OtherPolygon& other) const;
587
589 template<PointConcept OtherPoint>
590 [[nodiscard]] constexpr bool separates(const OtherPoint& other) const;
591
593 template<HalfplaneConcept OtherHalfplane>
594 [[nodiscard]] constexpr bool separates(const OtherHalfplane& other) const;
595
597 template<RectangleConcept OtherRectangle>
598 [[nodiscard]] constexpr bool separates(const OtherRectangle& other) const;
599
601 template<TriangleConcept OtherTriangle>
602 [[nodiscard]] constexpr bool separates(const OtherTriangle& other) const;
603
605 template<DiskConcept OtherDisk>
606 [[nodiscard]] constexpr bool separates(const OtherDisk& other) const;
607
609 template<ConvexConcept OtherConvex>
610 [[nodiscard]] constexpr bool separates(const OtherConvex& other) const;
611
613 template<PolygonConcept OtherPolygon>
614 [[nodiscard]] constexpr bool separates(const OtherPolygon& other) const;
615
617 template<MonotoneChainConcept OtherChain>
618 [[nodiscard]] constexpr bool contains(const OtherChain& other) const;
619
621 template<MonotoneChainConcept OtherChain>
622 [[nodiscard]] constexpr bool boundaryContains(const OtherChain& other) const;
623
625 template<MonotoneChainConcept OtherChain>
626 [[nodiscard]] constexpr bool interiorContains(const OtherChain& other) const;
627
629 template<MonotoneChainConcept OtherChain>
630 [[nodiscard]] constexpr bool separates(const OtherChain& other) const;
631
633 template<PolylineConcept OtherPolyline>
634 [[nodiscard]] constexpr bool contains(const OtherPolyline& other) const;
635
637 template<PolylineConcept OtherPolyline>
638 [[nodiscard]] constexpr bool boundaryContains(const OtherPolyline& other) const;
639
641 template<PolylineConcept OtherPolyline>
642 [[nodiscard]] constexpr bool interiorContains(const OtherPolyline& other) const;
643
645 template<PolylineConcept OtherPolyline>
646 [[nodiscard]] constexpr bool separates(const OtherPolyline& other) const;
647
649 template<HalfplaneIntersectionConcept OtherRegion>
650 [[nodiscard]] constexpr bool contains(const OtherRegion& other) const;
651
653 template<HalfplaneIntersectionConcept OtherRegion>
654 [[nodiscard]] constexpr bool boundaryContains(const OtherRegion& other) const;
655
657 template<HalfplaneIntersectionConcept OtherRegion>
658 [[nodiscard]] constexpr bool interiorContains(const OtherRegion& other) const;
659
661 template<HalfplaneIntersectionConcept OtherRegion>
662 [[nodiscard]] constexpr bool separates(const OtherRegion& other) const;
663
671 template<PolygonWithHolesConcept OtherRegion>
672 [[nodiscard]] constexpr bool contains(const OtherRegion& other) const;
673
680 template<PolygonWithHolesConcept OtherRegion>
681 [[nodiscard]] constexpr bool boundaryContains(const OtherRegion& other) const;
682
684 template<PolygonWithHolesConcept OtherRegion>
685 [[nodiscard]] constexpr bool interiorContains(const OtherRegion& other) const;
686
694 template<PolygonWithHolesConcept OtherRegion>
695 [[nodiscard]] bool separates(const OtherRegion& other) const;
696
697 // -------------------------------------------------------------------------
698 // A set of regions
699 //
700 // It outranks every other shape, so the symmetric relations reach it through
701 // the rank-based forwarders and only the asymmetric ones are answered here.
702 // A set is the union of its components, so it is contained exactly when
703 // every component is — no matter what this shape is.
704
706 template<PolygonSetConcept OtherSet>
707 [[nodiscard]] constexpr bool contains(const OtherSet& other) const {
708 for (const auto& component : other) {
709 if (!contains(component)) {
710 return false;
711 }
712 }
713 return true;
714 }
715
717 template<PolygonSetConcept OtherSet>
718 [[nodiscard]] constexpr bool boundaryContains(const OtherSet& other) const {
719 for (const auto& component : other) {
720 if (!boundaryContains(component)) {
721 return false;
722 }
723 }
724 return true;
725 }
726
728 template<PolygonSetConcept OtherSet>
729 [[nodiscard]] constexpr bool interiorContains(const OtherSet& other) const {
730 for (const auto& component : other) {
731 if (!interiorContains(component)) {
732 return false;
733 }
734 }
735 return true;
736 }
737
746 template<PolygonSetConcept OtherSet>
747 [[nodiscard]] bool separates(const OtherSet& other) const;
748
749
755 template<PointConcept OtherPoint>
756 [[nodiscard]] constexpr bool intersects(const OtherPoint& other) const;
757
759 [[nodiscard]] constexpr bool intersects(const Shape<Point<TNumber, TLabel>>& other) const;
760
762 template<typename OtherShape>
763 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
764 [[nodiscard]] constexpr bool intersects(const OtherShape& other) const {
765 return other.intersects(*this);
766 }
767
769 template <class EmptyPoint>
770 [[nodiscard]] constexpr bool intersects(const EmptyShape<EmptyPoint>&) const {
771 return false;
772 }
773
775 template<PointConcept OtherPoint>
776 [[nodiscard]] constexpr bool interiorsIntersect(const OtherPoint& other) const;
777
779 [[nodiscard]] constexpr bool interiorsIntersect(const Shape<Point<TNumber, TLabel>>& other) const;
780
782 template<typename OtherShape>
783 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
784 [[nodiscard]] constexpr bool interiorsIntersect(const OtherShape& other) const {
785 return other.interiorsIntersect(*this);
786 }
787
789 template <class EmptyPoint>
790 [[nodiscard]] constexpr bool interiorsIntersect(const EmptyShape<EmptyPoint>&) const {
791 return false;
792 }
793
795 template<SegmentConcept OtherSegment>
796 [[nodiscard]] constexpr bool separates(const OtherSegment& other) const;
797
799 template<OrientedSegmentConcept OtherOrientedSegment>
800 [[nodiscard]] constexpr bool separates(const OtherOrientedSegment& other) const;
801
803 template<LineConcept OtherLine>
804 [[nodiscard]] constexpr bool separates(const OtherLine& other) const;
805
807 template<OrientedLineConcept OtherOrientedLine>
808 [[nodiscard]] constexpr bool separates(const OtherOrientedLine& other) const;
809
811 template<RayConcept OtherRay>
812 [[nodiscard]] constexpr bool separates(const OtherRay& other) const;
813
815 template<PointConcept OtherPoint>
816 [[nodiscard]] constexpr bool crosses(const OtherPoint& other) const;
817
819 [[nodiscard]] constexpr bool crosses(const Shape<Point<TNumber, TLabel>>& other) const;
820
822 template<typename OtherShape>
823 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
824 [[nodiscard]] constexpr bool crosses(const OtherShape& other) const {
825 return other.crosses(*this);
826 }
827
829 template <class EmptyPoint>
830 [[nodiscard]] constexpr bool crosses(const EmptyShape<EmptyPoint>&) const {
831 return false;
832 }
833
835 template <class ResultNumber = NumberType, PointConcept OtherPoint>
836 [[nodiscard]] constexpr std::optional<Point<ResultNumber, LabelType>>
837 intersection(const OtherPoint& other) const;
838
840 template <class ResultNumber = NumberType, typename OtherShape>
841 requires (!PointConcept<OtherShape>
842 && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
843 && requires(const OtherShape& o, const Point& self) {
844 o.template intersection<ResultNumber>(self);
845 })
846 [[nodiscard]] constexpr auto intersection(const OtherShape& other) const {
847 return other.template intersection<ResultNumber>(*this);
848 }
849
851 template <class ResultNumber = NumberType, class EmptyPoint>
852 [[nodiscard]] constexpr EmptyShape<EmptyPoint> intersection(const EmptyShape<EmptyPoint>&) const {
853 return {};
854 }
855
868 template <class ResultNumber = NumberType, PointConcept OtherPoint>
869 [[nodiscard]] constexpr auto squaredDistance(const OtherPoint& other) const;
870
872 template <class ResultNumber = NumberType, RectangleConcept OtherRectangle>
873 [[nodiscard]] constexpr auto squaredDistance(const OtherRectangle& other) const {
874 return other.template squaredDistance<ResultNumber>(*this);
875 }
876
883 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
885 && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
886 && requires(const OtherShape& o, const Point& self) {
887 o.template squaredDistance<ResultNumber>(self);
888 })
889 [[nodiscard]] constexpr auto squaredDistance(const OtherShape& other) const {
890 return other.template squaredDistance<ResultNumber>(*this);
891 }
892
900 template <class ResultNumber = double, class DiskPointType, class DiskLabel>
901 [[nodiscard]] detail::floating_result_t<ResultNumber> squaredDistance(const Disk<DiskPointType, DiskLabel>& disk) const {
902 return disk.template squaredDistance<ResultNumber>(*this);
903 }
904
917 template <class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
918 requires detail::ClosestPairConcept<Point<TNumber, TLabel>, OtherShape>
919 [[nodiscard]] constexpr auto closestSegments(const OtherShape& other) const;
920
937 template <class ResultNumber = division_result_t<NumberType>, class OtherShape>
938 requires detail::ClosestPointsPairConcept<Point<TNumber, TLabel>, OtherShape>
939 [[nodiscard]] constexpr auto closestPoints(const OtherShape& other) const;
940
951 template <class ResultNumber = NumberType, PointConcept OtherPoint>
952 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherPoint& other) const;
953
960 template <class ResultNumber = NumberType, typename OtherShape>
961 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
962 && requires(const OtherShape& o, const Point& self) {
964 })
965 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherShape& other) const {
966 return other.template squaredHausdorffDistance<ResultNumber>(*this);
967 }
968
978 template <class ApproximateNumber = double, PointConcept OtherPoint>
979 [[nodiscard]] ApproximateNumber distance(const OtherPoint& other) const;
980
990 template <class ResultNumber = NumberType, PointConcept OtherPoint>
991 [[nodiscard]] constexpr auto distanceL1(const OtherPoint& other) const;
992
994 template <class ResultNumber = NumberType, RectangleConcept OtherRectangle>
995 [[nodiscard]] constexpr auto distanceL1(const OtherRectangle& other) const {
996 return other.template distanceL1<ResultNumber>(*this);
997 }
998
1005 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1006 requires (!PointConcept<OtherShape>
1008 && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
1009 && requires(const OtherShape& o, const Point& self) {
1010 o.template distanceL1<ResultNumber>(self);
1011 })
1012 [[nodiscard]] constexpr auto distanceL1(const OtherShape& other) const {
1013 return other.template distanceL1<ResultNumber>(*this);
1014 }
1015
1031 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1032 [[nodiscard]] constexpr auto intersection(const Shape<OtherPoint>& other) const {
1033 return other.template intersection<ResultNumber>(*this);
1034 }
1035
1046 template <class ResultNumber = double, PointConcept OtherPoint>
1047 [[nodiscard]] constexpr auto distanceL1(const Shape<OtherPoint>& other) const {
1048 return other.template distanceL1<ResultNumber>(*this);
1049 }
1050
1060 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1061 [[nodiscard]] constexpr auto distanceLInf(const OtherPoint& other) const;
1062
1064 template <class ResultNumber = NumberType, RectangleConcept OtherRectangle>
1065 [[nodiscard]] constexpr auto distanceLInf(const OtherRectangle& other) const {
1066 return other.template distanceLInf<ResultNumber>(*this);
1067 }
1068
1075 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1076 requires (!PointConcept<OtherShape>
1078 && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
1079 && requires(const OtherShape& o, const Point& self) {
1080 o.template distanceLInf<ResultNumber>(self);
1081 })
1082 [[nodiscard]] constexpr auto distanceLInf(const OtherShape& other) const {
1083 return other.template distanceLInf<ResultNumber>(*this);
1084 }
1085
1087 template <class ResultNumber = double, PointConcept OtherPoint>
1088 [[nodiscard]] constexpr auto distanceLInf(const Shape<OtherPoint>& other) const {
1089 return other.template distanceLInf<ResultNumber>(*this);
1090 }
1091
1097 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1098 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherPoint& other) const;
1099
1106 template <class ResultNumber = NumberType, typename OtherShape>
1107 requires (!PointConcept<OtherShape>
1108 && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
1109 && requires(const OtherShape& o, const Point& self) {
1110 o.template hausdorffDistanceL1<ResultNumber>(self);
1111 })
1112 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherShape& other) const {
1113 return other.template hausdorffDistanceL1<ResultNumber>(*this);
1114 }
1115
1117 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1118 [[nodiscard]] constexpr auto hausdorffDistanceL1(const Shape<OtherPoint>& other) const {
1119 return other.template hausdorffDistanceL1<ResultNumber>(*this);
1120 }
1121
1127 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1128 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherPoint& other) const;
1129
1136 template <class ResultNumber = NumberType, typename OtherShape>
1137 requires (!PointConcept<OtherShape>
1138 && (detail::shapeRank<OtherShape> > detail::shapeRank<Point>)
1139 && requires(const OtherShape& o, const Point& self) {
1140 o.template hausdorffDistanceLInf<ResultNumber>(self);
1141 })
1142 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherShape& other) const {
1143 return other.template hausdorffDistanceLInf<ResultNumber>(*this);
1144 }
1145
1147 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1148 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const Shape<OtherPoint>& other) const {
1149 return other.template hausdorffDistanceLInf<ResultNumber>(*this);
1150 }
1151
1159 template <class ResultNumber = double, class DiskPointType, class DiskLabel>
1160 [[nodiscard]] detail::floating_result_t<ResultNumber> distanceL1(const Disk<DiskPointType, DiskLabel>& disk) const {
1161 return disk.template distanceL1<ResultNumber>(*this);
1162 }
1163
1165 template <class ResultNumber = double, class DiskPointType, class DiskLabel>
1166 [[nodiscard]] detail::floating_result_t<ResultNumber> distanceLInf(const Disk<DiskPointType, DiskLabel>& disk) const {
1167 return disk.template distanceLInf<ResultNumber>(*this);
1168 }
1169
1183 template <class OtherShape>
1185 [[nodiscard]] constexpr auto minkowskiSum(const OtherShape& other) const;
1186
1209 template <class OtherShape>
1211 [[nodiscard]] constexpr auto minkowskiErosion(const OtherShape& other) const;
1212
1222 template<PointConcept OtherPoint>
1223 constexpr Point& operator+=(const OtherPoint& other);
1224
1234 template<PointConcept OtherPoint>
1235 constexpr Point& operator-=(const OtherPoint& other);
1236
1245 template <class OtherNumber>
1246 constexpr Point& operator*=(const OtherNumber scalar);
1247
1256 template <class OtherNumber>
1257 constexpr Point& operator/=(const OtherNumber scalar);
1258
1264 constexpr Point swapped() const;
1265
1272 [[nodiscard]] constexpr Point rotated90(int k = 1) const;
1273
1279 constexpr void rotate90(int k = 1);
1280
1288 template <class OtherNumber>
1289 [[nodiscard]] constexpr Point scaledUpX(const OtherNumber scalar) const;
1290
1297 template <class OtherNumber>
1298 constexpr void scaleUpX(const OtherNumber scalar);
1299
1307 template <class OtherNumber>
1308 [[nodiscard]] constexpr Point scaledUpY(const OtherNumber scalar) const;
1309
1316 template <class OtherNumber>
1317 constexpr void scaleUpY(const OtherNumber scalar);
1318
1326 template <class OtherNumber>
1327 [[nodiscard]] constexpr Point scaledDownX(const OtherNumber scalar) const;
1328
1335 template <class OtherNumber>
1336 constexpr void scaleDownX(const OtherNumber scalar);
1337
1345 template <class OtherNumber>
1346 [[nodiscard]] constexpr Point scaledDownY(const OtherNumber scalar) const;
1347
1354 template <class OtherNumber>
1355 constexpr void scaleDownY(const OtherNumber scalar);
1356
1368
1375 template<class ResultNumber = NumberType>
1377
1385 template<class ResultNumber = division_result_t<NumberType>>
1387
1388 private:
1389 std::array<NumberType,2> coords_{};
1390 [[no_unique_address]] detail::LabelStorage<LabelType> label_{};
1391}; // struct Point
1392
1404template <class LeftNumber, class LeftLabel, class RightNumber, class RightLabel>
1405[[nodiscard]] constexpr auto operator-(const Point<LeftNumber, LeftLabel>& left, const Point<RightNumber, RightLabel>& right);
1406
1417template <class Number, class Label, class Scalar>
1418 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1419[[nodiscard]] constexpr auto operator*(const Point<Number, Label>& point, const Scalar& scalar);
1420
1431template <class Scalar, class Number, class Label>
1432 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1433[[nodiscard]] constexpr auto operator*(const Scalar& scalar, const Point<Number, Label>& point);
1434
1446template <class LeftNumber, class LeftLabel, class RightNumber, class RightLabel>
1447[[nodiscard]] constexpr auto operator*(const Point<LeftNumber, LeftLabel>& left, const Point<RightNumber, RightLabel>& right);
1448
1459template <class Number, class Label, class Scalar>
1460 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1461[[nodiscard]] constexpr auto operator/(const Point<Number, Label>& point, const Scalar& scalar);
1462
1472template <class Number, class Label>
1473std::ostream& operator<<(std::ostream& stream, const Point<Number, Label>& point);
1474
1475}//pgl
Shape pairs whose Minkowski sum Pangolin can represent.
Definition forward.hpp:476
Definition forward.hpp:306
Definition forward.hpp:313
Definition forward.hpp:324
Definition arrangement.hpp:67
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
Convex() -> Convex< Point<>, NoLabel >
Definition convex.hpp:3311
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
constexpr auto operator*(const Transformation< Number > &transformation, const ShapeT &shape)
Applies a transformation to any supported shape.
Definition transformations.hpp:2200
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
Intersection of closed half-planes; convex but possibly unbounded or empty.
Definition halfplaneintersection.hpp:244
Unoriented infinite line.
Definition line.hpp:52
Sentinel type used when a point carries no extra label.
Definition point.hpp:31
Two-dimensional point with optional label payload.
Definition point.hpp:129
constexpr auto closestPoints(const OtherShape &other) const
Returns the pair of points realizing the distance, nothing when the shapes meet.
Definition closest.hpp:307
constexpr void scaleUpX(const OtherNumber scalar)
Multiplies the point's x-coordinate by a scalar in place.
Definition transformations.hpp:87
constexpr auto end() const
Definition point.hpp:305
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5909
constexpr Point(const X &x, const Y &y, A &&label)
Creates a point from its coordinates and label.
Definition point.hpp:168
detail::floating_result_t< ResultNumber > distanceL1(const Disk< DiskPointType, DiskLabel > &disk) const
Returns the Manhattan (L1) distance to a disk.
Definition point.hpp:1160
constexpr Point rotated90(int k=1) const
Returns the point rotated by 90k degrees around the origin.
Definition transformations.hpp:61
constexpr bool interiorsIntersect(const OtherPoint &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:24
constexpr auto distanceL1(const OtherRectangle &other) const
Returns the Manhattan distance to an axis-aligned rectangle without division.
Definition point.hpp:995
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 point.hpp:1032
constexpr Point()=default
Creates the origin point (0, 0).
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition point.hpp:784
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1674
ApproximateNumber distance(const OtherPoint &other) const
Returns the Euclidean distance to another point.
Definition distance.hpp:69
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:39
constexpr auto squaredHausdorffDistance(const OtherShape &other) const
Returns the squared Hausdorff distance to the given shape.
Definition point.hpp:965
constexpr bool boundaryContains(const OtherSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:32
constexpr bool operator==(const OtherPoint &other) const
Tests coordinate equality.
Definition predicates.hpp:30
constexpr void scaleDownX(const OtherNumber scalar)
Divides the point's x-coordinate by a scalar in place.
Definition transformations.hpp:111
constexpr bool contains(const OtherOrientedLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:51
constexpr bool boundaryContains(const OtherChain &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1178
constexpr const NumberType & get(std::ptrdiff_t index) const
Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the en...
Definition point.hpp:254
constexpr bool boundaryContains(const OtherRay &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:56
constexpr bool crosses(const OtherPoint &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:25
constexpr bool boundaryContains(const OtherOrientedSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:38
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition point.hpp:852
constexpr bool interiorContains(const OtherLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:42
constexpr bool boundaryContains(const OtherOrientedLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:50
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:69
constexpr Point swapped() const
Returns the point with x and y swapped.
Definition transformations.hpp:56
constexpr auto distanceL1(const OtherShape &other) const
Returns the Manhattan distance to the given shape.
Definition point.hpp:1012
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition point.hpp:770
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
constexpr bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:240
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:87
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:93
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2713
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition point.hpp:718
constexpr Point operator-() const
Returns the point mirrored through the origin.
Definition transformations.hpp:19
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:77
constexpr Convex< Point > convexHull() const
Returns the convex hull of the point.
Definition point.hpp:375
constexpr bool boundaryContains(const OtherPolyline &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1287
constexpr auto begin()
Returns an iterator to the first coordinate.
Definition point.hpp:281
constexpr auto distanceLInf(const OtherPoint &other) const
Returns the Chebyshev distance to another point.
Definition distance.hpp:83
constexpr auto squaredHausdorffDistance(const OtherPoint &other) const
Returns the squared Hausdorff distance to another point.
Definition distance.hpp:91
constexpr bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:286
constexpr void scaleDownY(const OtherNumber scalar)
Divides the point's y-coordinate by a scalar in place.
Definition transformations.hpp:123
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1626
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1450
constexpr std::optional< Point< ResultNumber, LabelType > > intersection(const OtherPoint &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
constexpr bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3487
constexpr bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4552
constexpr Point scaledUpX(const OtherNumber scalar) const
Returns the point with its x-coordinate multiplied by a scalar.
constexpr A & label() const
Definition point.hpp:223
constexpr Point scaledDownX(const OtherNumber scalar) const
Returns the point with its x-coordinate divided by a scalar.
constexpr bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:279
constexpr Point & operator/=(const OtherNumber scalar)
Scales a point by a scalar division in place.
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:95
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1695
constexpr Point & operator-=(const OtherPoint &other)
Translates a point by the opposite of another point in place.
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:648
constexpr auto squaredDistance(const OtherPoint &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:61
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:89
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:33
constexpr auto cend() const
Returns an iterator past the last coordinate.
Definition point.hpp:314
constexpr bool interiorsIntersect(const Shape< Point< TNumber, TLabel > > &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
constexpr Point(const OtherPoint &other)
Converts a point with different coordinate and label types.
Definition point.hpp:181
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition point.hpp:707
constexpr bool boundaryContains(const OtherDisk &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:97
NumberType & operator[](std::size_t index)
Returns coordinate 0 for x and 1 for y.
Definition point.hpp:238
constexpr bool intersects(const Shape< Point< TNumber, TLabel > > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
static constexpr std::size_t size()
Returns the number of coordinates (always 2).
Definition point.hpp:246
constexpr std::array< Point, 1 > vertices() const
Returns the unique vertex of the point-shaped object.
Definition bounding.hpp:34
constexpr Line< Point< ResultNumber, LabelType > > dual() const
Returns the dual Line.
constexpr auto distanceLInf(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition point.hpp:1088
constexpr bool contains(const OtherHalfplane &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:63
constexpr bool boundaryContains(const OtherRectangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:68
constexpr bool boundaryContains(const OtherLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:44
constexpr auto intersection(const OtherShape &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition point.hpp:846
constexpr bool boundaryContains(const OtherPoint &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:26
constexpr bool boundaryContains(const OtherConvex &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:85
constexpr auto begin() const
Definition point.hpp:284
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:874
constexpr auto distanceL1(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition point.hpp:1047
constexpr bool interiorContains(const OtherPoint &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:24
constexpr bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:302
constexpr bool interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:66
constexpr void scaleUpY(const OtherNumber scalar)
Multiplies the point's y-coordinate by a scalar in place.
Definition transformations.hpp:99
constexpr Rectangle< Point< ResultNumber > > fbox() const
Returns a floating-point bounding box containing the point.
Definition bounding.hpp:24
constexpr bool boundaryContains(const OtherPolygon &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:91
constexpr HalfplaneIntersection< Point< NumberType, LabelType > > asHalfplaneIntersection() const
Returns the point as a (degenerate) half-plane intersection.
Definition point.hpp:1365
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition point.hpp:824
constexpr bool boundaryContains(const OtherHalfplane &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:62
constexpr bool intersects(const OtherPoint &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:25
constexpr bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:252
constexpr std::ptrdiff_t index(const NumberType &value) const
Definition point.hpp:267
constexpr Point & operator*=(const OtherNumber scalar)
Scales a point by a scalar in place.
constexpr auto hausdorffDistanceL1(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition point.hpp:1118
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1993
constexpr bool contains(const OtherLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:45
constexpr std::array< OrientedSegment< Point >, 0 > orientedEdges() const
Returns the oriented boundary edges.
Definition bounding.hpp:44
constexpr bool separates(const OtherHalfplane &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:264
constexpr Rectangle< Point > bbox() const
Returns the bounding box of the point.
Definition bounding.hpp:18
constexpr Point & operator+=(const OtherPoint &other)
Translates a point by another point in place.
constexpr const NumberType & operator[](std::size_t index) const
Returns coordinate 0 for x and 1 for y.
Definition point.hpp:233
detail::floating_result_t< ResultNumber > distanceLInf(const Disk< DiskPointType, DiskLabel > &disk) const
Returns the Chebyshev (LInf) distance to a disk.
Definition point.hpp:1166
constexpr void rotate90(int k=1)
Rotates the point by 90k degrees around the origin in place.
Definition transformations.hpp:71
constexpr std::array< Segment< Point >, 0 > edges() const
Returns the point boundary edges.
Definition bounding.hpp:39
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2038
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition point.hpp:729
constexpr bool contains(const OtherPoint &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:25
constexpr bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:246
constexpr auto end()
Returns an iterator past the last coordinate.
Definition point.hpp:302
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2351
constexpr bool separates(const OtherPoint &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:258
constexpr bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3142
constexpr auto distanceLInf(const OtherRectangle &other) const
Returns the Chebyshev distance to an axis-aligned rectangle without division.
Definition point.hpp:1065
constexpr bool contains(const OtherRay &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:57
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition point.hpp:461
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition point.hpp:790
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:36
constexpr bool crosses(const Shape< Point< TNumber, TLabel > > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
constexpr bool boundaryContains(const Shape< Point< TNumber, TLabel > > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:234
constexpr bool contains(const Shape< Point< TNumber, TLabel > > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:83
constexpr bool interiorContains(const OtherRay &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:54
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition point.hpp:764
TLabel LabelType
Definition point.hpp:133
constexpr bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:228
constexpr auto hausdorffDistanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition point.hpp:1142
detail::floating_result_t< ResultNumber > squaredDistance(const Disk< DiskPointType, DiskLabel > &disk) const
Returns the squared Euclidean distance to a disk.
Definition point.hpp:901
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:1935
constexpr auto cbegin() const
Returns an iterator to the first coordinate.
Definition point.hpp:293
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5630
constexpr auto hausdorffDistanceL1(const OtherShape &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition point.hpp:1112
constexpr const NumberType & x() const
Definition point.hpp:193
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:80
constexpr auto squaredDistance(const OtherShape &other) const
Returns the squared Euclidean distance to the given shape.
Definition point.hpp:889
NumberType & y()
Definition point.hpp:208
constexpr const NumberType & y() const
Definition point.hpp:205
constexpr Line< Point< ResultNumber, LabelType > > polar() const
Returns the polar Line.
constexpr auto hausdorffDistanceL1(const OtherPoint &other) const
Returns the Manhattan (L1) Hausdorff distance to another point.
Definition distancel1.hpp:194
constexpr Point(NumberType x, NumberType y)
Creates a point from its x and y coordinates.
Definition point.hpp:146
constexpr auto hausdorffDistanceLInf(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition point.hpp:1148
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition point.hpp:830
constexpr bool boundaryContains(const OtherTriangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:79
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition point.hpp:471
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition point.hpp:466
constexpr bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:296
constexpr auto squaredDistance(const OtherRectangle &other) const
Returns the squared distance to an axis-aligned rectangle without division.
Definition point.hpp:873
constexpr bool interiorContains(const OtherOrientedLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:48
constexpr auto distanceLInf(const OtherShape &other) const
Returns the Chebyshev distance to the given shape.
Definition point.hpp:1082
constexpr auto distanceL1(const OtherPoint &other) const
Returns the Manhattan distance to another point.
Definition distance.hpp:75
constexpr std::strong_ordering operator<=>(const OtherPoint &other) const
Provides lexicographic ordering on (x, y).
Definition predicates.hpp:38
constexpr bool interiorContains(const OtherHalfplane &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:60
constexpr bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:270
constexpr Point scaledDownY(const OtherNumber scalar) const
Returns the point with its y-coordinate divided by a scalar.
constexpr bool interiorContains(const OtherSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:30
constexpr auto closestSegments(const OtherShape &other) const
Returns the pair of elements realizing the distance, nothing when the shapes meet.
Definition closest.hpp:300
WorkNumber NumberType
Definition point.hpp:131
constexpr Point scaledUpY(const OtherNumber scalar) const
Returns the point with its y-coordinate multiplied by a scalar.
constexpr auto hausdorffDistanceLInf(const OtherPoint &other) const
Returns the Chebyshev (LInf) Hausdorff distance to another point.
Definition distancelinf.hpp:182
constexpr NumberType & get(std::ptrdiff_t index)
Definition point.hpp:258
NumberType & x()
Definition point.hpp:196
Axis-aligned rectangle stored by minimum and maximum corners.
Definition rectangle.hpp:75
Runtime variant wrapper over the supported primitive shapes.
Definition shape.hpp:160
Public declaration of pgl::Transformation, an affine transformation.