28template <
class Number,
class Label>
29template<Po
intConcept OtherPo
int>
31 using Compare = std::common_type_t<Number, typename OtherPoint::NumberType>;
32 return detail::asNumber<Compare>(
x()) == detail::asNumber<Compare>(other.x()) &&
33 detail::asNumber<Compare>(
y()) == detail::asNumber<Compare>(other.y());
36template <
class Number,
class Label>
37template<Po
intConcept OtherPo
int>
39 using Compare = std::common_type_t<Number, typename OtherPoint::NumberType>;
40 if (
auto cmp = detail::strongOrder(detail::asNumber<Compare>(
x()), detail::asNumber<Compare>(other.x())); cmp != 0) {
43 return detail::strongOrder(detail::asNumber<Compare>(
y()), detail::asNumber<Compare>(other.y()));
53template <
class Po
intType,
class LabelType>
58template <
class Po
intType,
class LabelType>
63template <
class Po
intType,
class LabelType>
71template <
class Po
intType,
class LabelType>
76template <
class Po
intType,
class LabelType>
78 return min().x() ==
max().x();
81template <
class Po
intType,
class LabelType>
83 return min().y() ==
max().y();
86template <
class Po
intType,
class LabelType>
87template<SegmentConcept OtherSegment>
88constexpr bool Segment<PointType, LabelType>::boundingBoxesOverlap(
const OtherSegment& other)
const {
89 using Compare = std::common_type_t<NumberType, typename OtherSegment::NumberType>;
90 const auto& a = min();
91 const auto& b = max();
92 const auto& c = other.min();
93 const auto& d = other.max();
94 const Compare thisMinX =
static_cast<Compare
>(a.x());
95 const Compare thisMaxX =
static_cast<Compare
>(b.x());
96 const Compare otherMinX =
static_cast<Compare
>(c.x());
97 const Compare otherMaxX =
static_cast<Compare
>(d.x());
98 if (thisMaxX < otherMinX || otherMaxX < thisMinX) {
101 const Compare thisY1 =
static_cast<Compare
>(a.y());
102 const Compare thisY2 =
static_cast<Compare
>(b.y());
103 const Compare otherY1 =
static_cast<Compare
>(c.y());
104 const Compare otherY2 =
static_cast<Compare
>(d.y());
105 const Compare thisMinY = thisY1 < thisY2 ? thisY1 : thisY2;
106 const Compare thisMaxY = thisY1 < thisY2 ? thisY2 : thisY1;
107 const Compare otherMinY = otherY1 < otherY2 ? otherY1 : otherY2;
108 const Compare otherMaxY = otherY1 < otherY2 ? otherY2 : otherY1;
109 return !(thisMaxY < otherMinY || otherMaxY < thisMinY);
112template <
class Po
intType,
class LabelType>
113template<SegmentConcept OtherSegment>
114constexpr int Segment<PointType, LabelType>::boundingBoxesCross(
const OtherSegment& other)
const {
115 using Compare = std::common_type_t<NumberType, typename OtherSegment::NumberType>;
116 const auto& a = min();
117 const auto& b = max();
118 const auto& c = other.min();
119 const auto& d = other.max();
120 const Compare thisMinX =
static_cast<Compare
>(a.x());
121 const Compare thisMaxX =
static_cast<Compare
>(b.x());
122 const Compare otherMinX =
static_cast<Compare
>(c.x());
123 const Compare otherMaxX =
static_cast<Compare
>(d.x());
124 if (thisMaxX < otherMinX || otherMaxX < thisMinX) {
127 const Compare thisY1 =
static_cast<Compare
>(a.y());
128 const Compare thisY2 =
static_cast<Compare
>(b.y());
129 const Compare otherY1 =
static_cast<Compare
>(c.y());
130 const Compare otherY2 =
static_cast<Compare
>(d.y());
131 const Compare thisMinY = thisY1 < thisY2 ? thisY1 : thisY2;
132 const Compare thisMaxY = thisY1 < thisY2 ? thisY2 : thisY1;
133 const Compare otherMinY = otherY1 < otherY2 ? otherY1 : otherY2;
134 const Compare otherMaxY = otherY1 < otherY2 ? otherY2 : otherY1;
135 if (thisMaxY < otherMinY || otherMaxY < thisMinY) {
138 if (thisMinX < otherMinX && otherMaxX < thisMaxX && otherMinY < thisMinY && thisMaxY < otherMaxY ) {
141 if (otherMinX < thisMinX && thisMaxX < otherMaxX && thisMinY < otherMinY && otherMaxY < thisMaxY ) {
147template <
class Po
intType,
class LabelType>
148template<Po
intConcept OtherPo
int>
150 return point ==
min() || point ==
max();
153template <
class Po
intType,
class LabelType>
154template<Po
intConcept OtherPo
int>
159template <
class Po
intType,
class LabelType>
160template<Po
intConcept OtherPo
int>
162 return !(point <
min() ||
max() < point);
165template <
class Po
intType,
class LabelType>
166template<Po
intConcept OtherPo
int>
169 return point ==
min();
174template <
class Po
intType,
class LabelType>
175template<SegmentConcept OtherSegment>
180template <
class Po
intType,
class LabelType>
181template<SegmentConcept OtherSegment>
186template <
class Po
intType,
class LabelType>
187template<OrientedSegmentConcept OtherOrientedSegment>
192template <
class Po
intType,
class LabelType>
193template<LineConcept OtherLine>
198template <
class Po
intType,
class LabelType>
199template<OrientedLineConcept OtherOrientedLine>
204template <
class Po
intType,
class LabelType>
205template<RayConcept OtherRay>
210template <
class Po
intType,
class LabelType>
211template<OrientedSegmentConcept OtherOrientedSegment>
222template <
class Po
intType,
class LabelType>
235template <
class Po
intType,
class LabelType>
237 return a() ==
b() &&
b() ==
c();
240template <
class Po
intType,
class LabelType>
248template <
class Po
intType,
class LabelType>
253template <
class Po
intType,
class LabelType>
254constexpr std::optional<typename Triangle<PointType, LabelType>::template BoundaryType<false>>
263template <
class Po
intType,
class LabelType>
268template <
class Po
intType,
class LabelType>
269template<Po
intConcept OtherPo
int>
271 return a().contains(point) ||
b().contains(point) ||
c().contains(point);
280template <
class Po
intType,
class LabelType>
285template <
class Po
intType,
class LabelType>
290template <
class Po
intType,
class LabelType>
298template <
class Po
intType,
class LabelType>
303template <
class Po
intType,
class LabelType>
308template <
class Po
intType,
class LabelType>
313template <
class Po
intType,
class LabelType>
314template<Po
intConcept OtherPo
int>
319template <
class Po
intType,
class LabelType>
320template<Po
intConcept OtherPo
int>
325template <
class Po
intType,
class LabelType>
326template<Po
intConcept OtherPo
int>
328 return !(point <
min() ||
max() < point);
331template <
class Po
intType,
class LabelType>
332template<Po
intConcept OtherPo
int>
340template <
class Po
intType,
class LabelType>
341template<SegmentConcept OtherSegment>
346template <
class Po
intType,
class LabelType>
347template<OrientedSegmentConcept OtherOrientedSegment>
352template <
class Po
intType,
class LabelType>
353template<LineConcept OtherLine>
358template <
class Po
intType,
class LabelType>
359template<OrientedLineConcept OtherOrientedLine>
364template <
class Po
intType,
class LabelType>
365template<RayConcept OtherRay>
370template <
class Po
intType,
class LabelType>
371template<Po
intConcept OtherPo
int>
376template <
class Po
intType,
class LabelType>
377template<SegmentConcept OtherSegment>
382template <
class Po
intType,
class LabelType>
383template<OrientedSegmentConcept OtherOrientedSegment>
388template <
class Po
intType,
class LabelType>
389template<LineConcept OtherLine>
391 return other.parallel(*
this);
394template <
class Po
intType,
class LabelType>
395template<OrientedLineConcept OtherOrientedLine>
397 return other.parallel(*
this);
400template <
class Po
intType,
class LabelType>
401template<RayConcept OtherRay>
403 return other.parallel(*
this);
406template <
class Po
intType,
class LabelType>
411template <
class Po
intType,
class LabelType>
422template <
class Po
intType,
class LabelType>
427template <
class Po
intType,
class LabelType>
433 return std::strong_ordering::less;
436 return std::strong_ordering::greater;
438 return detail::strongOrder(
min().
x(), other.
min().x());
440 using otherNumber = std::remove_cvref_t<
decltype(other.
min().
x())>;
441 using Coordinate = detail::promoted_number_t<std::common_type_t<NumberType, otherNumber>>;
444 if (
auto cmp = detail::strongOrder(anum * other_den, other_anum * den); cmp != 0) {
447 return detail::strongOrder(bnum * other_den, other_bnum * den);
450template <
class Po
intType,
class LabelType>
455template <
class Po
intType,
class LabelType>
460template <
class Po
intType,
class LabelType>
462 return min().x() ==
max().x();
465template <
class Po
intType,
class LabelType>
467 return min().y() ==
max().y();
470template <
class Po
intType,
class LabelType>
471template<LineConcept OtherLine>
473 return other.parallel(*
this);
476template <
class Po
intType,
class LabelType>
477template<Po
intConcept OtherPo
int>
479 return point ==
min() || point ==
max();
482template <
class Po
intType,
class LabelType>
483template<Po
intConcept OtherPo
int>
488template <
class Po
intType,
class LabelType>
489template<SegmentConcept OtherSegment>
494template <
class Po
intType,
class LabelType>
495template<OrientedSegmentConcept OtherOrientedSegment>
500template <
class Po
intType,
class LabelType>
501template<LineConcept OtherLine>
506template <
class Po
intType,
class LabelType>
507template<LineConcept OtherLine>
512template <
class Po
intType,
class LabelType>
513template<SegmentConcept OtherSegment>
518template <
class Po
intType,
class LabelType>
519template<OrientedSegmentConcept OtherOrientedSegment>
524template <
class Po
intType,
class LabelType>
525template<OrientedLineConcept OtherOrientedLine>
530template <
class Po
intType,
class LabelType>
531template<RayConcept OtherRay>
536template <
class Po
intType,
class LabelType>
537template<OrientedLineConcept OtherOrientedLine>
542template <
class Po
intType,
class LabelType>
543template<RayConcept OtherRay>
548template <
class Po
intType,
class LabelType>
553template <
class Po
intType,
class LabelType>
564template <
class Po
intType,
class LabelType>
569template <
class Po
intType,
class LabelType>
575 const bool otherAscending = other.
source() < other.
target();
576 if (ascending != otherAscending) {
577 return ascending ? std::strong_ordering::less : std::strong_ordering::greater;
582template <
class Po
intType,
class LabelType>
587template <
class Po
intType,
class LabelType>
592template <
class Po
intType,
class LabelType>
597template <
class Po
intType,
class LabelType>
602template <
class Po
intType,
class LabelType>
603template<OrientedLineConcept OtherOrientedLine>
605 return other.parallel(*
this);
608template <
class Po
intType,
class LabelType>
609template<Po
intConcept OtherPo
int>
614template <
class Po
intType,
class LabelType>
615template<Po
intConcept OtherPo
int>
620template <
class Po
intType,
class LabelType>
621template<LineConcept OtherLine>
626template <
class Po
intType,
class LabelType>
627template<OrientedLineConcept OtherOrientedLine>
632template <
class Po
intType,
class LabelType>
633template<SegmentConcept OtherSegment>
638template <
class Po
intType,
class LabelType>
639template<OrientedSegmentConcept OtherOrientedSegment>
644template <
class Po
intType,
class LabelType>
645template<RayConcept OtherRay>
650template <
class Po
intType,
class LabelType>
651template<Po
intConcept OtherPo
int>
656template <
class Po
intType,
class LabelType>
657template<LineConcept OtherLine>
662template <
class Po
intType,
class LabelType>
663template<OrientedLineConcept OtherOrientedLine>
668template <
class Po
intType,
class LabelType>
669template<SegmentConcept OtherSegment>
674template <
class Po
intType,
class LabelType>
675template<OrientedSegmentConcept OtherOrientedSegment>
680template <
class Po
intType,
class LabelType>
681template<RayConcept OtherRay>
683 return other.parallel(*
this);
686template <
class Po
intType,
class LabelType>
691template <
class Po
intType,
class LabelType>
696template <
class Po
intType,
class LabelType>
701template <
class Po
intType,
class LabelType>
712template <
class Po
intType,
class LabelType>
717template <
class Po
intType,
class LabelType>
722 using otherPointType = std::remove_cvref_t<
decltype(other.
source())>;
726template <
class Po
intType,
class LabelType>
731template <
class Po
intType,
class LabelType>
736template <
class Po
intType,
class LabelType>
741template <
class Po
intType,
class LabelType>
746template <
class Po
intType,
class LabelType>
747template<Po
intConcept OtherPo
int>
752template <
class Po
intType,
class LabelType>
753template<Po
intConcept OtherPo
int>
759 return !(point <
source());
761 return !(
source() < point);
764template <
class Po
intType,
class LabelType>
765template<Po
intConcept OtherPo
int>
767 return this->
asLine().contains(point);
770template <
class Po
intType,
class LabelType>
771template<LineConcept OtherLine>
773 return this->
asLine().contains(other);
776template <
class Po
intType,
class LabelType>
777template<OrientedLineConcept OtherOrientedLine>
779 return this->
asLine().contains(other.asLine());
782template <
class Po
intType,
class LabelType>
783template<SegmentConcept OtherSegment>
785 return this->
asLine().contains(other);
788template <
class Po
intType,
class LabelType>
789template<OrientedSegmentConcept OtherOrientedSegment>
791 return this->
asLine().contains(other);
794template <
class Po
intType,
class LabelType>
795template<RayConcept OtherRay>
797 return this->
asLine().contains(other.asLine());
800template <
class Po
intType,
class LabelType>
801template<Po
intConcept OtherPo
int>
806template <
class Po
intType,
class LabelType>
807template<LineConcept OtherLine>
812template <
class Po
intType,
class LabelType>
813template<OrientedLineConcept OtherOrientedLine>
818template <
class Po
intType,
class LabelType>
819template<SegmentConcept OtherSegment>
824template <
class Po
intType,
class LabelType>
825template<OrientedSegmentConcept OtherOrientedSegment>
830template <
class Po
intType,
class LabelType>
831template<RayConcept OtherRay>
836template <
class Po
intType,
class LabelType>
837template<RayConcept OtherRay>
839 return other.parallel(*
this);
842template <
class Po
intType,
class LabelType>
847template <
class Po
intType,
class LabelType>
852template <
class Po
intType,
class LabelType>
857template <
class Po
intType,
class LabelType>
868template <
class Po
intType,
class LabelType>
875template <
class Po
intType,
class LabelType>
880template <
class Po
intType,
class LabelType>
888template <
class Po
intType,
class LabelType>
893template <
class Po
intType,
class LabelType>
894constexpr std::optional<typename Rectangle<PointType, LabelType>::template BoundaryType<false>>
902template <
class Po
intType,
class LabelType>
907template <
class Po
intType,
class LabelType>
908template <
class Left,
class Right>
909constexpr bool Rectangle<PointType, LabelType>::intervalsOverlap(
const Left& first_min,
const Left& first_max,
const Right& second_min,
const Right& second_max) {
910 return !(first_max < second_min) && !(second_max < first_min);
913template <
class Po
intType,
class LabelType>
914template <
class Left,
class Right>
915constexpr bool Rectangle<PointType, LabelType>::intervalsOverlapStrict(
const Left& first_min,
const Left& first_max,
const Right& second_min,
const Right& second_max) {
916 return first_min < second_max && second_min < first_max;
919template <
class Po
intType,
class LabelType>
920template<Po
intConcept OtherPo
int>
926 return (point ==
min() ||
927 point == bottomRight() ||
929 point == topLeft()) && !
empty();
939template <
class Po
intType,
class LabelType>
941 using otherPointType = std::remove_cvref_t<
decltype(other.
source())>;
945template <
class Po
intType,
class LabelType>
947 using otherPointType = std::remove_cvref_t<
decltype(other.
source())>;
951template <
class Po
intType,
class LabelType>
956template <
class Po
intType,
class LabelType>
961template <
class Po
intType,
class LabelType>
966template <
class Po
intType,
class LabelType>
971template <
class Po
intType,
class LabelType>
972template<Po
intConcept OtherPo
int>
981template <
class Po
intType,
class LabelType>
986template <
class Po
intType,
class LabelType>
990 return size() == 1 || (
size() == 2 && (*this)[0] == (*this)[1]);
993template <
class Po
intType,
class LabelType>
1001template <
class Po
intType,
class LabelType>
1003 return size() == 2 && (*this)[0] != (*this)[1];
1006template <
class Po
intType,
class LabelType>
1007constexpr std::optional<typename Convex<PointType, LabelType>::template BoundaryType<false>>
1010 return std::nullopt;
1015template <
class Po
intType,
class LabelType>
1021template <
class Po
intType,
class LabelType>
1023 assert(
size() != 0);
1024 if (maxIndex_ >= 0) {
1025 return static_cast<size_t>(maxIndex_);
1028 const size_t n =
size();
1033 size_t mid = lo + (hi - lo) / 2;
1037 if (points_[mid] < points_[mid + 1]) {
1045 maxIndex_ =
static_cast<std::ptrdiff_t
>(lo);
1049template <
class Po
intType,
class LabelType>
1050template<Po
intConcept OtherPo
int>
1052 if (points_.empty()) {
1055 using CommonNumberType = std::common_type_t<NumberType, typename OtherPoint::NumberType>;
1059 if (points_.size() == 1) {
1060 return translatedPoint == points_[0];
1062 if (points_.size() == 2) {
1063 return translatedPoint == points_[0] || translatedPoint == points_[1];
1065 if (points_.size() == 3) {
1066 return translatedPoint == points_[0] || translatedPoint == points_[1] || translatedPoint == points_[2];
1071 auto o =
orientationSign(points_[0], points_[max_i], translatedPoint);
1073 return std::binary_search(points_.begin(), points_.begin() + max_i + 1, translatedPoint, lexLessCrossType);
1076 return std::binary_search(std::make_reverse_iterator(points_.end()),
1077 std::make_reverse_iterator(points_.begin() + max_i),
1078 translatedPoint, lexLessCrossType);
1081 return translatedPoint == points_[0] || translatedPoint == points_[max_i];
1084template <
class Po
intType,
class LabelType>
1086 const std::ptrdiff_t n =
static_cast<std::ptrdiff_t
>(points_.size());
1091 const PointType translatedPoint = point - translation_;
1096 for (std::ptrdiff_t i = 0; i < n; ++i) {
1097 if (points_[
static_cast<std::size_t
>(i)] == translatedPoint) {
1104 const std::size_t max_i =
maxIndex();
1110 const auto o =
orientationSign(points_[0], points_[max_i], translatedPoint);
1113 const auto first = points_.begin();
1114 const auto last = points_.begin() + max_i + 1;
1115 const auto it = std::lower_bound(first, last, translatedPoint, lexLessCrossType);
1116 if (it != last && *it == translatedPoint) {
1117 return it - points_.begin();
1124 const auto rfirst = std::make_reverse_iterator(points_.end());
1125 const auto rlast = std::make_reverse_iterator(points_.begin() + max_i);
1126 const auto rit = std::lower_bound(rfirst, rlast, translatedPoint, lexLessCrossType);
1127 if (rit != rlast && *rit == translatedPoint) {
1128 return (rit.base() - 1) - points_.begin();
1135 if (translatedPoint == points_[0]) {
1138 if (translatedPoint == points_[max_i]) {
1139 return static_cast<std::ptrdiff_t
>(max_i);
1151template <
class Po
intType,
class LabelType>
1156template <
class Po
intType,
class LabelType>
1157constexpr std::optional<typename HalfplaneIntersection<PointType, LabelType>::HalfplaneType>
1160 return std::nullopt;
1165template <
class Po
intType,
class LabelType>
1173template <
class Po
intType,
class LabelType>
1176 return std::nullopt;
1180 return (*
this)[0].asLine();
1183template <
class Po
intType,
class LabelType>
1191template <
class Po
intType,
class LabelType>
1192template <
class ResultNumber>
1193constexpr std::optional<Ray<Point<ResultNumber, typename PointType::LabelType>>>
1196 return std::nullopt;
1202 for (std::size_t i = 0; i <
size(); ++i) {
1208 return std::nullopt;
1211template <
class Po
intType,
class LabelType>
1217 return std::holds_alternative<ExactPoint>(detail::degenerateRegionCarrier(*
this));
1220template <
class Po
intType,
class LabelType>
1221template <
class ResultNumber>
1222constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
1225 return std::nullopt;
1231template <
class Po
intType,
class LabelType>
1237 return std::holds_alternative<Segment<ExactPoint>>(detail::degenerateRegionCarrier(*
this));
1240template <
class Po
intType,
class LabelType>
1241template <
class ResultNumber>
1242constexpr std::optional<Segment<Point<ResultNumber, typename PointType::LabelType>>>
1245 return std::nullopt;
1251 const auto [low, high] = std::ranges::minmax_element(verts);
Implementations of the 'boundaryContains' predicate.
Implementations of the 'contains' predicate.
Implementations of the 'crosses' predicate.
Implementations of the 'interiorContains' predicate.
Implementations of the 'interiorsIntersect' predicate.
Implementations of the 'intersects' predicate.
Definition arrangement.hpp:67
@ y
Definition intervaltree.hpp:24
@ x
Definition intervaltree.hpp:24
Rectangle() -> Rectangle< Point<>, NoLabel >
Definition rectangle.hpp:2384
@ edge
Definition bitmatrix.hpp:37
constexpr bool sameDirection(const Point< ANumber, ALabel > &a1, const Point< ANumber, ALabel > &a2, const Point< BNumber, BLabel > &b1, const Point< BNumber, BLabel > &b2)
Tests whether the directions a1 -> a2 and b1 -> b2 are parallel.
Definition orientation.hpp:673
constexpr std::partial_ordering orientationSign(const Point< ANumber, ALabel > &a, const Point< BNumber, BLabel > &b, const Point< CNumber, CLabel > &c)
Classifies the orientation of three points.
Definition orientation.hpp:544
constexpr bool collinear(const Point< ANumber, ALabel > &a, const Point< BNumber, BLabel > &b, const Point< CNumber, CLabel > &c)
Tests whether three points are collinear.
Definition orientation.hpp:651
Segment() -> Segment< Point<>, NoLabel >
Small dispatch traits and geometry helpers reused by the implementations.
Implementations of the 'separates' predicate.
std::conditional_t< Oriented, OrientedSegment< PointType >, Segment< PointType > > BoundaryType
Definition convex.hpp:177
constexpr std::optional< PointType > getIfPoint() const
Returns the point the convex polygon collapses to, if it does.
Definition predicates.hpp:994
constexpr bool isDegenerate() const
Checks if the convex polygon is degenerate (has zero area).
Definition predicates.hpp:982
constexpr std::ptrdiff_t index(const PointType &point) const
Returns the smallest index i with (*this)[i] == point, or -1 if point is not a vertex.
Definition predicates.hpp:1085
constexpr size_t maxIndex() const
Returns the index of the maximum vertex (rightmost and highest in case of ties).
Definition predicates.hpp:1022
constexpr bool verticesContain(const OtherPoint &point) const
Checks if the vertices list contains the given point.
Definition predicates.hpp:1051
constexpr bool isSegment() const
Returns whether the convex polygon collapses to a non-degenerate segment.
Definition predicates.hpp:1002
constexpr std::optional< BoundaryType< false > > getIfSegment() const
Returns the segment the convex polygon collapses to, if it does.
Definition predicates.hpp:1008
constexpr bool isPoint() const
Returns whether the convex polygon collapses to a single point.
Definition predicates.hpp:987
constexpr bool isUndefined() const
Returns whether the convex polygon is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:1016
size_t size() const
Returns the number of vertices in the convex polygon.
Definition convex.hpp:840
PointType_ PointType
Definition convex.hpp:171
constexpr std::optional< Segment< Point< ResultNumber, typename PointType::LabelType > > > getIfSegment() const
Returns the segment the region collapses to, if it is one.
Definition predicates.hpp:1243
constexpr bool empty() const
Returns whether the region is the empty set.
Definition halfplaneintersection.hpp:649
constexpr bool isHalfplane() const
Returns whether the region is exactly one closed half-plane.
Definition predicates.hpp:1152
constexpr std::vector< Point< ResultNumber, typename PointType::LabelType > > vertices() const
Returns every vertex of the region, in pair-index order (for a bounded region: counterclockwise).
Definition halfplaneintersection.hpp:890
constexpr bool isSegment() const
Returns whether the region is a segment of positive length.
Definition predicates.hpp:1232
constexpr bool isBounded() const
Returns whether the region is bounded.
Definition halfplaneintersection.hpp:811
constexpr bool isDegenerate() const
Returns whether the region has empty interior (it is empty or lower-dimensional: a line,...
Definition halfplaneintersection.hpp:664
constexpr std::optional< Ray< Point< ResultNumber, typename PointType::LabelType > > > getIfRay() const
Returns the ray the region equals, if it is one.
Definition predicates.hpp:1194
constexpr std::size_t size() const
Returns the number of stored (non-redundant) half-planes.
Definition halfplaneintersection.hpp:596
constexpr std::size_t vertexCount() const
Returns the number of vertices of the region.
Definition halfplaneintersection.hpp:833
constexpr bool isPoint() const
Returns whether the region is a single point.
Definition predicates.hpp:1212
constexpr std::optional< HalfplaneType > getIfHalfplane() const
Returns the half-plane the region equals, if it is one.
Definition predicates.hpp:1158
constexpr bool isRay() const
Returns whether the region is exactly one ray.
Definition predicates.hpp:1184
constexpr bool isLine() const
Returns whether the region is exactly one line.
Definition predicates.hpp:1166
constexpr std::optional< Line< PointType > > getIfLine() const
Returns the line the region equals, if it is one.
Definition predicates.hpp:1174
constexpr std::optional< Point< ResultNumber, typename PointType::LabelType > > getIfPoint() const
Returns the point the region collapses to, if it is one.
Definition predicates.hpp:1223
Closed half-plane defined by an oriented boundary line.
Definition halfplane.hpp:51
constexpr auto operator<=>(const Halfplane &other) const
Provides an ordering compatible with half-plane equality.
Definition predicates.hpp:946
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether the given point is one of the stored defining points.
Definition predicates.hpp:973
constexpr bool isVertical() const
Returns whether the boundary line is vertical.
Definition predicates.hpp:962
constexpr bool operator==(const Halfplane &other) const
Tests equality of the represented half-plane.
Definition predicates.hpp:940
constexpr const PointType & target() const
Returns the target boundary point.
Definition halfplane.hpp:193
constexpr bool isUndefined() const
Returns whether the half-plane is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:957
constexpr bool isHorizontal() const
Returns whether the boundary line is horizontal.
Definition predicates.hpp:967
constexpr const PointType & source() const
Returns the source boundary point.
Definition halfplane.hpp:181
constexpr bool isDegenerate() const
Returns whether the defining points coincide.
Definition predicates.hpp:952
constexpr Halfplane()=default
Creates the degenerate half-plane (0,0)->(0,0).
constexpr bool isHorizontal() const
Returns whether the line is horizontal.
Definition predicates.hpp:466
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:428
constexpr auto dualCoordinates() const
Returns normalized dual-line coordinates for the supporting line.
Definition duality.hpp:69
constexpr const PointType & max() const
Returns the largest stored defining point.
Definition line.hpp:189
constexpr bool isUndefined() const
Returns whether the line is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:456
constexpr bool isVertical() const
Returns whether the line is vertical.
Definition predicates.hpp:461
constexpr bool collinear(const OtherPoint &point) const
Returns whether the line interior contains the given point.
Definition predicates.hpp:484
constexpr bool parallel(const OtherLine &other) const
Returns whether another line is parallel to this line.
Definition predicates.hpp:508
constexpr const PointType & min() const
Returns the smallest stored defining point.
Definition line.hpp:180
constexpr Halfplane< PointType > halfplaneAbove() const
Returns the half-plane geometrically above this line.
Definition predicates.hpp:549
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether the given point is one of the stored defining points.
Definition predicates.hpp:478
constexpr Line()=default
Creates the degenerate line (0,0)--(0,0).
constexpr bool isDegenerate() const
Returns whether the defining points coincide.
Definition predicates.hpp:451
constexpr Halfplane< PointType > halfplaneBelow() const
Returns the half-plane geometrically below this line.
Definition predicates.hpp:554
constexpr auto operator<=>(const Line &other) const
Provides an ordering compatible with geometric equality.
Definition predicates.hpp:428
constexpr bool operator==(const Line &other) const
Tests geometric equality of two lines.
Definition predicates.hpp:423
Directed infinite line with left/right side semantics plus optional line label.
Definition orientedline.hpp:53
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:531
constexpr bool operator==(const OrientedLine &other) const
Tests equality of the represented oriented line.
Definition predicates.hpp:565
constexpr Halfplane< PointType > leftHalfplane() const
Returns the half-plane on the left of the oriented line.
Definition predicates.hpp:702
constexpr const PointType & target() const
Returns the target defining point.
Definition orientedline.hpp:195
constexpr Halfplane< PointType > rightHalfplane() const
Returns the half-plane on the right of the oriented line.
Definition predicates.hpp:697
constexpr auto operator<=>(const OrientedLine &other) const
Provides an ordering compatible with oriented-line equality.
Definition predicates.hpp:570
constexpr bool collinear(const OtherPoint &point) const
Returns whether the given point is collinear with the oriented line.
Definition predicates.hpp:616
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether the given point is one of the stored defining points.
Definition predicates.hpp:610
constexpr const PointType & max() const
Returns the lexicographically largest defining point.
Definition orientedline.hpp:216
constexpr OrientedLine()=default
Creates the degenerate oriented line (0,0)--(0,0).
constexpr std::partial_ordering orientation(const OtherPoint &point) const
Returns the orientation sign of a point with respect to the line.
Definition predicates.hpp:652
constexpr bool isDegenerate() const
Returns whether the defining points coincide.
Definition predicates.hpp:583
constexpr Line< PointType > asLine() const
Returns the line without orientation.
Definition orientedline.hpp:321
constexpr const PointType & source() const
Returns the source defining point.
Definition orientedline.hpp:183
constexpr Halfplane< PointType > halfplaneBelow() const
Returns the half-plane geometrically below the supporting line.
Definition predicates.hpp:692
constexpr bool isUndefined() const
Returns whether the line is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:588
constexpr bool isVertical() const
Returns whether the line is vertical.
Definition predicates.hpp:593
constexpr const PointType & min() const
Returns the lexicographically smallest defining point.
Definition orientedline.hpp:207
constexpr bool isHorizontal() const
Returns whether the line is horizontal.
Definition predicates.hpp:598
constexpr Halfplane< PointType > halfplaneAbove() const
Returns the half-plane geometrically above the supporting line.
Definition predicates.hpp:687
constexpr bool parallel(const OtherLine &other) const
Returns whether the given line is parallel to the oriented line.
Definition predicates.hpp:658
constexpr Halfplane< PointType > rightHalfplane() const
Returns the half-plane on the right of the segment direction.
Definition predicates.hpp:407
constexpr const PointType & min() const
Returns the lexicographically smallest endpoint.
Definition orientedsegment.hpp:202
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether one endpoint equals the given point.
Definition predicates.hpp:315
constexpr bool containsEndpoint(const OtherPoint &point) const
Returns whether the given point is one endpoint.
Definition predicates.hpp:321
constexpr const PointType & source() const
Returns the source endpoint.
Definition orientedsegment.hpp:178
constexpr bool isUndefined() const
Returns whether the segment is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:299
constexpr bool isDegenerate() const
Returns whether both endpoints coincide.
Definition predicates.hpp:281
constexpr const PointType & max() const
Returns the lexicographically largest endpoint.
Definition orientedsegment.hpp:211
constexpr std::partial_ordering orientation(const OtherPoint &point) const
Returns the orientation sign of a point with respect to the segment.
Definition predicates.hpp:372
constexpr std::optional< PointType > getIfPoint() const
Returns the point the segment collapses to, if it does.
Definition predicates.hpp:291
constexpr bool isPoint() const
Returns whether the segment collapses to a single point.
Definition predicates.hpp:286
constexpr const PointType & target() const
Returns the target endpoint.
Definition orientedsegment.hpp:190
constexpr bool isVertical() const
Returns whether the segment is vertical.
Definition predicates.hpp:304
constexpr Halfplane< PointType > leftHalfplane() const
Returns the half-plane on the left of the segment direction.
Definition predicates.hpp:412
constexpr bool containsCollinear(const OtherPoint &point) const
Returns whether the segment contains the given point that is collinear with the segment.
Definition predicates.hpp:327
constexpr bool isHorizontal() const
Returns whether the segment is horizontal.
Definition predicates.hpp:309
constexpr bool collinear(const OtherPoint &point) const
Returns whether the given point is collinear with the oriented segment.
Definition predicates.hpp:333
constexpr bool parallel(const OtherSegment &other) const
Returns whether the given segment is parallel to the oriented segment.
Definition predicates.hpp:378
Two-dimensional point with optional label payload.
Definition point.hpp:129
constexpr bool operator==(const OtherPoint &other) const
Tests coordinate equality.
Definition predicates.hpp:30
constexpr std::strong_ordering operator<=>(const OtherPoint &other) const
Provides lexicographic ordering on (x, y).
Definition predicates.hpp:38
Half-infinite line starting from one source point plus optional ray label.
Definition ray.hpp:51
constexpr Halfplane< PointType > halfplaneAbove() const
Returns the half-plane geometrically above the supporting line.
Definition predicates.hpp:843
constexpr Halfplane< PointType > leftHalfplane() const
Returns the half-plane on the left of the ray direction.
Definition predicates.hpp:858
constexpr bool isVertical() const
Returns whether the ray is vertical.
Definition predicates.hpp:737
constexpr Halfplane< PointType > rightHalfplane() const
Returns the half-plane on the right of the ray direction.
Definition predicates.hpp:853
constexpr std::partial_ordering orientation(const OtherPoint &point) const
Returns the orientation sign of a point with respect to the ray.
Definition predicates.hpp:802
constexpr bool collinear(const OtherPoint &point) const
Returns whether the given point is collinear with the ray.
Definition predicates.hpp:766
constexpr bool operator==(const Ray &other) const
Tests equality of the represented ray.
Definition predicates.hpp:713
constexpr bool parallel(const OtherLine &other) const
Returns whether the given line is parallel to the ray.
Definition predicates.hpp:808
constexpr bool containsCollinear(const OtherPoint &point) const
Returns whether the ray contains the given point that is collinear with the ray.
Definition predicates.hpp:754
constexpr Ray()=default
Creates the degenerate ray (0,0)--(0,0)->.
constexpr auto operator<=>(const Ray &other) const
Provides an ordering compatible with ray equality.
Definition predicates.hpp:718
constexpr bool isDegenerate() const
Returns whether the defining points coincide.
Definition predicates.hpp:727
constexpr const PointType & max() const
Returns the lexicographically largest stored defining point.
Definition ray.hpp:214
constexpr const PointType & target() const
Returns the second stored point defining the direction.
Definition ray.hpp:193
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether the given point is one of the stored defining points.
Definition predicates.hpp:748
constexpr bool isHorizontal() const
Returns whether the ray is horizontal.
Definition predicates.hpp:742
constexpr Halfplane< PointType > halfplaneBelow() const
Returns the half-plane geometrically below the supporting line.
Definition predicates.hpp:848
constexpr const PointType & min() const
Returns the lexicographically smallest stored defining point.
Definition ray.hpp:205
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:625
constexpr Line< PointType > asLine() const
Returns the supporting line without orientation.
Definition ray.hpp:319
constexpr bool isUndefined() const
Returns whether the ray is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:732
constexpr const PointType & source() const
Returns the source point of the ray.
Definition ray.hpp:181
constexpr std::optional< PointType > getIfPoint() const
Returns the point the rectangle collapses to, if it does.
Definition predicates.hpp:881
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether a point is one of the rectangle vertices.
Definition predicates.hpp:921
std::conditional_t< Oriented, OrientedSegment< PointType >, Segment< PointType > > BoundaryType
Selects unordered or oriented boundary segments.
Definition rectangle.hpp:88
constexpr bool isPoint() const
Returns whether the rectangle collapses to a single point.
Definition predicates.hpp:876
constexpr bool isDegenerate() const
Returns whether the rectangle has empty interior.
Definition predicates.hpp:869
constexpr const PointType & min() const
Returns the minimum corner (min x, min y).
Definition rectangle.hpp:347
constexpr bool empty() const
Returns whether the rectangle is the empty set of points.
Definition rectangle.hpp:290
constexpr bool isSegment() const
Returns whether the rectangle collapses to a non-degenerate segment.
Definition predicates.hpp:889
constexpr bool isUndefined() const
Returns whether the rectangle is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:903
constexpr const PointType & max() const
Returns the maximum corner (max x, max y).
Definition rectangle.hpp:359
constexpr std::optional< BoundaryType< false > > getIfSegment() const
Returns the segment the rectangle collapses to, if it does.
Definition predicates.hpp:895
Unoriented closed segment between two endpoints plus optional segment label.
Definition segment.hpp:58
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether one endpoint equals the given point.
Definition predicates.hpp:149
constexpr bool isDegenerate() const
Returns whether both endpoints coincide.
Definition predicates.hpp:54
constexpr bool isUndefined() const
Returns whether the segment is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:72
constexpr bool containsCollinear(const OtherPoint &point) const
Returns whether the segment contains the given point that is collinear with the segment.
Definition predicates.hpp:161
constexpr bool isHorizontal() const
Returns whether the segment is horizontal.
Definition predicates.hpp:82
constexpr const PointType & max() const
Returns the largest stored endpoint.
Definition segment.hpp:199
constexpr const PointType & min() const
Returns the smallest stored endpoint.
Definition segment.hpp:190
constexpr bool isPoint() const
Returns whether the segment collapses to a single point.
Definition predicates.hpp:59
constexpr bool containsEndpoint(const OtherPoint &point) const
Returns whether the given point is one endpoint.
Definition predicates.hpp:155
constexpr bool collinear(const OtherPoint &point) const
Returns whether the given point lies on the supporting line.
Definition predicates.hpp:167
constexpr bool isVertical() const
Returns whether the segment is vertical.
Definition predicates.hpp:77
constexpr bool parallel(const OtherSegment &other) const
Returns whether another segment is parallel to this one.
Definition predicates.hpp:182
constexpr std::optional< PointType > getIfPoint() const
Returns the point the segment collapses to, if it does.
Definition predicates.hpp:64
constexpr bool verticesContain(const OtherPoint &point) const
Tests whether a point equals one of the vertices.
Definition predicates.hpp:270
constexpr bool isUndefined() const
Returns whether the triangle is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:264
constexpr const PointType & b() const
Returns the second vertex.
Definition triangle.hpp:217
constexpr bool isPoint() const
Returns whether the triangle collapses to a single point.
Definition predicates.hpp:236
constexpr const PointType & a() const
Returns the first vertex.
Definition triangle.hpp:208
constexpr bool isSegment() const
Returns whether the triangle collapses to a non-degenerate segment.
Definition predicates.hpp:249
constexpr std::optional< BoundaryType< false > > getIfSegment() const
Returns the segment the triangle collapses to, if it does.
Definition predicates.hpp:255
constexpr bool isDegenerate() const
Tests whether the three vertices are collinear.
Definition predicates.hpp:223
constexpr std::optional< PointType > getIfPoint() const
Returns the point the triangle collapses to, if it does.
Definition predicates.hpp:241
std::conditional_t< Oriented, OrientedSegment< PointType >, Segment< PointType > > BoundaryType
Definition triangle.hpp:71
constexpr const PointType & c() const
Returns the third vertex.
Definition triangle.hpp:226