28template <
class Po
intType = Po
int<>,
class Label>
33template <
class Po
intType>
36template <
class Po
intType,
class A>
39template <
class Number>
51template <
class Po
intType_,
class TLabel>
58 static_assert(detail::is_point_v<PointType>,
"Line requires pgl::Point defining points");
63 constexpr Line() =
default;
75 std::swap(first, second);
77 points_[0] = std::move(first);
78 points_[1] = std::move(second);
100 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
102 :
Line(std::move(first), std::move(second)) {
103 label_ = std::forward<A>(
label);
108 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
118 template<Po
intConcept OtherPo
intType,
class OtherLabelType>
119 requires(std::constructible_from<PointType, const OtherPointType&>)
122 label_ = detail::copyLabel<LabelType>(other);
126 template<Po
intConcept OtherPo
intType,
class OtherLabelType>
127 requires(std::constructible_from<PointType, const OtherPointType&>)
131 label_ = detail::copyLabel<LabelType>(other);
143 return points_[
index];
149 static constexpr std::size_t
size() {
158 const std::ptrdiff_t n =
static_cast<std::ptrdiff_t
>(
size());
159 return (*
this)[
static_cast<std::size_t
>(((
index % n) + n) % n)];
167 for (std::ptrdiff_t i = 0; i < static_cast<std::ptrdiff_t>(
size()); ++i) {
168 if ((*
this)[
static_cast<std::size_t
>(i)] == point) {
199 return points_.cbegin();
208 return points_.cbegin();
216 constexpr auto end()
const {
217 return points_.cend();
226 return points_.cend();
240 template<AnyShapeConcept OtherShape>
241 [[nodiscard]]
constexpr bool samePointSet(
const OtherShape& other)
const;
260 template <
class A = LabelType>
261 requires(detail::has_label_v<A>)
276 template<Po
intConcept OtherPo
int>
300 template<
class ResultNumber = division_result_t<NumberType>>
310 template<
class ResultNumber = division_result_t<NumberType>>
321 template <
class ResultNumber = NumberType>
322 [[nodiscard]]
constexpr ResultNumber
area()
const;
349 template <
class OtherNumber>
353 template <
class OtherNumber>
357 template <
class OtherNumber>
361 template <
class OtherNumber>
365 template <
class OtherNumber>
369 template <
class OtherNumber>
373 template <
class OtherNumber>
377 template <
class OtherNumber>
422 template<Po
intConcept OtherPo
int>
435 template<Po
intConcept OtherPo
int>
440 template<SegmentConcept OtherSegment>
443 template<OrientedSegmentConcept OtherOrientedSegment>
444 [[nodiscard]]
constexpr bool boundaryContains(
const OtherOrientedSegment&)
const {
return false; }
446 template<LineConcept OtherLine>
449 template<OrientedLineConcept OtherOrientedLine>
450 [[nodiscard]]
constexpr bool boundaryContains(
const OtherOrientedLine&)
const {
return false; }
452 template<RayConcept OtherRay>
455 template<HalfplaneConcept OtherHalfplane>
456 [[nodiscard]]
constexpr bool boundaryContains(
const OtherHalfplane&)
const {
return false; }
458 template<RectangleConcept OtherRectangle>
459 [[nodiscard]]
constexpr bool boundaryContains(
const OtherRectangle&)
const {
return false; }
461 template<TriangleConcept OtherTriangle>
462 [[nodiscard]]
constexpr bool boundaryContains(
const OtherTriangle&)
const {
return false; }
464 template<ConvexConcept OtherConvex>
467 template<PolygonConcept OtherPolygon>
470 template<DiskConcept OtherDisk>
484 template<Po
intConcept OtherPo
int>
485 [[nodiscard]]
constexpr bool contains(
const OtherPoint& point)
const;
495 template<LineConcept OtherLine>
496 [[nodiscard]]
constexpr bool contains(
const OtherLine& other)
const;
506 template<SegmentConcept OtherSegment>
507 [[nodiscard]]
constexpr bool contains(
const OtherSegment& other)
const;
517 template<OrientedSegmentConcept OtherOrientedSegment>
518 [[nodiscard]]
constexpr bool contains(
const OtherOrientedSegment& other)
const;
521 template<OrientedLineConcept OtherOrientedLine>
522 [[nodiscard]]
constexpr bool contains(
const OtherOrientedLine& other)
const;
525 template<RayConcept OtherRay>
526 [[nodiscard]]
constexpr bool contains(
const OtherRay& other)
const;
529 template<HalfplaneConcept OtherHalfplane>
530 [[nodiscard]]
constexpr bool contains(
const OtherHalfplane& other)
const;
533 template<RectangleConcept OtherRectangle>
534 [[nodiscard]]
constexpr bool contains(
const OtherRectangle& other)
const;
537 template<TriangleConcept OtherTriangle>
538 [[nodiscard]]
constexpr bool contains(
const OtherTriangle& other)
const;
541 template<ConvexConcept OtherConvex>
542 [[nodiscard]]
constexpr bool contains(
const OtherConvex& other)
const;
545 template<PolygonConcept OtherPolygon>
546 [[nodiscard]]
constexpr bool contains(
const OtherPolygon& other)
const;
549 template<DiskConcept OtherDisk>
550 [[nodiscard]]
constexpr bool contains(
const OtherDisk& other)
const;
563 template <
class EmptyPo
int>
568 template <
class EmptyPo
int>
573 template <
class EmptyPo
int>
578 template <
class EmptyPo
int>
584 template<Po
intConcept OtherPo
int>
588 template<LineConcept OtherLine>
592 template<SegmentConcept OtherSegment>
596 template<OrientedSegmentConcept OtherOrientedSegment>
600 template<OrientedLineConcept OtherOrientedLine>
604 template<RayConcept OtherRay>
608 template<HalfplaneConcept OtherHalfplane>
612 template<RectangleConcept OtherRectangle>
616 template<TriangleConcept OtherTriangle>
628 template<Po
intConcept OtherPo
int>
629 [[nodiscard]]
constexpr bool collinear(
const OtherPoint& point)
const;
639 template<SegmentConcept OtherSegment>
640 [[nodiscard]]
constexpr bool collinear(
const OtherSegment& other)
const;
650 template<OrientedSegmentConcept OtherOrientedSegment>
651 [[nodiscard]]
constexpr bool collinear(
const OtherOrientedSegment& other)
const;
661 template<LineConcept OtherLine>
662 [[nodiscard]]
constexpr bool collinear(
const OtherLine& other)
const;
671 template<OrientedLineConcept OtherOrientedLine>
672 [[nodiscard]]
constexpr bool collinear(
const OtherOrientedLine& other)
const;
681 template<RayConcept OtherRay>
682 [[nodiscard]]
constexpr bool collinear(
const OtherRay& other)
const;
693 template <
class ResultNumber = division_result_t<NumberType>>
694 [[nodiscard]]
constexpr ResultNumber
slope()
const;
708 template <
class ResultNumber = division_result_t<NumberType>,
class OtherNumber>
709 [[nodiscard]]
constexpr std::optional<ResultNumber>
yAtX(
const OtherNumber&
x)
const;
723 template <
class ResultNumber = division_result_t<NumberType>,
class OtherNumber>
724 [[nodiscard]]
constexpr std::optional<ResultNumber>
xAtY(
const OtherNumber&
y)
const;
752 template<LineConcept OtherLine>
753 [[nodiscard]]
constexpr bool parallel(
const OtherLine& other)
const;
763 template<SegmentConcept OtherSegment>
764 [[nodiscard]]
constexpr bool parallel(
const OtherSegment& other)
const;
774 template<OrientedSegmentConcept OtherOrientedSegment>
775 [[nodiscard]]
constexpr bool parallel(
const OtherOrientedSegment& other)
const;
784 template<OrientedLineConcept OtherOrientedLine>
785 [[nodiscard]]
constexpr bool parallel(
const OtherOrientedLine& other)
const;
794 template<RayConcept OtherRay>
795 [[nodiscard]]
constexpr bool parallel(
const OtherRay& other)
const;
798 template<Po
intConcept OtherPo
int>
799 [[nodiscard]]
constexpr bool intersects(
const OtherPoint& other)
const;
809 template<LineConcept OtherLine>
810 [[nodiscard]]
constexpr bool intersects(
const OtherLine& other)
const;
813 template<SegmentConcept OtherSegment>
814 [[nodiscard]]
constexpr bool intersects(
const OtherSegment& other)
const;
817 template<OrientedSegmentConcept OtherOrientedSegment>
818 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedSegment& other)
const;
824 template<
typename OtherShape>
826 [[nodiscard]]
constexpr bool intersects(
const OtherShape& other)
const {
827 return other.intersects(*
this);
831 template <
class EmptyPo
int>
846 template<Po
intConcept OtherPo
int>
850 template<LineConcept OtherLine>
854 template<SegmentConcept OtherSegment>
858 template<OrientedSegmentConcept OtherOrientedSegment>
862 template<
typename OtherShape>
865 return other.interiorsIntersect(*
this);
869 template <
class EmptyPo
int>
885 template<LineConcept OtherLine>
886 [[nodiscard]]
constexpr bool crosses(
const OtherLine& other)
const;
889 template<Po
intConcept OtherPo
int>
890 [[nodiscard]]
constexpr bool crosses(
const OtherPoint& other)
const;
893 template<SegmentConcept OtherSegment>
894 [[nodiscard]]
constexpr bool crosses(
const OtherSegment& other)
const;
897 template<OrientedSegmentConcept OtherOrientedSegment>
898 [[nodiscard]]
constexpr bool crosses(
const OtherOrientedSegment& other)
const;
901 template<
typename OtherShape>
903 [[nodiscard]]
constexpr bool crosses(
const OtherShape& other)
const {
904 return other.crosses(*
this);
908 template <
class EmptyPo
int>
917 template<Po
intConcept OtherPo
int>
918 [[nodiscard]]
constexpr bool separates(
const OtherPoint& other)
const;
921 template<SegmentConcept OtherSegment>
922 [[nodiscard]]
constexpr bool separates(
const OtherSegment& other)
const;
925 template<OrientedSegmentConcept OtherOrientedSegment>
926 [[nodiscard]]
constexpr bool separates(
const OtherOrientedSegment& other)
const;
929 template<LineConcept OtherLine>
930 [[nodiscard]]
constexpr bool separates(
const OtherLine& other)
const;
933 template<OrientedLineConcept OtherOrientedLine>
934 [[nodiscard]]
constexpr bool separates(
const OtherOrientedLine& other)
const;
937 template<RayConcept OtherRay>
938 [[nodiscard]]
constexpr bool separates(
const OtherRay& other)
const;
941 template<RectangleConcept OtherRectangle>
942 [[nodiscard]]
constexpr bool separates(
const OtherRectangle& other)
const;
945 template<TriangleConcept OtherTriangle>
946 [[nodiscard]]
constexpr bool separates(
const OtherTriangle& other)
const;
949 template<HalfplaneConcept OtherHalfplane>
950 [[nodiscard]]
constexpr bool separates(
const OtherHalfplane& other)
const;
953 template<ConvexConcept OtherConvex>
954 [[nodiscard]]
constexpr bool separates(
const OtherConvex& other)
const;
957 template<DiskConcept OtherDisk>
958 [[nodiscard]]
constexpr bool separates(
const OtherDisk& other)
const;
961 template<PolygonConcept OtherPolygon>
962 [[nodiscard]]
constexpr bool separates(
const OtherPolygon& other)
const;
965 template<MonotoneChainConcept OtherChain>
966 [[nodiscard]]
constexpr bool contains(
const OtherChain& other)
const;
969 template<MonotoneChainConcept OtherChain>
973 template<MonotoneChainConcept OtherChain>
977 template<MonotoneChainConcept OtherChain>
978 [[nodiscard]]
constexpr bool separates(
const OtherChain& other)
const;
981 template<PolylineConcept OtherPolyline>
982 [[nodiscard]]
constexpr bool contains(
const OtherPolyline& other)
const;
985 template<PolylineConcept OtherPolyline>
986 [[nodiscard]]
constexpr bool boundaryContains(
const OtherPolyline&)
const {
return false; }
989 template<PolylineConcept OtherPolyline>
993 template<PolylineConcept OtherPolyline>
994 [[nodiscard]]
constexpr bool separates(
const OtherPolyline& other)
const;
997 template<HalfplaneIntersectionConcept OtherRegion>
998 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1001 template<HalfplaneIntersectionConcept OtherRegion>
1005 template<HalfplaneIntersectionConcept OtherRegion>
1009 template<HalfplaneIntersectionConcept OtherRegion>
1010 [[nodiscard]]
constexpr bool separates(
const OtherRegion& other)
const;
1019 template<PolygonWithHolesConcept OtherRegion>
1020 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1028 template<PolygonWithHolesConcept OtherRegion>
1032 template<PolygonWithHolesConcept OtherRegion>
1042 template<PolygonWithHolesConcept OtherRegion>
1043 [[nodiscard]]
bool separates(
const OtherRegion& other)
const;
1054 template<PolygonSetConcept OtherSet>
1055 [[nodiscard]]
constexpr bool contains(
const OtherSet& other)
const {
1056 for (
const auto& component : other) {
1065 template<PolygonSetConcept OtherSet>
1067 for (
const auto& component : other) {
1076 template<PolygonSetConcept OtherSet>
1078 for (
const auto& component : other) {
1094 template<PolygonSetConcept OtherSet>
1102 template<DiskConcept OtherDisk>
1106 template<ConvexConcept OtherConvex>
1110 template<PolygonConcept OtherPolygon>
1125 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
1126 [[nodiscard]]
constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
1130 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1135 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1136 [[nodiscard]]
constexpr auto intersection(
const OtherSegment& other)
const;
1139 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1140 [[nodiscard]]
constexpr auto intersection(
const OtherOrientedSegment& other)
const;
1143 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1145 && (detail::shapeRank<OtherShape> > detail::shapeRank<Line>)
1146 &&
requires(
const OtherShape& o,
const Line& self) {
1154 template <
class ResultNumber = NumberType,
class EmptyPo
int>
1177 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1195 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1216 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1220 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1229 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1230 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Line>)
1231 &&
requires(
const OtherShape& o,
const Line& self) {
1245 template <
class ResultNumber =
double,
class DiskPo
intType,
class DiskLabel>
1265 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
1266 requires detail::ClosestPointsPairConcept<Line<PointType_, TLabel>, OtherShape>
1270 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1271 [[nodiscard]]
constexpr auto distanceL1(
const OtherPoint& point)
const;
1274 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1275 [[nodiscard]]
constexpr auto distanceL1(
const OtherLine& other)
const;
1278 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1279 [[nodiscard]]
constexpr auto distanceL1(
const OtherSegment& other)
const;
1282 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1283 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedSegment& other)
const;
1291 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1292 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Line>)
1293 &&
requires(
const OtherShape& o,
const Line& self) {
1296 [[nodiscard]]
constexpr auto distanceL1(
const OtherShape& other)
const {
1315 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1328 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
1334 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1338 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1342 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1343 [[nodiscard]]
constexpr auto distanceLInf(
const OtherSegment& other)
const;
1346 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1347 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedSegment& other)
const;
1355 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1356 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Line>)
1357 &&
requires(
const OtherShape& o,
const Line& self) {
1372 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
1393 template <
class OtherShape>
1420 template <
class OtherShape>
1432 template<Po
intConcept OtherPo
int>
1443 template<Po
intConcept OtherPo
int>
1453 template <
class Scalar>
1455 constexpr Line&
operator*=(
const Scalar& scalar);
1464 template <
class Scalar>
1466 constexpr Line&
operator/=(
const Scalar& scalar);
1475 template <
class ResultNumber = NumberType>
1485 template <
class OtherShape>
1495 template<
class ResultNumber>
1499 template <
class OtherNumber>
1500 using promoted_number_t = std::common_type_t<CoordinateType, detail::promoted_number_t<OtherNumber>>;
1502 template<
class ResultNumber>
1503 [[nodiscard]]
constexpr auto polarCoordinates()
const;
1505 std::array<PointType, 2> points_{};
1506 [[no_unique_address]]
mutable LabelType label_{};
1519template <
class Po
intType,
class LabelType,
class TranslationNumber,
class TranslationLabel>
1531template <
class Po
intType,
class LabelType,
class Scalar>
1544template <
class Scalar,
class Po
intType,
class LabelType>
1557template <
class Po
intType,
class LabelType,
class Scalar>
1569template <
class Po
intType,
class LabelType>
Shape pairs whose Minkowski sum Pangolin can represent.
Definition forward.hpp:476
Definition forward.hpp:306
Public declaration of pgl::Halfplane.
Definition arrangement.hpp:67
HalfplaneIntersection() -> HalfplaneIntersection< Point<>, NoLabel >
Definition halfplaneintersection.hpp:2308
@ y
Definition intervaltree.hpp:24
@ x
Definition intervaltree.hpp:24
Line() -> Line< Point<>, NoLabel >
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
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
OrientedLine() -> OrientedLine< Point<>, NoLabel >
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
Closed half-plane defined by an oriented boundary line.
Definition halfplane.hpp:51
Unoriented infinite line.
Definition line.hpp:52
constexpr bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:878
constexpr Point< ResultNumber > pointInside() const
Returns a point inside the line.
Definition measures.hpp:197
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:569
constexpr bool isHorizontal() const
Returns whether the line is horizontal.
Definition predicates.hpp:466
constexpr bool boundaryContains(const OtherHalfplane &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:456
constexpr Line(PointType first, PointType second)
Creates a line from two defining points.
Definition line.hpp:73
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1656
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition line.hpp:870
constexpr auto intersection(const OtherOrientedSegment &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:270
constexpr bool parallel(const OtherSegment &other) const
Returns whether a segment is parallel to this line.
Definition predicates.hpp:514
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:493
constexpr bool boundaryContains(const OtherRectangle &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:459
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition line.hpp:1077
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:428
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:1066
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition line.hpp:1155
constexpr auto distanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:269
constexpr auto cend() const
Returns an iterator past the last defining point.
Definition line.hpp:225
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
constexpr auto dualCoordinates() const
Returns normalized dual-line coordinates for the supporting line.
Definition duality.hpp:69
constexpr bool separates(const EmptyShape< EmptyPoint > &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition line.hpp:579
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition line.hpp:909
constexpr bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:824
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:487
constexpr bool contains(const Shape< PointType > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:515
constexpr bool contains(const OtherOrientedLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:455
constexpr bool boundaryContains(const OtherTriangle &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:462
constexpr bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3161
constexpr void rotate90(int k=1)
Rotates the line by 90k degrees around the origin in place.
Definition transformations.hpp:510
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition line.hpp:864
constexpr const PointType & max() const
Returns the largest stored defining point.
Definition line.hpp:189
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:629
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1723
constexpr A & label() const
Definition line.hpp:262
constexpr bool collinear(const OtherOrientedLine &other) const
Returns whether an oriented line is collinear with this line.
Definition predicates.hpp:538
constexpr bool boundaryContains(const OtherChain &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:970
constexpr auto squaredDistance(const OtherOrientedSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:258
constexpr bool boundaryContains(const OtherPoint &point) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:228
constexpr bool collinear(const OtherOrientedSegment &other) const
Returns whether the given oriented segment is collinear with the line.
Definition predicates.hpp:496
constexpr Line scaledDownX(const OtherNumber scalar) const
Returns the line with its x-coordinates divided by a divisor.
constexpr Segment< PointType > asSegmentFor(const Rectangle< OtherPoint > &rect) const
Returns the segment that intersects r the same way as this line.
Definition line.hpp:277
constexpr bool interiorsIntersect(const OtherSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:341
PointType PointType
Definition line.hpp:53
constexpr bool crosses(const OtherOrientedSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:232
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:1959
constexpr auto begin() const
Returns an iterator to the first defining point.
Definition line.hpp:198
constexpr bool intersects(const OtherLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:318
constexpr auto distanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:285
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1476
constexpr Line(PointType first, PointType second, A &&label)
Creates a line from two defining points and stores a label.
Definition line.hpp:101
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 interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:365
constexpr bool interiorsIntersect(const OtherLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:335
constexpr bool collinear(const OtherPoint &point) const
Returns whether the line interior contains the given point.
Definition predicates.hpp:484
constexpr auto distanceL1(const OtherShape &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition line.hpp:1296
constexpr bool separates(const OtherHalfplane &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:863
constexpr bool parallel(const OtherLine &other) const
Returns whether another line is parallel to this line.
Definition predicates.hpp:508
constexpr bool intersects(const OtherOrientedSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:343
constexpr const PointType & min() const
Returns the smallest stored defining point.
Definition line.hpp:180
constexpr bool intersects(const OtherPoint &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:312
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2021
constexpr auto closestPoints(const OtherShape &other) const
Returns the pair of points realizing the distance, nothing when the shapes meet.
Definition closest.hpp:454
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:203
constexpr bool interiorContains(const OtherLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:329
constexpr auto distanceL1(const OtherLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:276
constexpr bool interiorContains(const OtherRay &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:353
constexpr bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:844
constexpr bool separates(const OtherPoint &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:794
detail::floating_result_t< ResultNumber > squaredDistance(const Disk< DiskPointType, DiskLabel > &disk) const
Returns the squared Euclidean distance to a disk.
Definition line.hpp:1246
constexpr bool contains(const OtherRay &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:461
PointType::NumberType NumberType
Definition line.hpp:54
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition line.hpp:903
constexpr ResultNumber slope() const
Returns the slope of the line.
Definition measures.hpp:189
constexpr Halfplane< PointType > halfplaneAbove() const
Returns the half-plane geometrically above this line.
Definition predicates.hpp:549
constexpr bool boundaryContains(const Shape< PointType > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1098
constexpr Line scaledUpY(const OtherNumber scalar) const
Returns the line with its y-coordinates multiplied by a factor.
constexpr bool boundaryContains(const OtherRay &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:453
constexpr auto squaredDistance(const OtherPoint &point) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:219
constexpr bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:800
constexpr void scaleUpX(const OtherNumber scalar)
Multiplies the line's x-coordinates by a factor in place.
Definition transformations.hpp:524
constexpr std::optional< ResultNumber > xAtY(const OtherNumber &y) const
Returns the x-coordinate of the line at a given y-coordinate, if defined.
Definition atxy.hpp:168
constexpr ResultNumber area() const
Returns the area of the line.
Definition measures.hpp:178
constexpr bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4591
constexpr bool crosses(const OtherSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:226
constexpr bool crosses(const Shape< PointType > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:237
constexpr bool crosses(const OtherLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:211
constexpr auto distanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:285
constexpr std::optional< ResultNumber > yAtX(const OtherNumber &x) const
Returns the y-coordinate of the line at a given x-coordinate, if defined.
Definition atxy.hpp:130
constexpr bool separates(const Shape< PointType > &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:886
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:443
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:796
constexpr Line rotated90(int k=1) const
Returns the line rotated by 90k degrees around the origin.
Definition transformations.hpp:505
constexpr bool interiorContains(const OtherOrientedLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:347
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:341
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
detail::promoted_number_t< NumberType > CoordinateType
Definition line.hpp:56
constexpr bool intersects(const Shape< PointType > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:348
constexpr auto distanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition line.hpp:1360
constexpr bool interiorsIntersect(const Shape< PointType > &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:365
static constexpr std::size_t size()
Returns the number of defining points (always 2).
Definition line.hpp:149
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5665
constexpr bool collinear(const OtherLine &other) const
Returns whether another line is collinear with this line.
Definition predicates.hpp:502
constexpr auto distanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:257
constexpr bool interiorsIntersect(const OtherPoint &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:328
constexpr bool boundaryContains(const OtherPolygon &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:468
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:507
constexpr auto distanceLInf(const OtherLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:264
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:473
constexpr bool boundaryContains(const OtherDisk &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:471
constexpr auto distanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:297
constexpr bool verticesContain(const OtherPoint &point) const
Returns whether the given point is one of the stored defining points.
Definition predicates.hpp:478
constexpr bool interiorContains(const OtherPoint &point) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:323
constexpr Line()=default
Creates the degenerate line (0,0)--(0,0).
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 line.hpp:1373
constexpr bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:869
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5927
constexpr bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:2009
constexpr Point< ResultNumber, typename PointType::LabelType > polar() const
Returns the polar point.
Definition duality.hpp:125
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2383
constexpr bool boundaryContains(const OtherPolyline &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:986
constexpr Line(NumberType x1, NumberType y1, NumberType x2, NumberType y2, A &&label)
Same as the four-coordinate constructor, and stores a label.
Definition line.hpp:109
constexpr bool crosses(const OtherPoint &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:220
constexpr bool parallel(const OtherOrientedSegment &other) const
Returns whether an oriented segment is parallel to this line.
Definition predicates.hpp:520
constexpr void scaleDownY(const OtherNumber scalar)
Divides the line's y-coordinates by a divisor in place.
Definition transformations.hpp:566
constexpr Point< ResultNumber, typename PointType::LabelType > dual() const
Returns the dual point.
Definition duality.hpp:109
constexpr bool boundaryContains(const OtherLine &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:447
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 line.hpp:157
constexpr Line(const Line< OtherPointType, OtherLabelType > &other)
Converts a line with a different point and/or label type.
Definition line.hpp:120
constexpr HalfplaneIntersection< PointType > asHalfplaneIntersection() const
Returns the line as a (degenerate) half-plane intersection.
Definition line.hpp:289
constexpr bool boundaryContains(const OtherOrientedSegment &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:444
constexpr auto end() const
Returns an iterator past the last defining point.
Definition line.hpp:216
constexpr bool interiorContains(const OtherHalfplane &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:359
constexpr bool parallel(const OtherOrientedLine &other) const
Returns whether an oriented line is parallel to this line.
Definition predicates.hpp:526
constexpr auto squaredDistance(const OtherLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:236
constexpr bool interiorContains(const OtherSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:335
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:203
constexpr bool interiorsIntersect(const OtherOrientedSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:360
constexpr bool boundaryContains(const OtherSegment &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:441
constexpr bool collinear(const OtherRay &other) const
Returns whether a ray is collinear with this line.
Definition predicates.hpp:544
constexpr auto cbegin() const
Returns an iterator to the first defining point.
Definition line.hpp:207
constexpr bool boundaryContains(const OtherOrientedLine &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:450
constexpr bool boundaryContains(const OtherConvex &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition line.hpp:465
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition line.hpp:832
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1246
constexpr std::ptrdiff_t index(const PointType &point) const
Definition line.hpp:166
constexpr void scaleDownX(const OtherNumber scalar)
Divides the line's x-coordinates by a divisor in place.
Definition transformations.hpp:552
constexpr auto squaredDistance(const OtherShape &other) const
Returns the squared Euclidean distance to the given shape.
Definition line.hpp:1234
constexpr bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:854
constexpr auto squaredDistance(const OtherSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:246
constexpr Line & operator+=(const OtherPoint &translation)
Translates both defining points in place.
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2063
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Line< 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:216
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:376
constexpr bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:830
constexpr auto intersection(const OtherSegment &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:249
constexpr Line scaledUpX(const OtherNumber scalar) const
Returns the line with its x-coordinates multiplied by a factor.
constexpr NumberType twiceArea() const
Returns twice the area of the line.
Definition measures.hpp:183
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition line.hpp:574
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition line.hpp:1055
constexpr Line(NumberType x1, NumberType y1, NumberType x2, NumberType y2)
Creates a line from four coordinates.
Definition line.hpp:89
constexpr bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:811
constexpr bool contains(const OtherHalfplane &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:467
constexpr bool contains(const OtherLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:437
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 line.hpp:1329
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:382
constexpr bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3966
constexpr bool intersects(const OtherSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:330
constexpr auto distanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:273
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 line.hpp:1316
constexpr bool isDegenerate() const
Returns whether the defining points coincide.
Definition predicates.hpp:451
constexpr bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:817
constexpr Halfplane< PointType > halfplaneBelow() const
Returns the half-plane geometrically below this line.
Definition predicates.hpp:554
constexpr const PointType & operator[](std::size_t index) const
Returns defining point 0 or 1.
Definition line.hpp:141
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition line.hpp:564
TLabel LabelType
Definition line.hpp:55
constexpr bool parallel(const OtherRay &other) const
Returns whether a ray is parallel to this line.
Definition predicates.hpp:532
constexpr bool collinear(const OtherSegment &other) const
Returns whether the given segment is collinear with the line.
Definition predicates.hpp:490
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1238
constexpr auto operator<=>(const Line &other) const
Provides an ordering compatible with geometric equality.
Definition predicates.hpp:428
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2758
constexpr auto intersection(const OtherShape &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition line.hpp:1149
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:449
constexpr void scaleUpY(const OtherNumber scalar)
Multiplies the line's y-coordinates by a factor in place.
Definition transformations.hpp:538
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1699
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition line.hpp:826
constexpr bool operator==(const Line &other) const
Tests geometric equality of two lines.
Definition predicates.hpp:423
constexpr Line scaledDownY(const OtherNumber scalar) const
Returns the line with its y-coordinates divided by a divisor.
constexpr Line & operator-=(const OtherPoint &translation)
Translates both defining points by the opposite vector in place.
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
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