Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
triangle.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "shape/rectangle.hpp"
4
12
13#include <array>
14#include <cassert>
15#include <compare>
16#include <concepts>
17#include <cstddef>
18#include <iterator>
19#include <optional>
20#include <vector>
21#include <ostream>
22#include <type_traits>
23#include <utility>
24
25
26namespace pgl {
27
28template <class PointType = Point<>, class Label>
29struct Triangle;
30
32
33template <class PointType>
34Triangle(PointType, PointType, PointType) -> Triangle<PointType, NoLabel>;
35
36template <class PointType, class A>
37Triangle(PointType, PointType, PointType, A) -> Triangle<PointType, std::decay_t<A>>;
38
39template <class Number>
40Triangle(Number, Number, Number, Number, Number, Number) -> Triangle<Point<Number>, NoLabel>;
41
52template <class PointType_, class TLabel>
53struct Triangle {
55 using PointType = PointType_;
59 using LabelType = TLabel;
60
63 using size_type = std::size_t;
64 using difference_type = std::ptrdiff_t;
65 using reference = const PointType&;
66 using const_reference = const PointType&;
67 using iterator = typename std::array<PointType, 3>::const_iterator;
69
70 template <bool Oriented>
71 using BoundaryType = std::conditional_t<Oriented, OrientedSegment<PointType>, Segment<PointType>>;
72
73 template <bool Oriented>
74 class BoundaryIterator;
75
76 using EdgeIterator = BoundaryIterator<false>;
77 using OrientedEdgeIterator = BoundaryIterator<true>;
78
79 static_assert(detail::is_point_v<PointType>, "Triangle requires pgl::Point vertices");
80
84 constexpr Triangle() = default;
85
96 constexpr Triangle(PointType first, PointType second, PointType third)
97 : points_(canonicalizeVertices(std::move(first), std::move(second), std::move(third))) {}
98
110 : Triangle(PointType(x1, y1), PointType(x2, y2), PointType(x3, y3)) {}
111
119 template <class A>
120 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
121 constexpr Triangle(PointType first, PointType second, PointType third, A&& label)
122 : points_(canonicalizeVertices(std::move(first), std::move(second), std::move(third))),
123 label_(std::forward<A>(label)) {}
124
126 template <class A>
127 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
129 NumberType x3, NumberType y3, A&& label)
130 : Triangle(PointType(x1, y1), PointType(x2, y2), PointType(x3, y3), std::forward<A>(label)) {}
131
138 template<PointConcept OtherPointType, class OtherLabelType>
139 requires(std::constructible_from<PointType, const OtherPointType&>)
141 : Triangle(PointType(other.a()), PointType(other.b()), PointType(other.c())) {
142 label_ = detail::copyLabel<LabelType>(other);
143 }
144
152 template<PointConcept OtherPointType, class OtherLabelType>
153 requires(std::constructible_from<PointType, const OtherPointType&>)
154 constexpr Triangle& operator=(const Triangle<OtherPointType, OtherLabelType>& other) {
155 points_ = canonicalizeVertices(
156 PointType(other.a()),
157 PointType(other.b()),
158 PointType(other.c()));
159 label_ = detail::copyLabel<LabelType>(other);
160 return *this;
161 }
162
169 constexpr const PointType& operator[](std::size_t index) const {
170 assert(index < size());
171 return points_[index];
172 }
173
177 static constexpr std::size_t size() {
178 return 3;
179 }
180
185 constexpr const PointType& get(std::ptrdiff_t index) const {
186 const std::ptrdiff_t n = static_cast<std::ptrdiff_t>(size());
187 return (*this)[static_cast<std::size_t>(((index % n) + n) % n)];
188 }
189
194 constexpr std::ptrdiff_t index(const PointType& point) const {
195 for (std::ptrdiff_t i = 0; i < static_cast<std::ptrdiff_t>(size()); ++i) {
196 if ((*this)[static_cast<std::size_t>(i)] == point) {
197 return i;
198 }
199 }
200 return -1;
201 }
202
208 constexpr const PointType& a() const {
209 return points_[0];
210 }
211
217 constexpr const PointType& b() const {
218 return points_[1];
219 }
220
226 constexpr const PointType& c() const {
227 return points_[2];
228 }
229
235 constexpr auto begin() const {
236 return points_.cbegin();
237 }
238
244 constexpr auto cbegin() const {
245 return points_.cbegin();
246 }
247
253 constexpr auto end() const {
254 return points_.cend();
255 }
256
262 constexpr auto cend() const {
263 return points_.cend();
264 }
265
272 constexpr bool operator==(const Triangle& other) const {
273 return points_ == other.points_;
274 }
275
277 template<AnyShapeConcept OtherShape>
278 [[nodiscard]] constexpr bool samePointSet(const OtherShape& other) const;
279
281 constexpr auto operator<=>(const Triangle& other) const {
282 return points_ <=> other.points_;
283 }
284
293 template <class A = LabelType>
294 requires(detail::has_label_v<A>)
295 constexpr A& label() const {
296 return label_;
297 }
298
304 [[nodiscard]] constexpr NumberType twiceArea() const;
305
314 template <class ResultNumber = division_result_t<NumberType>>
315 [[nodiscard]] constexpr ResultNumber area() const;
316
322 [[nodiscard]] constexpr bool isDegenerate() const;
323
331 [[nodiscard]] constexpr bool isPoint() const;
332
340 [[nodiscard]] constexpr std::optional<PointType> getIfPoint() const;
341
352 [[nodiscard]] constexpr bool isSegment() const;
353
362 [[nodiscard]] constexpr std::optional<BoundaryType<false>> getIfSegment() const;
363
376 [[nodiscard]] constexpr bool isUndefined() const;
377
383 [[nodiscard]] constexpr Rectangle<PointType> bbox() const;
384
401 template <class ResultNumber = grid_number_t<typename PointType_::NumberType>>
402 requires(detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
405
412 template <std::floating_point ResultNumber = double>
413 [[nodiscard]] constexpr Rectangle<Point<ResultNumber>> fbox() const;
414
420 [[nodiscard]] constexpr std::array<PointType, 3> vertices() const;
421
427 [[nodiscard]] constexpr std::array<Segment<PointType>, 3> edges() const;
428
434 constexpr EdgeIterator edgesBegin() const {
435 return EdgeIterator(this, 0);
436 }
437
443 constexpr EdgeIterator edgesEnd() const {
444 return EdgeIterator(this, edgeCount);
445 }
446
452 [[nodiscard]] constexpr std::array<OrientedSegment<PointType>, 3> orientedEdges() const;
453
460 return OrientedEdgeIterator(this, 0);
461 }
462
469 return OrientedEdgeIterator(this, edgeCount);
470 }
471
481 [[nodiscard]] constexpr explicit operator Convex<PointType>() const {
482 return Convex<PointType>(*this, !isDegenerate());
483 }
484
490 [[nodiscard]] constexpr Convex<PointType> asConvex() const {
491 return static_cast<Convex<PointType>>(*this);
492 }
493
499 [[nodiscard]] constexpr Convex<PointType> convexHull() const {
500 return asConvex();
501 }
502
514 }
515
524 [[nodiscard]] constexpr explicit operator Polygon<PointType>() const {
525 return Polygon<PointType>(*this, !isDegenerate());
526 }
527
533 [[nodiscard]] constexpr Polygon<PointType> asPolygon() const {
534 return static_cast<Polygon<PointType>>(*this);
535 }
536
543 [[nodiscard]] constexpr PolygonWithHoles<PointType> asPolygonWithHoles() const {
545 }
546
555 [[nodiscard]] constexpr PolygonSet<PointType> asPolygonSet() const {
557 }
558
565 [[nodiscard]] constexpr Triangle rotated90(int k = 1) const;
566
572 constexpr void rotate90(int k = 1);
573
575 template <class OtherNumber>
576 [[nodiscard]] constexpr Triangle scaledUpX(const OtherNumber scalar) const;
577
579 template <class OtherNumber>
580 constexpr void scaleUpX(const OtherNumber scalar);
581
583 template <class OtherNumber>
584 [[nodiscard]] constexpr Triangle scaledUpY(const OtherNumber scalar) const;
585
587 template <class OtherNumber>
588 constexpr void scaleUpY(const OtherNumber scalar);
589
591 template <class OtherNumber>
592 [[nodiscard]] constexpr Triangle scaledDownX(const OtherNumber scalar) const;
593
595 template <class OtherNumber>
596 constexpr void scaleDownX(const OtherNumber scalar);
597
599 template <class OtherNumber>
600 [[nodiscard]] constexpr Triangle scaledDownY(const OtherNumber scalar) const;
601
603 template <class OtherNumber>
604 constexpr void scaleDownY(const OtherNumber scalar);
605
613 template <class ResultNumber = division_result_t<NumberType>>
614 [[nodiscard]] constexpr Point<ResultNumber> centroid() const;
615
623 [[nodiscard]] constexpr Disk<PointType, NoLabel> circumcircle() const;
624
632 [[nodiscard]] constexpr Segment<PointType> diameter() const;
633
641 template <class ResultNumber = division_result_t<NumberType>>
642 [[nodiscard]] constexpr Point<ResultNumber> pointInside() const;
643
652 template <class OtherShape>
653 [[nodiscard]] constexpr bool pointInsideInteriorContainedIn(const OtherShape& shape) const;
654
660 [[nodiscard]] constexpr bool isRectangle() const;
661
667 [[nodiscard]] constexpr bool isObtuse() const;
668
674 [[nodiscard]] constexpr bool isIsosceles() const;
675
683 template<PointConcept OtherPoint>
684 [[nodiscard]] constexpr bool verticesContain(const OtherPoint& point) const;
685
693 template<PointConcept OtherPoint>
694 [[nodiscard]] constexpr bool boundaryContains(const OtherPoint& point) const;
695
697 template<SegmentConcept OtherSegment>
698 [[nodiscard]] constexpr bool boundaryContains(const OtherSegment& other) const;
699
701 template<OrientedSegmentConcept OtherOrientedSegment>
702 [[nodiscard]] constexpr bool boundaryContains(const OtherOrientedSegment& other) const;
703
705 template<LineConcept OtherLine>
706 [[nodiscard]] constexpr bool boundaryContains(const OtherLine& other) const;
707
709 template<OrientedLineConcept OtherOrientedLine>
710 [[nodiscard]] constexpr bool boundaryContains(const OtherOrientedLine& other) const;
711
713 template<RayConcept OtherRay>
714 [[nodiscard]] constexpr bool boundaryContains(const OtherRay& other) const;
715
717 template<HalfplaneConcept OtherHalfplane>
718 [[nodiscard]] constexpr bool boundaryContains(const OtherHalfplane& other) const;
719
721 template<RectangleConcept OtherRectangle>
722 [[nodiscard]] constexpr bool boundaryContains(const OtherRectangle& other) const;
723
725 template<TriangleConcept OtherTriangle>
726 [[nodiscard]] constexpr bool boundaryContains(const OtherTriangle& other) const;
727
737 template<PointConcept OtherPoint>
738 [[nodiscard]] constexpr bool contains(const OtherPoint& point) const;
739
741 template<SegmentConcept OtherSegment>
742 [[nodiscard]] constexpr bool contains(const OtherSegment& other) const;
743
745 template<OrientedSegmentConcept OtherOrientedSegment>
746 [[nodiscard]] constexpr bool contains(const OtherOrientedSegment& other) const;
747
749 template<LineConcept OtherLine>
750 [[nodiscard]] constexpr bool contains(const OtherLine& other) const;
751
753 template<OrientedLineConcept OtherOrientedLine>
754 [[nodiscard]] constexpr bool contains(const OtherOrientedLine& other) const;
755
757 template<RayConcept OtherRay>
758 [[nodiscard]] constexpr bool contains(const OtherRay& other) const;
759
761 template<HalfplaneConcept OtherHalfplane>
762 [[nodiscard]] constexpr bool contains(const OtherHalfplane& other) const;
763
765 template<RectangleConcept OtherRectangle>
766 [[nodiscard]] constexpr bool contains(const OtherRectangle& other) const;
767
769 template<TriangleConcept OtherTriangle>
770 [[nodiscard]] constexpr bool contains(const OtherTriangle& other) const;
771
773 template<ConvexConcept OtherConvex>
774 [[nodiscard]] constexpr bool contains(const OtherConvex& other) const;
775
777 template<PolygonConcept OtherPolygon>
778 [[nodiscard]] constexpr bool contains(const OtherPolygon& other) const;
779
781 template<DiskConcept OtherDisk>
782 [[nodiscard]] constexpr bool contains(const OtherDisk& other) const;
783
785 [[nodiscard]] constexpr bool contains(const Shape<PointType>& other) const;
786
788 [[nodiscard]] constexpr bool boundaryContains(const Shape<PointType>& other) const;
789
790 // The empty set is a subset of every shape (contained in all of them) and
791 // disjoint from all of them, so containment is true while separation is
792 // false. These overloads let an EmptyShape flow through Shape's variant
793 // dispatch without special-casing.
795 template <class EmptyPoint>
796 [[nodiscard]] constexpr bool contains(const EmptyShape<EmptyPoint>&) const {
797 return true;
798 }
799
800 template <class EmptyPoint>
801 [[nodiscard]] constexpr bool boundaryContains(const EmptyShape<EmptyPoint>&) const {
802 return true;
803 }
804
805 template <class EmptyPoint>
806 [[nodiscard]] constexpr bool interiorContains(const EmptyShape<EmptyPoint>&) const {
807 return true;
808 }
809
810 template <class EmptyPoint>
811 [[nodiscard]] constexpr bool separates(const EmptyShape<EmptyPoint>&) const {
812 return false;
813 }
814
822 template<PointConcept OtherPoint>
823 [[nodiscard]] constexpr bool interiorContains(const OtherPoint& point) const;
824
826 template<SegmentConcept OtherSegment>
827 [[nodiscard]] constexpr bool interiorContains(const OtherSegment& other) const;
828
830 template<OrientedSegmentConcept OtherOrientedSegment>
831 [[nodiscard]] constexpr bool interiorContains(const OtherOrientedSegment& other) const;
832
834 template<LineConcept OtherLine>
835 [[nodiscard]] constexpr bool interiorContains(const OtherLine& other) const;
836
838 template<OrientedLineConcept OtherOrientedLine>
839 [[nodiscard]] constexpr bool interiorContains(const OtherOrientedLine& other) const;
840
842 template<RayConcept OtherRay>
843 [[nodiscard]] constexpr bool interiorContains(const OtherRay& other) const;
844
846 template<HalfplaneConcept OtherHalfplane>
847 [[nodiscard]] constexpr bool interiorContains(const OtherHalfplane& other) const;
848
850 template<RectangleConcept OtherRectangle>
851 [[nodiscard]] constexpr bool interiorContains(const OtherRectangle& other) const;
852
854 template<TriangleConcept OtherTriangle>
855 [[nodiscard]] constexpr bool interiorContains(const OtherTriangle& other) const;
856
864 template<PointConcept OtherPoint>
865 [[nodiscard]] constexpr bool intersects(const OtherPoint& other) const;
866
868 template<LineConcept OtherLine>
869 [[nodiscard]] constexpr bool intersects(const OtherLine& other) const;
870
872 template<OrientedLineConcept OtherOrientedLine>
873 [[nodiscard]] constexpr bool intersects(const OtherOrientedLine& other) const;
874
876 template<SegmentConcept OtherSegment>
877 [[nodiscard]] constexpr bool intersects(const OtherSegment& other) const;
878
880 template<OrientedSegmentConcept OtherOrientedSegment>
881 [[nodiscard]] constexpr bool intersects(const OtherOrientedSegment& other) const;
882
884 template<RayConcept OtherRay>
885 [[nodiscard]] constexpr bool intersects(const OtherRay& other) const;
886
888 template<HalfplaneConcept OtherHalfplane>
889 [[nodiscard]] constexpr bool intersects(const OtherHalfplane& other) const;
890
892 template<RectangleConcept OtherRectangle>
893 [[nodiscard]] constexpr bool intersects(const OtherRectangle& other) const;
894
896 template<TriangleConcept OtherTriangle>
897 [[nodiscard]] constexpr bool intersects(const OtherTriangle& other) const;
898
900 [[nodiscard]] constexpr bool intersects(const Shape<PointType>& other) const;
901
903 template<typename OtherShape>
904 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
905 [[nodiscard]] constexpr bool intersects(const OtherShape& other) const {
906 return other.intersects(*this);
907 }
908
910 template <class EmptyPoint>
911 [[nodiscard]] constexpr bool intersects(const EmptyShape<EmptyPoint>&) const {
912 return false;
913 }
914
916 template<PointConcept OtherPoint>
917 [[nodiscard]] constexpr bool interiorsIntersect(const OtherPoint& other) const;
918
920 template<LineConcept OtherLine>
921 [[nodiscard]] constexpr bool interiorsIntersect(const OtherLine& other) const;
922
924 template<OrientedLineConcept OtherOrientedLine>
925 [[nodiscard]] constexpr bool interiorsIntersect(const OtherOrientedLine& other) const;
926
928 template<SegmentConcept OtherSegment>
929 [[nodiscard]] constexpr bool interiorsIntersect(const OtherSegment& other) const;
930
932 template<OrientedSegmentConcept OtherOrientedSegment>
933 [[nodiscard]] constexpr bool interiorsIntersect(const OtherOrientedSegment& other) const;
934
936 template<RayConcept OtherRay>
937 [[nodiscard]] constexpr bool interiorsIntersect(const OtherRay& other) const;
938
940 template<HalfplaneConcept OtherHalfplane>
941 [[nodiscard]] constexpr bool interiorsIntersect(const OtherHalfplane& other) const;
942
944 template<RectangleConcept OtherRectangle>
945 [[nodiscard]] constexpr bool interiorsIntersect(const OtherRectangle& other) const;
946
948 template<TriangleConcept OtherTriangle>
949 [[nodiscard]] constexpr bool interiorsIntersect(const OtherTriangle& other) const;
950
952 template<typename OtherShape>
953 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
954 [[nodiscard]] constexpr bool interiorsIntersect(const OtherShape& other) const {
955 return other.interiorsIntersect(*this);
956 }
957
959 template <class EmptyPoint>
960 [[nodiscard]] constexpr bool interiorsIntersect(const EmptyShape<EmptyPoint>&) const {
961 return false;
962 }
963
965 [[nodiscard]] constexpr bool interiorsIntersect(const Shape<PointType>& other) const;
966
968 template<SegmentConcept OtherSegment>
969 [[nodiscard]] constexpr bool separates(const OtherSegment& other) const;
970
972 template<PointConcept OtherPoint>
973 [[nodiscard]] constexpr bool separates(const OtherPoint& other) const;
974
976 template<OrientedSegmentConcept OtherOrientedSegment>
977 [[nodiscard]] constexpr bool separates(const OtherOrientedSegment& other) const;
978
980 template<LineConcept OtherLine>
981 [[nodiscard]] constexpr bool separates(const OtherLine& other) const;
982
984 template<OrientedLineConcept OtherOrientedLine>
985 [[nodiscard]] constexpr bool separates(const OtherOrientedLine& other) const;
986
988 template<RayConcept OtherRay>
989 [[nodiscard]] constexpr bool separates(const OtherRay& other) const;
990
992 template<HalfplaneConcept OtherHalfplane>
993 [[nodiscard]] constexpr bool separates(const OtherHalfplane& other) const;
994
996 template<RectangleConcept OtherRectangle>
997 [[nodiscard]] constexpr bool separates(const OtherRectangle& other) const;
998
1000 template<TriangleConcept OtherTriangle>
1001 [[nodiscard]] constexpr bool separates(const OtherTriangle& other) const;
1002
1004 template<ConvexConcept OtherConvex>
1005 [[nodiscard]] constexpr bool separates(const OtherConvex& other) const;
1006
1008 template<DiskConcept OtherDisk>
1009 [[nodiscard]] constexpr bool separates(const OtherDisk& other) const;
1010
1012 template<PolygonConcept OtherPolygon>
1013 [[nodiscard]] constexpr bool separates(const OtherPolygon& other) const;
1014
1016 template<MonotoneChainConcept OtherChain>
1017 [[nodiscard]] constexpr bool contains(const OtherChain& other) const;
1018
1020 template<MonotoneChainConcept OtherChain>
1021 [[nodiscard]] constexpr bool boundaryContains(const OtherChain& other) const;
1022
1024 template<MonotoneChainConcept OtherChain>
1025 [[nodiscard]] constexpr bool interiorContains(const OtherChain& other) const;
1026
1028 template<MonotoneChainConcept OtherChain>
1029 [[nodiscard]] constexpr bool separates(const OtherChain& other) const;
1030
1032 template<PolylineConcept OtherPolyline>
1033 [[nodiscard]] constexpr bool contains(const OtherPolyline& other) const;
1034
1036 template<PolylineConcept OtherPolyline>
1037 [[nodiscard]] constexpr bool boundaryContains(const OtherPolyline& other) const;
1038
1040 template<PolylineConcept OtherPolyline>
1041 [[nodiscard]] constexpr bool interiorContains(const OtherPolyline& other) const;
1042
1044 template<PolylineConcept OtherPolyline>
1045 [[nodiscard]] constexpr bool separates(const OtherPolyline& other) const;
1046
1048 template<HalfplaneIntersectionConcept OtherRegion>
1049 [[nodiscard]] constexpr bool contains(const OtherRegion& other) const;
1050
1052 template<HalfplaneIntersectionConcept OtherRegion>
1053 [[nodiscard]] constexpr bool boundaryContains(const OtherRegion& other) const;
1054
1056 template<HalfplaneIntersectionConcept OtherRegion>
1057 [[nodiscard]] constexpr bool interiorContains(const OtherRegion& other) const;
1058
1060 template<HalfplaneIntersectionConcept OtherRegion>
1061 [[nodiscard]] constexpr bool separates(const OtherRegion& other) const;
1062
1070 template<PolygonWithHolesConcept OtherRegion>
1071 [[nodiscard]] constexpr bool contains(const OtherRegion& other) const;
1072
1079 template<PolygonWithHolesConcept OtherRegion>
1080 [[nodiscard]] constexpr bool boundaryContains(const OtherRegion& other) const;
1081
1083 template<PolygonWithHolesConcept OtherRegion>
1084 [[nodiscard]] constexpr bool interiorContains(const OtherRegion& other) const;
1085
1093 template<PolygonWithHolesConcept OtherRegion>
1094 [[nodiscard]] bool separates(const OtherRegion& other) const;
1095
1096 // -------------------------------------------------------------------------
1097 // A set of regions
1098 //
1099 // It outranks every other shape, so the symmetric relations reach it through
1100 // the rank-based forwarders and only the asymmetric ones are answered here.
1101 // A set is the union of its components, so it is contained exactly when
1102 // every component is — no matter what this shape is.
1103
1105 template<PolygonSetConcept OtherSet>
1106 [[nodiscard]] constexpr bool contains(const OtherSet& other) const {
1107 for (const auto& component : other) {
1108 if (!contains(component)) {
1109 return false;
1110 }
1111 }
1112 return true;
1113 }
1114
1116 template<PolygonSetConcept OtherSet>
1117 [[nodiscard]] constexpr bool boundaryContains(const OtherSet& other) const {
1118 for (const auto& component : other) {
1119 if (!boundaryContains(component)) {
1120 return false;
1121 }
1122 }
1123 return true;
1124 }
1125
1127 template<PolygonSetConcept OtherSet>
1128 [[nodiscard]] constexpr bool interiorContains(const OtherSet& other) const {
1129 for (const auto& component : other) {
1130 if (!interiorContains(component)) {
1131 return false;
1132 }
1133 }
1134 return true;
1135 }
1136
1145 template<PolygonSetConcept OtherSet>
1146 [[nodiscard]] bool separates(const OtherSet& other) const;
1147
1149 [[nodiscard]] constexpr bool separates(const Shape<PointType>& other) const;
1150
1151 // --- not-yet-implemented predicate pairs (throw); see implementation ---
1153 template<DiskConcept OtherDisk>
1154 [[nodiscard]] constexpr bool boundaryContains(const OtherDisk& other) const;
1155
1157 template<ConvexConcept OtherConvex>
1158 [[nodiscard]] constexpr bool boundaryContains(const OtherConvex& other) const;
1159
1161 template<PolygonConcept OtherPolygon>
1162 [[nodiscard]] constexpr bool boundaryContains(const OtherPolygon& other) const;
1163
1165 template<DiskConcept OtherDisk>
1166 [[nodiscard]] constexpr bool interiorContains(const OtherDisk& other) const;
1167
1169 template<ConvexConcept OtherConvex>
1170 [[nodiscard]] constexpr bool interiorContains(const OtherConvex& other) const;
1171
1173 template<PolygonConcept OtherPolygon>
1174 [[nodiscard]] constexpr bool interiorContains(const OtherPolygon& other) const;
1175
1176
1178 template<SegmentConcept OtherSegment>
1179 [[nodiscard]] constexpr bool crosses(const OtherSegment& other) const;
1180
1182 template<PointConcept OtherPoint>
1183 [[nodiscard]] constexpr bool crosses(const OtherPoint& other) const;
1184
1186 template<OrientedSegmentConcept OtherOrientedSegment>
1187 [[nodiscard]] constexpr bool crosses(const OtherOrientedSegment& other) const;
1188
1190 template<LineConcept OtherLine>
1191 [[nodiscard]] constexpr bool crosses(const OtherLine& other) const;
1192
1194 template<OrientedLineConcept OtherOrientedLine>
1195 [[nodiscard]] constexpr bool crosses(const OtherOrientedLine& other) const;
1196
1198 template<RayConcept OtherRay>
1199 [[nodiscard]] constexpr bool crosses(const OtherRay& other) const;
1200
1202 template<HalfplaneConcept OtherHalfplane>
1203 [[nodiscard]] constexpr bool crosses(const OtherHalfplane& other) const;
1204
1206 template<RectangleConcept OtherRectangle>
1207 [[nodiscard]] constexpr bool crosses(const OtherRectangle& other) const;
1208
1210 template<TriangleConcept OtherTriangle>
1211 [[nodiscard]] constexpr bool crosses(const OtherTriangle& other) const;
1212
1214 template<typename OtherShape>
1215 requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1216 [[nodiscard]] constexpr bool crosses(const OtherShape& other) const {
1217 return other.crosses(*this);
1218 }
1219
1221 template <class EmptyPoint>
1222 [[nodiscard]] constexpr bool crosses(const EmptyShape<EmptyPoint>&) const {
1223 return false;
1224 }
1225
1227 [[nodiscard]] constexpr bool crosses(const Shape<PointType>& other) const;
1228
1237 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1238 [[nodiscard]] constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
1239 intersection(const OtherPoint& other) const;
1240
1242 template <class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1243 [[nodiscard]] constexpr std::optional<std::variant<Point<ResultNumber, typename PointType::LabelType>, Segment<Point<ResultNumber, typename PointType::LabelType>>>>
1244 intersection(const OtherLine& other) const;
1245
1247 template <class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1248 [[nodiscard]] constexpr std::optional<std::variant<Point<ResultNumber, typename PointType::LabelType>, Segment<Point<ResultNumber, typename PointType::LabelType>>>>
1249 intersection(const OtherOrientedLine& other) const;
1250
1252 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1253 [[nodiscard]] constexpr std::optional<std::variant<Point<ResultNumber, typename PointType::LabelType>, Segment<Point<ResultNumber, typename PointType::LabelType>>>>
1254 intersection(const OtherSegment& other) const;
1255
1257 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1258 [[nodiscard]] constexpr std::optional<std::variant<Point<ResultNumber, typename PointType::LabelType>, Segment<Point<ResultNumber, typename PointType::LabelType>>>>
1259 intersection(const OtherOrientedSegment& other) const;
1260
1262 template <class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1263 [[nodiscard]] constexpr std::optional<std::variant<Point<ResultNumber, typename PointType::LabelType>, Segment<Point<ResultNumber, typename PointType::LabelType>>>>
1264 intersection(const OtherRay& other) const;
1265
1267 template <class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1268 [[nodiscard]] constexpr auto intersection(const OtherHalfplane& other) const;
1269
1271 template <class ResultNumber = NumberType, HalfplaneIntersectionConcept OtherRegion>
1272 [[nodiscard]] constexpr auto intersection(const OtherRegion& other) const {
1273 return other.template intersection<ResultNumber>(*this);
1274 }
1275
1277 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1278 [[nodiscard]] constexpr auto intersection(const OtherRectangle& other) const;
1279
1281 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1282 [[nodiscard]] constexpr auto intersection(const OtherTriangle& other) const;
1283
1285 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1286 requires (!PointConcept<OtherShape>
1288 && (detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1289 && requires(const OtherShape& o, const Triangle& self) {
1290 o.template intersection<ResultNumber>(self);
1291 })
1292 [[nodiscard]] constexpr auto intersection(const OtherShape& other) const {
1293 return other.template intersection<ResultNumber>(*this);
1294 }
1295
1297 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1298 requires (!PointConcept<OtherShape>
1299 && (detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1300 && requires(const OtherShape& o, const Triangle& self) {
1302 })
1303 [[nodiscard]] constexpr auto regularizedIntersection(const OtherShape& other) const {
1304 return other.template regularizedIntersection<ResultNumber>(*this);
1305 }
1306
1308 template <class ResultNumber = NumberType, class EmptyPoint>
1309 [[nodiscard]] constexpr EmptyShape<EmptyPoint> intersection(const EmptyShape<EmptyPoint>&) const {
1310 return {};
1311 }
1312
1327 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1328 [[nodiscard]] constexpr auto squaredDistance(const OtherPoint& point) const;
1329
1331 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1332 [[nodiscard]] constexpr auto squaredDistance(const OtherSegment& other) const;
1333
1335 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1336 [[nodiscard]] constexpr auto squaredDistance(const OtherOrientedSegment& other) const;
1337
1339 template <class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1340 [[nodiscard]] constexpr auto squaredDistance(const OtherLine& other) const;
1341
1343 template <class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1344 [[nodiscard]] constexpr auto squaredDistance(const OtherOrientedLine& other) const;
1345
1347 template <class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1348 [[nodiscard]] constexpr auto squaredDistance(const OtherRay& other) const;
1349
1351 template <class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1352 [[nodiscard]] constexpr auto squaredDistance(const OtherHalfplane& other) const;
1353
1355 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1356 [[nodiscard]] constexpr auto squaredDistance(const OtherRectangle& other) const;
1357
1359 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1360 [[nodiscard]] constexpr auto squaredDistance(const OtherTriangle& other) const;
1361
1368 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1369 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1370 && requires(const OtherShape& o, const Triangle& self) {
1371 o.template squaredDistance<ResultNumber>(self);
1372 })
1373 [[nodiscard]] constexpr auto squaredDistance(const OtherShape& other) const {
1374 return other.template squaredDistance<ResultNumber>(*this);
1375 }
1376
1384 template <class ResultNumber = double, class DiskPointType, class DiskLabel>
1385 [[nodiscard]] detail::floating_result_t<ResultNumber> squaredDistance(const Disk<DiskPointType, DiskLabel>& disk) const {
1386 return disk.template squaredDistance<ResultNumber>(*this);
1387 }
1388
1401 template <class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
1402 requires detail::ClosestPairConcept<Triangle<PointType_, TLabel>, OtherShape>
1403 [[nodiscard]] constexpr auto closestSegments(const OtherShape& other) const;
1404
1421 template <class ResultNumber = division_result_t<NumberType>, class OtherShape>
1422 requires detail::ClosestPointsPairConcept<Triangle<PointType_, TLabel>, OtherShape>
1423 [[nodiscard]] constexpr auto closestPoints(const OtherShape& other) const;
1424
1426 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1427 [[nodiscard]] constexpr auto distanceL1(const OtherPoint& point) const;
1428
1430 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1431 [[nodiscard]] constexpr auto distanceL1(const OtherSegment& other) const;
1432
1434 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1435 [[nodiscard]] constexpr auto distanceL1(const OtherOrientedSegment& other) const;
1436
1438 template <class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1439 [[nodiscard]] constexpr auto distanceL1(const OtherLine& other) const;
1440
1442 template <class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1443 [[nodiscard]] constexpr auto distanceL1(const OtherOrientedLine& other) const;
1444
1446 template <class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1447 [[nodiscard]] constexpr auto distanceL1(const OtherRay& other) const;
1448
1450 template <class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1451 [[nodiscard]] constexpr auto distanceL1(const OtherHalfplane& other) const;
1452
1454 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1455 [[nodiscard]] constexpr auto distanceL1(const OtherRectangle& other) const;
1456
1458 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1459 [[nodiscard]] constexpr auto distanceL1(const OtherTriangle& other) const;
1460
1467 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1468 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1469 && requires(const OtherShape& o, const Triangle& self) {
1470 o.template distanceL1<ResultNumber>(self);
1471 })
1472 [[nodiscard]] constexpr auto distanceL1(const OtherShape& other) const {
1473 return other.template distanceL1<ResultNumber>(*this);
1474 }
1475
1491 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1492 [[nodiscard]] constexpr auto intersection(const Shape<OtherPoint>& other) const {
1493 return other.template intersection<ResultNumber>(*this);
1494 }
1495
1497 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1498 [[nodiscard]] auto regularizedIntersection(const Shape<OtherPoint>& other) const {
1499 return other.template regularizedIntersection<ResultNumber>(*this);
1500 }
1501
1514 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1515 [[nodiscard]] auto regularizedUnion(const Shape<OtherPoint>& other) const {
1516 return other.template regularizedUnion<ResultNumber>(*this);
1517 }
1518
1533 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1534 [[nodiscard]] auto difference(const Shape<OtherPoint>& other) const {
1535 return Shape<OtherPoint>(*this).template difference<ResultNumber>(other);
1536 }
1537
1550 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1551 [[nodiscard]] auto symmetricDifference(const Shape<OtherPoint>& other) const {
1552 return other.template symmetricDifference<ResultNumber>(*this);
1553 }
1554
1563 template <class ResultNumber = double, PointConcept OtherPoint>
1564 [[nodiscard]] constexpr auto distanceL1(const Shape<OtherPoint>& other) const {
1565 return other.template distanceL1<ResultNumber>(*this);
1566 }
1567
1569 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1570 [[nodiscard]] constexpr auto distanceLInf(const OtherPoint& point) const;
1571
1573 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1574 [[nodiscard]] constexpr auto distanceLInf(const OtherSegment& other) const;
1575
1577 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1578 [[nodiscard]] constexpr auto distanceLInf(const OtherOrientedSegment& other) const;
1579
1581 template <class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1582 [[nodiscard]] constexpr auto distanceLInf(const OtherLine& other) const;
1583
1585 template <class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1586 [[nodiscard]] constexpr auto distanceLInf(const OtherOrientedLine& other) const;
1587
1589 template <class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1590 [[nodiscard]] constexpr auto distanceLInf(const OtherRay& other) const;
1591
1593 template <class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1594 [[nodiscard]] constexpr auto distanceLInf(const OtherHalfplane& other) const;
1595
1597 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1598 [[nodiscard]] constexpr auto distanceLInf(const OtherRectangle& other) const;
1599
1601 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1602 [[nodiscard]] constexpr auto distanceLInf(const OtherTriangle& other) const;
1603
1610 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1611 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1612 && requires(const OtherShape& o, const Triangle& self) {
1613 o.template distanceLInf<ResultNumber>(self);
1614 })
1615 [[nodiscard]] constexpr auto distanceLInf(const OtherShape& other) const {
1616 return other.template distanceLInf<ResultNumber>(*this);
1617 }
1618
1627 template <class ResultNumber = double, PointConcept OtherPoint>
1628 [[nodiscard]] constexpr auto distanceLInf(const Shape<OtherPoint>& other) const {
1629 return other.template distanceLInf<ResultNumber>(*this);
1630 }
1631
1633 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1634 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherPoint& point) const;
1635
1637 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1638 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherSegment& other) const;
1639
1641 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1642 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherOrientedSegment& other) const;
1643
1645 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1646 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherRectangle& other) const;
1647
1649 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1650 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherTriangle& other) const;
1651
1658 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1659 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1660 && requires(const OtherShape& o, const Triangle& self) {
1661 o.template hausdorffDistanceL1<ResultNumber>(self);
1662 })
1663 [[nodiscard]] constexpr auto hausdorffDistanceL1(const OtherShape& other) const {
1664 return other.template hausdorffDistanceL1<ResultNumber>(*this);
1665 }
1666
1675 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1676 [[nodiscard]] constexpr auto hausdorffDistanceL1(const Shape<OtherPoint>& other) const {
1677 return other.template hausdorffDistanceL1<ResultNumber>(*this);
1678 }
1679
1681 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1682 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherPoint& point) const;
1683
1685 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1686 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherSegment& other) const;
1687
1689 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1690 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherOrientedSegment& other) const;
1691
1693 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1694 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherRectangle& other) const;
1695
1697 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1698 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherTriangle& other) const;
1699
1706 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1707 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1708 && requires(const OtherShape& o, const Triangle& self) {
1709 o.template hausdorffDistanceLInf<ResultNumber>(self);
1710 })
1711 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const OtherShape& other) const {
1712 return other.template hausdorffDistanceLInf<ResultNumber>(*this);
1713 }
1714
1723 template <class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
1724 [[nodiscard]] constexpr auto hausdorffDistanceLInf(const Shape<OtherPoint>& other) const {
1725 return other.template hausdorffDistanceLInf<ResultNumber>(*this);
1726 }
1727
1737 template <class ResultNumber = NumberType, PointConcept OtherPoint>
1738 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherPoint& point) const;
1739
1741 template <class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1742 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherSegment& other) const;
1743
1745 template <class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1746 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherOrientedSegment& other) const;
1747
1749 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1750 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherRectangle& other) const;
1751
1753 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1754 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherTriangle& other) const;
1755
1762 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1763 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1764 && requires(const OtherShape& o, const Triangle& self) {
1766 })
1767 [[nodiscard]] constexpr auto squaredHausdorffDistance(const OtherShape& other) const {
1768 return other.template squaredHausdorffDistance<ResultNumber>(*this);
1769 }
1770
1784 template <class OtherShape>
1786 [[nodiscard]] constexpr auto minkowskiSum(const OtherShape& other) const;
1787
1811 template <class OtherShape>
1813 [[nodiscard]] constexpr auto minkowskiErosion(const OtherShape& other) const;
1814
1837 template <class OtherShape>
1840 [[nodiscard]] constexpr auto minkowskiErosion(const OtherShape& other) const;
1841
1852 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1854 && (detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1855 && requires(const OtherShape& o, const Triangle& self) {
1856 o.template minkowskiSum<ResultNumber>(self);
1857 })
1858 [[nodiscard]] auto minkowskiSum(const OtherShape& other) const {
1859 return other.template minkowskiSum<ResultNumber>(*this);
1860 }
1861
1877 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1879 regularizedUnion(const OtherTriangle& other) const;
1880
1882 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1884 regularizedUnion(const OtherRectangle& other) const;
1885
1893 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1894 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1895 && requires(const OtherShape& o, const Triangle& self) {
1896 o.template regularizedUnion<ResultNumber>(self);
1897 })
1898 [[nodiscard]] auto regularizedUnion(const OtherShape& other) const {
1899 return other.template regularizedUnion<ResultNumber>(*this);
1900 }
1901
1917 template <class ResultNumber = division_result_t<NumberType>, PolygonalRegionConcept OtherRegion>
1919 difference(const OtherRegion& other) const;
1920
1930 template <class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
1932 difference(const OtherIntersection& other) const;
1933
1940 template <class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1942 difference(const OtherHalfplane& other) const;
1943
1956 template <class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1958 symmetricDifference(const OtherTriangle& other) const;
1959
1961 template <class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1963 symmetricDifference(const OtherRectangle& other) const;
1964
1972 template <class ResultNumber = division_result_t<NumberType>, typename OtherShape>
1973 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1974 && requires(const OtherShape& o, const Triangle& self) {
1975 o.template symmetricDifference<ResultNumber>(self);
1976 })
1977 [[nodiscard]] auto symmetricDifference(const OtherShape& other) const {
1978 return other.template symmetricDifference<ResultNumber>(*this);
1979 }
1980
1982 template<PointConcept OtherPoint>
1983 constexpr Triangle& operator+=(const OtherPoint& translation);
1984
1986 template<PointConcept OtherPoint>
1987 constexpr Triangle& operator-=(const OtherPoint& translation);
1988
1990 template <class Scalar>
1991 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1992 constexpr Triangle& operator*=(const Scalar& scalar);
1993
1995 template <class Scalar>
1996 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1997 constexpr Triangle& operator/=(const Scalar& scalar);
1998
1999 template <bool Oriented>
2001 public:
2002 using iterator_category = std::forward_iterator_tag;
2003 using iterator_concept = std::forward_iterator_tag;
2005 using difference_type = std::ptrdiff_t;
2007
2008 constexpr BoundaryIterator() = default;
2009
2010 constexpr value_type operator*() const {
2011 assert(triangle != nullptr);
2012 return triangle->template boundaryAt<Oriented>(index);
2013 }
2014
2016 ++index;
2017 return *this;
2018 }
2019
2021 BoundaryIterator copy(*this);
2022 ++(*this);
2023 return copy;
2024 }
2025
2026 constexpr bool operator==(const BoundaryIterator& other) const = default;
2027
2028 private:
2029 friend struct Triangle;
2030
2031 constexpr BoundaryIterator(const Triangle* triangle_arg, std::size_t index_arg)
2032 : triangle(triangle_arg), index(index_arg) {}
2033
2034 const Triangle* triangle = nullptr;
2035 std::size_t index = 0;
2036 };
2037
2038 private:
2039 static constexpr std::size_t edgeCount = 3;
2040
2048 template <class ResultNumber, class OtherShape>
2049 constexpr ResultNumber edgeMinSquaredDistance(const OtherShape& other) const;
2050
2058 template <class ResultNumber, class OtherShape>
2059 constexpr ResultNumber vertexMinSquaredDistance(const OtherShape& other) const;
2060
2062 template <class ResultNumber, class OtherShape>
2063 constexpr ResultNumber edgeMinDistanceL1(const OtherShape& other) const;
2064
2066 template <class ResultNumber, class OtherShape>
2067 constexpr ResultNumber vertexMinDistanceL1(const OtherShape& other) const;
2068
2070 template <class ResultNumber, class OtherShape>
2071 constexpr ResultNumber edgeMinDistanceLInf(const OtherShape& other) const;
2072
2074 template <class ResultNumber, class OtherShape>
2075 constexpr ResultNumber vertexMinDistanceLInf(const OtherShape& other) const;
2076
2077 static constexpr std::array<PointType, 3> canonicalizeVertices(PointType first, PointType second, PointType third) {
2078 std::array<PointType, 3> vertices{
2079 std::move(first),
2080 std::move(second),
2081 std::move(third),
2082 };
2083
2084 if (vertices[1] < vertices[0]) {
2085 std::swap(vertices[0], vertices[1]);
2086 }
2087 if (vertices[2] < vertices[1]) {
2088 std::swap(vertices[1], vertices[2]);
2089 }
2090 if (vertices[1] < vertices[0]) {
2091 std::swap(vertices[0], vertices[1]);
2092 }
2093
2094 if (orientationDeterminant(vertices[0], vertices[1], vertices[2]) < 0) {
2095 std::swap(vertices[1], vertices[2]);
2096 }
2097
2098 return vertices;
2099 }
2100
2101 constexpr void normalize() {
2102 points_ = canonicalizeVertices(points_[0], points_[1], points_[2]);
2103 }
2104
2105 template <bool Oriented>
2106 constexpr BoundaryType<Oriented> boundaryAt(std::size_t index) const {
2107 assert(index < edgeCount);
2108
2109 switch (index) {
2110 case 0:
2111 return BoundaryType<Oriented>(a(), b());
2112 case 1:
2113 return BoundaryType<Oriented>(b(), c());
2114 default:
2115 return BoundaryType<Oriented>(c(), a());
2116 }
2117 }
2118
2119 std::array<PointType, 3> points_{};
2120 [[no_unique_address]] mutable LabelType label_{};
2121};
2122
2124template <class PointType, class LabelType, class TranslationNumber, class TranslationLabel>
2125constexpr auto operator-(const Triangle<PointType, LabelType>& triangle, const Point<TranslationNumber, TranslationLabel>& translation);
2126
2128template <class PointType, class LabelType, class Scalar>
2129 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
2130constexpr auto operator*(const Triangle<PointType, LabelType>& triangle, const Scalar& scalar);
2131
2133template <class Scalar, class PointType, class LabelType>
2134 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
2135constexpr auto operator*(const Scalar& scalar, const Triangle<PointType, LabelType>& triangle);
2136
2138template <class PointType, class LabelType, class Scalar>
2139 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
2140constexpr auto operator/(const Triangle<PointType, LabelType>& triangle, const Scalar& scalar);
2141
2143template <class PointType, class LabelType>
2144std::ostream& operator<<(std::ostream& stream, const Triangle<PointType, LabelType>& triangle);
2145
2146} // namespace pgl
constexpr value_type operator*() const
Definition triangle.hpp:2010
constexpr BoundaryIterator operator++(int)
Definition triangle.hpp:2020
std::forward_iterator_tag iterator_concept
Definition triangle.hpp:2003
constexpr bool operator==(const BoundaryIterator &other) const =default
constexpr BoundaryIterator & operator++()
Definition triangle.hpp:2015
constexpr BoundaryIterator()=default
value_type reference
Definition triangle.hpp:2006
friend struct Triangle
Definition triangle.hpp:2029
std::ptrdiff_t difference_type
Definition triangle.hpp:2005
std::forward_iterator_tag iterator_category
Definition triangle.hpp:2002
BoundaryType< Oriented > value_type
Definition triangle.hpp:2004
Bounded polygonal primitives, convex or not.
Definition forward.hpp:373
Definition forward.hpp:319
Shape pairs whose Minkowski sum Pangolin can represent.
Definition forward.hpp:476
Definition forward.hpp:306
Definition forward.hpp:324
Definition arrangement.hpp:67
HalfplaneIntersection() -> HalfplaneIntersection< Point<>, NoLabel >
Definition halfplaneintersection.hpp:2308
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
Shape(const std::variant< T, Ts... > &) -> Shape< detail::shape_point_type_t< T > >
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 orientationDeterminant(const Point< ANumber, ALabel > &a, const Point< BNumber, BLabel > &b, const Point< CNumber, CLabel > &c)
Returns the signed orientation determinant of three points.
Definition orientation.hpp:518
Triangle() -> Triangle< Point<>, NoLabel >
Definition triangle.hpp:2029
Public declaration of pgl::Rectangle.
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
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
ERational NumberType
Definition point.hpp:131
Set of closed regions with pairwise disjoint interiors.
Definition polygonset.hpp:165
Closed region bounded by one outer simple polygon minus disjoint polygonal holes.
Definition polygonwithholes.hpp:89
Closed simple polygon stored by its vertices.
Definition polygon.hpp:59
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
Closed triangle stored by three vertices.
Definition triangle.hpp:53
constexpr PolygonSet< PointType > asPolygonSet() const
Returns the triangle as a one-component set of regions.
Definition triangle.hpp:555
constexpr bool intersects(const OtherSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:169
constexpr auto squaredDistance(const OtherSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:679
constexpr bool contains(const OtherRay &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:267
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).
constexpr auto hausdorffDistanceL1(const OtherRectangle &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1058
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition triangle.hpp:1128
constexpr auto hausdorffDistanceL1(const OtherShape &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition triangle.hpp:1663
constexpr bool verticesContain(const OtherPoint &point) const
Tests whether a point equals one of the vertices.
Definition predicates.hpp:270
constexpr bool intersects(const OtherTriangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:244
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
constexpr Disk< PointType, NoLabel > circumcircle() const
Returns the circumcircle of the triangle.
Definition measures.hpp:376
constexpr bool boundaryContains(const OtherTriangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:183
TLabel LabelType
Definition triangle.hpp:59
constexpr const PointType & operator[](std::size_t index) const
Returns vertex 0, 1, or 2.
Definition triangle.hpp:169
constexpr bool crosses(const OtherRectangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:147
constexpr bool interiorsIntersect(const OtherLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:139
iterator const_iterator
Definition triangle.hpp:68
constexpr bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:602
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:801
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:223
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2117
static constexpr std::size_t size()
Returns the number of vertices (always 3).
Definition triangle.hpp:177
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherOrientedLine &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1187
constexpr bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:559
constexpr bool interiorContains(const OtherRay &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:180
constexpr auto hausdorffDistanceL1(const OtherTriangle &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1066
constexpr Triangle & operator-=(const OtherPoint &translation)
Translates all vertices by the opposite of a point in place.
constexpr auto distanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition triangle.hpp:1615
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 triangle.hpp:1724
constexpr auto operator<=>(const Triangle &other) const
Orders triangles lexicographically by their vertices, ignoring the label.
Definition triangle.hpp:281
constexpr bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4000
constexpr bool isUndefined() const
Returns whether the triangle is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:264
constexpr auto squaredHausdorffDistance(const OtherOrientedSegment &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:765
constexpr bool separates(const OtherHalfplane &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:576
constexpr auto distanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:645
constexpr bool boundaryContains(const Shape< PointType > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1143
constexpr bool separates(const Shape< PointType > &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:693
constexpr auto intersection(const OtherRectangle &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1223
constexpr const PointType & b() const
Definition triangle.hpp:217
constexpr bool crosses(const OtherTriangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:157
constexpr auto distanceL1(const OtherRay &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:672
constexpr bool contains(const OtherLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:255
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherOrientedSegment &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1201
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherLine &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1180
auto regularizedUnion(const OtherShape &other) const
Returns the regularized union of the two shapes (A ∪ B).
Definition triangle.hpp:1898
constexpr bool isPoint() const
Returns whether the triangle collapses to a single point.
Definition predicates.hpp:236
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1749
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1523
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition triangle.hpp:801
constexpr auto intersection(const OtherShape &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition triangle.hpp:1292
constexpr auto squaredHausdorffDistance(const OtherPoint &point) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:751
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:162
constexpr bool boundaryContains(const OtherPolyline &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1316
constexpr bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:535
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition triangle.hpp:796
constexpr Triangle()=default
Creates the degenerate triangle (0,0),(0,0),(0,0).
constexpr auto squaredDistance(const OtherOrientedSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:688
constexpr std::array< PointType, 3 > vertices() const
Returns the vertices in canonical order.
Definition bounding.hpp:235
constexpr auto cend() const
Returns an iterator past the last vertex.
Definition triangle.hpp:262
constexpr bool interiorsIntersect(const Shape< PointType > &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:279
constexpr auto distanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:627
constexpr auto begin() const
Returns an iterator to the first vertex.
Definition triangle.hpp:235
constexpr bool isIsosceles() const
Tests whether two sides have the same length.
Definition measures.hpp:459
constexpr auto hausdorffDistanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1042
constexpr bool separates(const OtherPoint &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:541
constexpr auto distanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:636
constexpr bool crosses(const OtherLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:123
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:279
BoundaryIterator< false > EdgeIterator
Definition triangle.hpp:76
constexpr auto distanceL1(const OtherOrientedLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:663
constexpr const PointType & a() const
Definition triangle.hpp:208
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherHalfplane &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr bool isRectangle() const
Tests whether the triangle has a right angle.
Definition measures.hpp:420
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition triangle.hpp:911
constexpr bool interiorsIntersect(const OtherRay &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:202
constexpr Segment< PointType > diameter() const
Returns a segment defining the diameter.
Definition measures.hpp:381
constexpr auto distanceLInf(const OtherLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:642
constexpr bool interiorContains(const OtherPoint &point) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:150
constexpr Triangle(PointType first, PointType second, PointType third)
Creates a triangle from three vertices.
Definition triangle.hpp:96
constexpr auto squaredHausdorffDistance(const OtherTriangle &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:781
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 triangle.hpp:1628
auto regularizedIntersection(const Shape< OtherPoint > &other) const
Re-dispatches a regularized intersection through a runtime shape.
Definition triangle.hpp:1498
constexpr bool intersects(const OtherLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:140
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:409
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:249
constexpr Triangle & operator+=(const OtherPoint &translation)
Translates all vertices by a point in place.
constexpr bool boundaryContains(const OtherConvex &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:195
constexpr Triangle scaledDownX(const OtherNumber scalar) const
Returns the triangle with its x-coordinates divided by a divisor.
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints() const
Returns the integer points the triangle contains.
Definition lattice.hpp:583
constexpr auto intersection(const OtherHalfplane &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1217
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherRectangle &other) const
Returns the regularized union of the two shapes (A ∪ B).
constexpr bool interiorsIntersect(const OtherPoint &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:132
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition triangle.hpp:1222
auto minkowskiSum(const OtherShape &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
Definition triangle.hpp:1858
constexpr bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4652
constexpr bool intersects(const OtherRectangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:220
constexpr bool crosses(const OtherOrientedLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:129
constexpr auto cbegin() const
Returns an iterator to the first vertex.
Definition triangle.hpp:244
constexpr bool contains(const OtherOrientedLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:261
constexpr void scaleUpX(const OtherNumber scalar)
Multiplies the triangle's x-coordinates by a factor in place.
Definition transformations.hpp:1341
constexpr bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:547
constexpr bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:661
constexpr A & label() const
Definition triangle.hpp:295
constexpr bool boundaryContains(const OtherOrientedLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:148
constexpr bool boundaryContains(const OtherSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:130
constexpr Triangle scaledUpX(const OtherNumber scalar) const
Returns the triangle with its x-coordinates multiplied by a factor.
constexpr auto squaredHausdorffDistance(const OtherSegment &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:757
constexpr auto squaredDistance(const OtherRay &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:715
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 triangle.hpp:1564
constexpr bool boundaryContains(const OtherOrientedSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:136
constexpr Triangle(const Triangle< OtherPointType, OtherLabelType > &other)
Converts a triangle with compatible vertex type.
Definition triangle.hpp:140
constexpr auto squaredDistance(const OtherPoint &point) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:670
constexpr OrientedEdgeIterator orientedEdgesBegin() const
Returns an iterator to the first oriented edge.
Definition triangle.hpp:459
constexpr HalfplaneIntersection< PointType > asHalfplaneIntersection() const
Returns the triangle as a half-plane intersection.
Definition triangle.hpp:512
constexpr auto distanceLInf(const OtherOrientedLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:651
constexpr auto distanceLInf(const OtherHalfplane &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:669
constexpr bool isObtuse() const
Tests whether the triangle has an obtuse angle.
Definition measures.hpp:442
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1322
constexpr bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:595
constexpr bool boundaryContains(const OtherLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:142
constexpr bool boundaryContains(const OtherPoint &point) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:123
constexpr bool intersects(const OtherRay &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:191
constexpr ResultNumber area() const
Returns the non-negative area of the triangle.
Definition measures.hpp:357
constexpr OrientedEdgeIterator orientedEdgesEnd() const
Returns an iterator past the last oriented edge.
Definition triangle.hpp:468
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:296
constexpr bool crosses(const OtherSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:105
constexpr void scaleUpY(const OtherNumber scalar)
Multiplies the triangle's y-coordinates by a factor in place.
Definition transformations.hpp:1355
detail::floating_result_t< ResultNumber > squaredDistance(const Disk< DiskPointType, DiskLabel > &disk) const
Returns the squared Euclidean distance to a disk.
Definition triangle.hpp:1385
constexpr auto end() const
Returns an iterator past the last vertex.
Definition triangle.hpp:253
constexpr bool interiorsIntersect(const OtherRectangle &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:220
constexpr bool intersects(const OtherOrientedSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:185
constexpr bool isSegment() const
Returns whether the triangle collapses to a non-degenerate segment.
Definition predicates.hpp:249
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:215
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1328
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:302
constexpr bool operator==(const Triangle &other) const
Compares triangles lexicographically by canonical vertices.
Definition triangle.hpp:272
constexpr NumberType twiceArea() const
Returns twice the area of the triangle.
Definition measures.hpp:351
constexpr auto distanceL1(const OtherLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:654
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherIntersection &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr bool crosses(const Shape< PointType > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:162
constexpr bool interiorsIntersect(const OtherSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:185
constexpr bool boundaryContains(const OtherHalfplane &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:160
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 triangle.hpp:1492
constexpr bool intersects(const OtherOrientedLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:163
constexpr auto hausdorffDistanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition triangle.hpp:1711
constexpr bool intersects(const OtherPoint &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:134
constexpr auto hausdorffDistanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1036
constexpr bool interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:192
constexpr Triangle scaledDownY(const OtherNumber scalar) const
Returns the triangle with its y-coordinates divided by a divisor.
EPoint PointType
Definition triangle.hpp:55
constexpr auto squaredDistance(const OtherRectangle &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:733
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 triangle.hpp:1676
auto regularizedUnion(const Shape< OtherPoint > &other) const
Returns the regularized union of the two shapes (A ∪ B), re-dispatching through the wrapper's own reg...
Definition triangle.hpp:1515
constexpr bool intersects(const OtherHalfplane &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:206
constexpr bool crosses(const OtherRay &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:135
constexpr Rectangle< PointType > bbox() const
Returns the axis-aligned bounding box of the vertices.
Definition bounding.hpp:224
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5972
constexpr auto regularizedIntersection(const OtherShape &other) const
Forwards a regularized intersection to the shape that owns it.
Definition triangle.hpp:1303
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:319
constexpr auto hausdorffDistanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1038
constexpr bool interiorContains(const OtherSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:156
auto symmetricDifference(const Shape< OtherPoint > &other) const
Returns the regularized symmetric difference of the two shapes (A △ B), re-dispatching through the wr...
Definition triangle.hpp:1551
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition triangle.hpp:1309
constexpr bool boundaryContains(const OtherRay &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:154
constexpr bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:565
constexpr bool boundaryContains(const OtherPolygon &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1040
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:634
constexpr void rotate90(int k=1)
Rotates the triangle by 90k degrees around the origin in place.
Definition transformations.hpp:1327
constexpr std::optional< BoundaryType< false > > getIfSegment() const
Returns the segment the triangle collapses to, if it does.
Definition predicates.hpp:255
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:243
constexpr auto distanceL1(const OtherHalfplane &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:681
constexpr Triangle(NumberType x1, NumberType y1, NumberType x2, NumberType y2, NumberType x3, NumberType y3, A &&label)
Same as the six-coordinate constructor, and stores a label.
Definition triangle.hpp:128
constexpr bool boundaryContains(const OtherDisk &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1034
constexpr Polygon< PointType > asPolygon() const
Returns the triangle as a simple polygon.
Definition triangle.hpp:533
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherTriangle &other) const
Returns the regularized union of the two shapes (A ∪ B).
std::ptrdiff_t difference_type
Definition triangle.hpp:64
constexpr Triangle scaledUpY(const OtherNumber scalar) const
Returns the triangle with its y-coordinates multiplied by a factor.
constexpr auto distanceL1(const OtherTriangle &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:699
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherRegion &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr Rectangle< Point< ResultNumber > > fbox() const
Returns a floating-point bounding box containing the triangle.
Definition bounding.hpp:230
constexpr auto hausdorffDistanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1050
constexpr Convex< PointType > convexHull() const
Returns the convex hull of the triangle's vertices.
Definition triangle.hpp:499
constexpr Convex< PointType > asConvex() const
Returns the triangle as a convex polygon.
Definition triangle.hpp:490
constexpr bool contains(const Shape< PointType > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:330
constexpr bool isDegenerate() const
Tests whether the three vertices are collinear.
Definition predicates.hpp:223
auto symmetricDifference(const OtherShape &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
Definition triangle.hpp:1977
constexpr auto squaredHausdorffDistance(const OtherRectangle &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:773
constexpr auto squaredDistance(const OtherTriangle &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:742
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:1989
const PointType & const_reference
Definition triangle.hpp:66
constexpr EdgeIterator edgesEnd() const
Returns an iterator past the last unoriented edge.
Definition triangle.hpp:443
constexpr void scaleDownY(const OtherNumber scalar)
Divides the triangle's y-coordinates by a divisor in place.
Definition transformations.hpp:1383
BoundaryIterator< true > OrientedEdgeIterator
Definition triangle.hpp:77
constexpr bool crosses(const OtherHalfplane &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:141
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition triangle.hpp:1106
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition triangle.hpp:1117
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition triangle.hpp:905
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition triangle.hpp:960
constexpr bool interiorsIntersect(const OtherOrientedSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:196
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1714
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2437
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition triangle.hpp:954
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherSegment &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1194
constexpr auto squaredDistance(const OtherShape &other) const
Returns the squared Euclidean distance to the given shape.
Definition triangle.hpp:1373
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:1170
constexpr bool contains(const OtherHalfplane &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:273
constexpr PolygonWithHoles< PointType > asPolygonWithHoles() const
Returns the triangle as a hole-free region.
Definition triangle.hpp:543
constexpr auto squaredDistance(const OtherOrientedLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:706
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition triangle.hpp:1216
constexpr bool interiorsIntersect(const OtherTriangle &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:254
constexpr auto closestPoints(const OtherShape &other) const
Returns the pair of points realizing the distance, nothing when the shapes meet.
Definition closest.hpp:363
constexpr bool interiorContains(const OtherLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:168
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 triangle.hpp:185
constexpr bool interiorsIntersect(const OtherHalfplane &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:211
auto difference(const Shape< OtherPoint > &other) const
Returns the regularized set difference of the two shapes (A ∖ B), re-dispatching through the wrapper'...
Definition triangle.hpp:1534
constexpr auto distanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:624
constexpr std::optional< PointType > getIfPoint() const
Returns the point the triangle collapses to, if it does.
Definition predicates.hpp:241
constexpr bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:553
constexpr bool crosses(const OtherOrientedSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:117
constexpr std::ptrdiff_t index(const PointType &point) const
Definition triangle.hpp:194
constexpr Triangle(PointType first, PointType second, PointType third, A &&label)
Creates a triangle from three vertices and stores a label.
Definition triangle.hpp:121
constexpr bool interiorsIntersect(const OtherOrientedLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:162
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
constexpr Point< ResultNumber > pointInside() const
Returns a point inside the triangle.
Definition measures.hpp:401
std::conditional_t< Oriented, OrientedSegment< PointType >, Segment< PointType > > BoundaryType
Definition triangle.hpp:71
const PointType & reference
Definition triangle.hpp:65
constexpr bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:582
constexpr auto squaredDistance(const OtherLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:697
constexpr auto distanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:633
constexpr bool intersects(const Shape< PointType > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:262
constexpr auto distanceL1(const OtherRectangle &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:690
constexpr void scaleDownX(const OtherNumber scalar)
Divides the triangle's x-coordinates by a divisor in place.
Definition transformations.hpp:1369
constexpr auto hausdorffDistanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1024
constexpr auto hausdorffDistanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1030
constexpr auto distanceLInf(const OtherRay &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:660
PointType::NumberType NumberType
Definition triangle.hpp:57
constexpr bool boundaryContains(const OtherChain &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1207
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherRectangle &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:2028
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherRay &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1208
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5717
constexpr Triangle(NumberType x1, NumberType y1, NumberType x2, NumberType y2, NumberType x3, NumberType y3)
Creates a triangle from six coordinates.
Definition triangle.hpp:109
constexpr bool separates(const EmptyShape< EmptyPoint > &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition triangle.hpp:811
constexpr bool boundaryContains(const OtherRectangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:166
constexpr std::array< Segment< PointType >, 3 > edges() const
Returns the three unoriented boundary edges.
Definition bounding.hpp:240
constexpr Triangle rotated90(int k=1) const
Returns the triangle rotated by 90k degrees around the origin.
Definition transformations.hpp:1322
constexpr auto hausdorffDistanceLInf(const OtherTriangle &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1054
constexpr const PointType & c() const
Definition triangle.hpp:226
constexpr auto distanceLInf(const OtherRectangle &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:678
constexpr bool interiorContains(const OtherHalfplane &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:186
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2815
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:209
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherTriangle &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition triangle.hpp:806
constexpr auto distanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:615
constexpr auto intersection(const OtherRegion &other) const
Adds this triangle's three constraints to a half-plane intersection without deriving vertices.
Definition triangle.hpp:1272
constexpr auto closestSegments(const OtherShape &other) const
Returns the pair of elements realizing the distance, nothing when the shapes meet.
Definition closest.hpp:356
constexpr auto distanceL1(const OtherShape &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition triangle.hpp:1472
std::size_t size_type
Definition triangle.hpp:63
typename std::array< PointType, 3 >::const_iterator iterator
Definition triangle.hpp:67
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1782
constexpr auto intersection(const OtherTriangle &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1233
constexpr bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3195
constexpr std::array< OrientedSegment< PointType >, 3 > orientedEdges() const
Returns the three oriented boundary edges.
Definition bounding.hpp:249
constexpr bool interiorContains(const OtherOrientedLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:174
constexpr auto squaredHausdorffDistance(const OtherShape &other) const
Returns the squared Hausdorff distance to the given shape.
Definition triangle.hpp:1767
constexpr Point< ResultNumber > centroid() const
Returns the arithmetic centroid.
Definition measures.hpp:364
constexpr auto distanceLInf(const OtherTriangle &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:687
PointType value_type
Definition triangle.hpp:62
constexpr bool crosses(const OtherPoint &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:111
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2075
constexpr auto hausdorffDistanceLInf(const OtherRectangle &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1046
constexpr EdgeIterator edgesBegin() const
Returns an iterator to the first unoriented edge.
Definition triangle.hpp:434
constexpr auto squaredDistance(const OtherHalfplane &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:724