23template <
class Po
intType = Po
int<>,
class Label>
28template <std::ranges::input_range Range>
29requires detail::is_point_v<std::ranges::range_value_t<Range>>
32template <
class Number>
33requires (!detail::is_point_v<Number>)
68template <
class Po
intType_,
class TLabel>
73 static_assert(detail::is_point_v<PointType>,
"Polyline requires pgl::Point vertices");
75 template <
bool Oriented>
78 template <
bool Oriented>
79 class BoundaryIterator;
98 template<std::ranges::input_range Range = std::initializer_list<Po
intType>>
99 requires std::ranges::common_range<Range> &&
100 std::convertible_to<std::ranges::range_value_t<Range>,
PointType>
102 for (
const auto& p : points) {
103 points_.push_back(p);
116 constexpr explicit Polyline(std::initializer_list<NumberType> coords) {
117 assert(coords.size() % 2 == 0);
118 points_.reserve(coords.size() / 2);
119 for (
auto it = coords.begin(); it != coords.end(); ) {
122 points_.emplace_back(
x,
y);
134 template<Po
intConcept OtherPo
intType,
class OtherLabelType>
135 requires std::constructible_from<PointType, const OtherPointType&>
137 : points_(other.
begin(), other.
end()), label_(detail::copyLabel<
LabelType>(other)) {}
147 template <
class A = LabelType>
148 requires(detail::has_label_v<A>)
160 return points_[
index] + translation_;
175 const std::ptrdiff_t n =
static_cast<std::ptrdiff_t
>(
size());
176 return (*
this)[
static_cast<std::size_t
>(((
index % n) + n) % n)];
193 template <Po
intConcept OtherPo
int>
194 constexpr void set(std::size_t
index,
const OtherPoint& point) {
197 stored -= translation_;
198 points_[
index] = stored;
213 for (std::ptrdiff_t i = 0; i < static_cast<std::ptrdiff_t>(
size()); ++i) {
214 if ((*
this)[
static_cast<std::size_t
>(i)] == point) {
235 template <Po
intConcept OtherPo
int>
236 constexpr void insert(std::size_t
index,
const OtherPoint& point) {
239 stored -= translation_;
240 points_.insert(points_.begin() +
static_cast<std::ptrdiff_t
>(
index), stored);
259 template <std::ranges::input_range Range>
260 requires (!detail::is_point_v<std::remove_cvref_t<Range>>) &&
261 std::convertible_to<std::ranges::range_value_t<Range>,
PointType>
264 std::vector<PointType> incoming;
265 for (
const auto& p : points) {
267 stored -= translation_;
268 incoming.push_back(stored);
270 points_.insert(points_.begin() +
static_cast<std::ptrdiff_t
>(
index), incoming.begin(),
285 template <Po
intConcept OtherPo
int>
300 template <std::ranges::input_range Range>
301 requires (!detail::is_point_v<std::remove_cvref_t<Range>>) &&
302 std::convertible_to<std::ranges::range_value_t<Range>,
PointType>
311 return Iterator(points_.begin(), translation_);
318 return Iterator(points_.cbegin(), translation_);
324 constexpr auto end()
const {
325 return Iterator(points_.end(), translation_);
332 return Iterator(points_.cend(), translation_);
345 if (
auto cmp =
size() <=> other.
size(); cmp != 0) {
348 const bool reversed = !storedIsCanonical();
349 const bool otherReversed = !other.storedIsCanonical();
350 for (std::size_t i = 0; i <
size(); ++i) {
351 if (
auto cmp = canonicalAt(i, reversed) <=> other.canonicalAt(i, otherReversed);
356 return std::strong_ordering::equal;
371 const bool reversed = !storedIsCanonical();
372 const bool otherReversed = !other.storedIsCanonical();
373 for (std::size_t i = 0; i <
size(); ++i) {
374 if (canonicalAt(i, reversed) != other.canonicalAt(i, otherReversed)) {
382 template<AnyShapeConcept OtherShape>
383 [[nodiscard]]
constexpr bool samePointSet(
const OtherShape& other)
const;
388 constexpr std::size_t
size()
const {
389 return points_.size();
396 return points_.empty();
410 return std::adjacent_find(points_.begin(), points_.end(), std::not_equal_to<>{}) ==
422 [[nodiscard]]
constexpr bool isPoint()
const {
423 return detail::allPointsEqual(points_);
433 [[nodiscard]]
constexpr std::optional<PointType>
getIfPoint()
const {
437 return points_.front() + translation_;
451 return detail::pointsSpanSegment(points_);
461 [[nodiscard]]
constexpr std::optional<BoundaryType<false>>
getIfSegment()
const {
465 return detail::spannedSegment<BoundaryType<false>>(points_) + translation_;
500 template <
class Rational = pgl::Rational<pgl::BigInt>>
554 template <
class ResultNumber = gr
id_number_t<
typename Po
intType_::NumberType>>
555 requires(detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
564 template <std::
floating_po
int ResultNumber =
double>
570 constexpr std::vector<PointType>
vertices()
const {
571 std::vector<PointType> ret(points_.begin(), points_.end());
572 for (
auto&
vertex : ret) {
585 constexpr std::vector<Segment<PointType>>
edges()
const {
586 std::vector<Segment<PointType>> result;
587 const auto translatedVertices =
vertices();
588 for (std::size_t i = 0; i + 1 < translatedVertices.size(); ++i) {
589 result.emplace_back(translatedVertices[i], translatedVertices[i + 1]);
599 std::vector<OrientedSegment<PointType>> result;
600 const auto translatedVertices =
vertices();
601 for (std::size_t i = 0; i + 1 < translatedVertices.size(); ++i) {
602 result.emplace_back(translatedVertices[i], translatedVertices[i + 1]);
616 return std::ranges::subrange(
begin(),
end());
680 template<Po
intConcept OtherPo
int>
681 [[nodiscard]]
constexpr bool contains(
const OtherPoint& point)
const;
698 template<SegmentConcept OtherSegment>
699 [[nodiscard]]
constexpr bool contains(
const OtherSegment& other)
const;
702 template<OrientedSegmentConcept OtherOrientedSegment>
703 [[nodiscard]]
constexpr bool contains(
const OtherOrientedSegment& other)
const;
709 template<LineConcept OtherLine>
710 [[nodiscard]]
constexpr bool contains(
const OtherLine& other)
const;
716 template<OrientedLineConcept OtherOrientedLine>
717 [[nodiscard]]
constexpr bool contains(
const OtherOrientedLine& other)
const;
723 template<RayConcept OtherRay>
724 [[nodiscard]]
constexpr bool contains(
const OtherRay& other)
const;
730 template<HalfplaneConcept OtherHalfplane>
731 [[nodiscard]]
constexpr bool contains(
const OtherHalfplane& other)
const;
737 template<RectangleConcept OtherRectangle>
738 [[nodiscard]]
constexpr bool contains(
const OtherRectangle& other)
const;
744 template<TriangleConcept OtherTriangle>
745 [[nodiscard]]
constexpr bool contains(
const OtherTriangle& other)
const;
751 template<ConvexConcept OtherConvex>
752 [[nodiscard]]
constexpr bool contains(
const OtherConvex& other)
const;
761 template<PolygonConcept OtherPolygon>
762 [[nodiscard]]
constexpr bool contains(
const OtherPolygon& other)
const;
768 template<DiskConcept OtherDisk>
769 [[nodiscard]]
constexpr bool contains(
const OtherDisk& other)
const;
777 template<MonotoneChainConcept OtherChain>
778 [[nodiscard]]
constexpr bool contains(
const OtherChain& other)
const;
788 template<PolylineConcept OtherPolyline>
789 [[nodiscard]]
constexpr bool contains(
const OtherPolyline& other)
const;
792 template <
class EmptyPo
int>
798 template<Po
intConcept OtherPo
int>
813 template<Po
intConcept OtherPo
int>
819 template<SegmentConcept OtherSegment>
821 return detail::reduceDegenerateToPoint(
825 template<OrientedSegmentConcept OtherOrientedSegment>
827 return detail::reduceDegenerateToPoint(
831 template<LineConcept OtherLine>
834 template<OrientedLineConcept OtherOrientedLine>
835 [[nodiscard]]
constexpr bool boundaryContains(
const OtherOrientedLine&)
const {
return false; }
837 template<RayConcept OtherRay>
840 template<HalfplaneConcept OtherHalfplane>
841 [[nodiscard]]
constexpr bool boundaryContains(
const OtherHalfplane&)
const {
return false; }
843 template<RectangleConcept OtherRectangle>
845 return detail::reduceDegenerateToPoint(
849 template<TriangleConcept OtherTriangle>
851 return detail::reduceDegenerateToPoint(
855 template<ConvexConcept OtherConvex>
857 return detail::reduceDegenerateToPoint(
861 template<PolygonConcept OtherPolygon>
863 return detail::reduceDegenerateToPoint(
867 template<DiskConcept OtherDisk>
869 return detail::reduceDegenerateToPoint(
873 template<MonotoneChainConcept OtherChain>
880 template<PolylineConcept OtherPolyline>
884 return other.empty() || (other.isDegenerate() &&
boundaryContains(other[0]));
887 template <
class EmptyPo
int>
893 template<Po
intConcept OtherPo
int>
908 template<Po
intConcept OtherPo
int>
921 template<SegmentConcept OtherSegment>
925 template<OrientedSegmentConcept OtherOrientedSegment>
929 template<LineConcept OtherLine>
933 template<OrientedLineConcept OtherOrientedLine>
937 template<RayConcept OtherRay>
941 template<HalfplaneConcept OtherHalfplane>
945 template<TriangleConcept OtherTriangle>
951 template<RectangleConcept OtherRectangle>
953 return detail::reduceDegenerateGuarded(
954 other, [
this](
const auto& carrier) {
return this->
interiorContains(carrier); });
957 template<ConvexConcept OtherConvex>
959 return detail::reduceDegenerateGuarded(
960 other, [
this](
const auto& carrier) {
return this->
interiorContains(carrier); });
963 template<PolygonConcept OtherPolygon>
965 return detail::reduceDegenerate(
966 other, [
this](
const auto& carrier) {
return this->
interiorContains(carrier); });
969 template<DiskConcept OtherDisk>
971 return detail::reduceDegenerate(
972 other, [
this](
const auto& carrier) {
return this->
interiorContains(carrier); });
976 template<MonotoneChainConcept OtherChain>
980 template<PolylineConcept OtherPolyline>
983 template <
class EmptyPo
int>
989 template<Po
intConcept OtherPo
int>
997 template<Po
intConcept OtherPo
int>
998 [[nodiscard]]
constexpr bool intersects(
const OtherPoint& other)
const;
1012 template<SegmentConcept OtherSegment>
1013 [[nodiscard]]
constexpr bool intersects(
const OtherSegment& other)
const;
1016 template<OrientedSegmentConcept OtherOrientedSegment>
1017 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedSegment& other)
const;
1019 template<LineConcept OtherLine>
1020 [[nodiscard]]
constexpr bool intersects(
const OtherLine& other)
const;
1022 template<OrientedLineConcept OtherOrientedLine>
1023 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedLine& other)
const;
1025 template<RayConcept OtherRay>
1026 [[nodiscard]]
constexpr bool intersects(
const OtherRay& other)
const;
1028 template<HalfplaneConcept OtherHalfplane>
1029 [[nodiscard]]
constexpr bool intersects(
const OtherHalfplane& other)
const;
1031 template<RectangleConcept OtherRectangle>
1032 [[nodiscard]]
constexpr bool intersects(
const OtherRectangle& other)
const;
1034 template<TriangleConcept OtherTriangle>
1035 [[nodiscard]]
constexpr bool intersects(
const OtherTriangle& other)
const;
1037 template<ConvexConcept OtherConvex>
1038 [[nodiscard]]
constexpr bool intersects(
const OtherConvex& other)
const;
1040 template<DiskConcept OtherDisk>
1041 [[nodiscard]]
constexpr bool intersects(
const OtherDisk& other)
const;
1050 template<MonotoneChainConcept OtherChain>
1051 [[nodiscard]]
constexpr bool intersects(
const OtherChain& other)
const;
1064 template<PolylineConcept OtherPolyline>
1065 [[nodiscard]]
constexpr bool intersects(
const OtherPolyline& other)
const;
1068 template <
class EmptyPo
int>
1074 template<Po
intConcept OtherPo
int>
1078 template<
typename OtherShape>
1080 [[nodiscard]]
constexpr bool intersects(
const OtherShape& other)
const {
1081 return other.intersects(*
this);
1091 template<Po
intConcept OtherPo
int>
1108 template<SegmentConcept OtherSegment>
1112 template<OrientedSegmentConcept OtherOrientedSegment>
1115 template<LineConcept OtherLine>
1118 template<OrientedLineConcept OtherOrientedLine>
1121 template<RayConcept OtherRay>
1124 template<HalfplaneConcept OtherHalfplane>
1127 template<RectangleConcept OtherRectangle>
1130 template<TriangleConcept OtherTriangle>
1133 template<ConvexConcept OtherConvex>
1136 template<DiskConcept OtherDisk>
1139 template<MonotoneChainConcept OtherChain>
1150 template<PolylineConcept OtherPolyline>
1154 template <
class EmptyPo
int>
1160 template<Po
intConcept OtherPo
int>
1164 template<
typename OtherShape>
1167 return other.interiorsIntersect(*
this);
1175 template<Po
intConcept OtherPo
int>
1176 [[nodiscard]]
constexpr bool separates(
const OtherPoint&)
const {
1189 template<SegmentConcept OtherSegment>
1190 [[nodiscard]]
constexpr bool separates(
const OtherSegment& other)
const;
1192 template<OrientedSegmentConcept OtherOrientedSegment>
1193 [[nodiscard]]
constexpr bool separates(
const OtherOrientedSegment& other)
const;
1195 template<LineConcept OtherLine>
1196 [[nodiscard]]
constexpr bool separates(
const OtherLine& other)
const;
1198 template<OrientedLineConcept OtherOrientedLine>
1199 [[nodiscard]]
constexpr bool separates(
const OtherOrientedLine& other)
const;
1201 template<RayConcept OtherRay>
1202 [[nodiscard]]
constexpr bool separates(
const OtherRay& other)
const;
1212 template<HalfplaneConcept OtherHalfplane>
1213 [[nodiscard]]
constexpr bool separates(
const OtherHalfplane& other)
const;
1215 template<RectangleConcept OtherRectangle>
1216 [[nodiscard]]
constexpr bool separates(
const OtherRectangle& other)
const;
1218 template<TriangleConcept OtherTriangle>
1219 [[nodiscard]]
constexpr bool separates(
const OtherTriangle& other)
const;
1221 template<DiskConcept OtherDisk>
1222 [[nodiscard]]
constexpr bool separates(
const OtherDisk& other)
const;
1224 template<ConvexConcept OtherConvex>
1225 [[nodiscard]]
constexpr bool separates(
const OtherConvex& other)
const;
1227 template<PolygonConcept OtherPolygon>
1228 [[nodiscard]]
constexpr bool separates(
const OtherPolygon& other)
const;
1235 template<MonotoneChainConcept OtherChain>
1236 [[nodiscard]]
constexpr bool separates(
const OtherChain& other)
const;
1246 template<PolylineConcept OtherPolyline>
1247 [[nodiscard]]
constexpr bool separates(
const OtherPolyline& other)
const;
1250 template<HalfplaneIntersectionConcept OtherRegion>
1251 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1254 template<HalfplaneIntersectionConcept OtherRegion>
1258 template<HalfplaneIntersectionConcept OtherRegion>
1262 template<HalfplaneIntersectionConcept OtherRegion>
1263 [[nodiscard]]
constexpr bool separates(
const OtherRegion& other)
const;
1273 template<PolygonWithHolesConcept OtherRegion>
1274 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1282 template<PolygonWithHolesConcept OtherRegion>
1286 template<PolygonWithHolesConcept OtherRegion>
1296 template<PolygonWithHolesConcept OtherRegion>
1297 [[nodiscard]]
bool separates(
const OtherRegion& other)
const;
1308 template<PolygonSetConcept OtherSet>
1309 [[nodiscard]]
constexpr bool contains(
const OtherSet& other)
const {
1310 for (
const auto& component : other) {
1319 template<PolygonSetConcept OtherSet>
1321 for (
const auto& component : other) {
1330 template<PolygonSetConcept OtherSet>
1332 for (
const auto& component : other) {
1348 template<PolygonSetConcept OtherSet>
1351 template <
class EmptyPo
int>
1357 template<Po
intConcept OtherPo
int>
1361 template<Po
intConcept OtherPo
int>
1362 [[nodiscard]]
constexpr bool crosses(
const OtherPoint&)
const {
1366 template<SegmentConcept OtherSegment>
1367 [[nodiscard]]
constexpr bool crosses(
const OtherSegment& other)
const;
1369 template<OrientedSegmentConcept OtherOrientedSegment>
1370 [[nodiscard]]
constexpr bool crosses(
const OtherOrientedSegment& other)
const;
1372 template<LineConcept OtherLine>
1373 [[nodiscard]]
constexpr bool crosses(
const OtherLine& other)
const;
1375 template<OrientedLineConcept OtherOrientedLine>
1376 [[nodiscard]]
constexpr bool crosses(
const OtherOrientedLine& other)
const;
1378 template<RayConcept OtherRay>
1379 [[nodiscard]]
constexpr bool crosses(
const OtherRay& other)
const;
1381 template<HalfplaneConcept OtherHalfplane>
1382 [[nodiscard]]
constexpr bool crosses(
const OtherHalfplane& other)
const;
1384 template<RectangleConcept OtherRectangle>
1385 [[nodiscard]]
constexpr bool crosses(
const OtherRectangle& other)
const;
1387 template<TriangleConcept OtherTriangle>
1388 [[nodiscard]]
constexpr bool crosses(
const OtherTriangle& other)
const;
1390 template<DiskConcept OtherDisk>
1391 [[nodiscard]]
constexpr bool crosses(
const OtherDisk& other)
const;
1393 template<ConvexConcept OtherConvex>
1394 [[nodiscard]]
constexpr bool crosses(
const OtherConvex& other)
const;
1396 template<MonotoneChainConcept OtherChain>
1397 [[nodiscard]]
constexpr bool crosses(
const OtherChain& other)
const;
1399 template<PolylineConcept OtherPolyline>
1400 [[nodiscard]]
constexpr bool crosses(
const OtherPolyline& other)
const;
1402 template <
class EmptyPo
int>
1408 template<Po
intConcept OtherPo
int>
1412 template<
typename OtherShape>
1414 [[nodiscard]]
constexpr bool crosses(
const OtherShape& other)
const {
1415 return other.crosses(*
this);
1419 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
1420 [[nodiscard]]
constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
1438 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1439 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1443 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1444 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1448 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1449 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1453 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1454 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1458 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1459 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1463 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1464 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1468 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1469 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1473 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1474 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1478 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
1479 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1497 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
1498 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1522 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
1523 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1554 template <
class ResultNumber = division_result_t<NumberType>,
class OtherArea>
1561 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1563 && (detail::shapeRank<OtherShape> > detail::shapeRank<Polyline>)
1564 &&
requires(
const OtherShape& o,
const Polyline& self) {
1572 template <
class ResultNumber = NumberType,
class EmptyPo
int>
1593 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1596 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1599 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1602 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1605 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1608 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1611 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1614 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1617 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1620 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
1623 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
1626 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
1636 template <
class ResultNumber =
double,
class DiskPo
intType,
class DiskLabel>
1646 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1647 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Polyline>)
1648 &&
requires(
const OtherShape& o,
const Polyline& self) {
1667 template <
class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
1668 requires detail::ClosestPairConcept<Polyline<PointType_, TLabel>, OtherShape>
1687 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
1688 requires detail::ClosestPointsPairConcept<Polyline<PointType_, TLabel>, OtherShape>
1701 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1702 [[nodiscard]]
constexpr auto distanceL1(
const OtherPoint& point)
const;
1704 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1705 [[nodiscard]]
constexpr auto distanceL1(
const OtherSegment& other)
const;
1707 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1708 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedSegment& other)
const;
1710 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1711 [[nodiscard]]
constexpr auto distanceL1(
const OtherLine& other)
const;
1713 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1714 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedLine& other)
const;
1716 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1717 [[nodiscard]]
constexpr auto distanceL1(
const OtherRay& other)
const;
1719 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1720 [[nodiscard]]
constexpr auto distanceL1(
const OtherHalfplane& other)
const;
1722 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1723 [[nodiscard]]
constexpr auto distanceL1(
const OtherRectangle& other)
const;
1725 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1726 [[nodiscard]]
constexpr auto distanceL1(
const OtherTriangle& other)
const;
1728 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
1729 [[nodiscard]]
constexpr auto distanceL1(
const OtherConvex& other)
const;
1731 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
1732 [[nodiscard]]
constexpr auto distanceL1(
const OtherChain& other)
const;
1734 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
1735 [[nodiscard]]
constexpr auto distanceL1(
const OtherPolyline& other)
const;
1743 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1744 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Polyline>)
1745 &&
requires(
const OtherShape& o,
const Polyline& self) {
1748 [[nodiscard]]
constexpr auto distanceL1(
const OtherShape& other)
const {
1767 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1776 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
1791 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1794 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1795 [[nodiscard]]
constexpr auto distanceLInf(
const OtherSegment& other)
const;
1797 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1798 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedSegment& other)
const;
1800 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1803 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1804 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedLine& other)
const;
1806 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1809 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1810 [[nodiscard]]
constexpr auto distanceLInf(
const OtherHalfplane& other)
const;
1812 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1813 [[nodiscard]]
constexpr auto distanceLInf(
const OtherRectangle& other)
const;
1815 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1816 [[nodiscard]]
constexpr auto distanceLInf(
const OtherTriangle& other)
const;
1818 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
1821 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
1824 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
1825 [[nodiscard]]
constexpr auto distanceLInf(
const OtherPolyline& other)
const;
1833 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1834 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Polyline>)
1835 &&
requires(
const OtherShape& o,
const Polyline& self) {
1846 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
1858 template <
class ApproximateNumber =
double>
1876 template <
class ResultNumber = division_result_t<NumberType>>
1898 template <
class OtherNumber>
1902 template <
class OtherNumber>
1906 template <
class OtherNumber>
1910 template <
class OtherNumber>
1914 template <
class OtherNumber>
1918 template <
class OtherNumber>
1922 template <
class OtherNumber>
1926 template <
class OtherNumber>
1959 template <SegmentConcept OldSegment, SegmentConcept NewSegment>
1960 [[nodiscard]]
constexpr bool flippable(
const OldSegment& oldEdge,
const NewSegment& newEdge)
const;
1976 template <SegmentConcept OldSegment, SegmentConcept NewSegment>
1977 [[nodiscard]]
constexpr Polyline flipped(
const OldSegment& oldEdge,
const NewSegment& newEdge)
const;
1993 template <SegmentConcept OldSegment, SegmentConcept NewSegment>
1994 constexpr void flip(
const OldSegment& oldEdge,
const NewSegment& newEdge);
2009 template <
class OtherShape>
2035 template <
class OtherShape>
2070 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
2115 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2120 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2125 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2142 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
2170 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
2196 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2206 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherSegment>
2234 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
2246 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
2260 template <
class ResultNumber = division_result_t<NumberType>, PolygonSetConcept OtherSet>
2269 template<Po
intConcept OtherPo
int>
2271 translation_ += translation;
2275 if (!bbox_.empty()) {
2276 bbox_ += translation;
2287 template<Po
intConcept OtherPo
int>
2289 translation_ -= translation;
2290 if (!bbox_.empty()) {
2291 bbox_ -= translation;
2304 template <
class Scalar>
2307 for (
auto&
vertex : points_) {
2310 translation_ *= scalar;
2321 template <
class Scalar>
2324 for (
auto&
vertex : points_) {
2327 translation_ /= scalar;
2339 template <
bool Oriented>
2351 assert(polyline !=
nullptr);
2352 return polyline->template boundaryAt<Oriented>(index);
2372 : polyline(polyline_arg), index(index_arg) {}
2374 const Polyline* polyline =
nullptr;
2375 std::size_t
index = 0;
2379 std::vector<PointType> points_{};
2380 [[no_unique_address]]
mutable LabelType label_{};
2386 mutable Rectangle<PointType> bbox_{};
2394 static constexpr std::size_t hashUnset_ = pgl::detail::numeric_limits<std::size_t>::max();
2395 mutable std::size_t hash_ = hashUnset_;
2402 constexpr void resetCache()
const {
2407 constexpr std::size_t edgeCount()
const {
2408 return points_.empty() ? 0 : points_.size() - 1;
2420 template <
class ResultNumber,
class OtherShape>
2421 constexpr ResultNumber edgeMinSquaredDistance(
const OtherShape& other)
const;
2424 template <
class ResultNumber,
class OtherShape>
2425 constexpr ResultNumber edgeMinDistanceL1(
const OtherShape& other)
const;
2428 template <
class ResultNumber,
class OtherShape>
2429 constexpr ResultNumber edgeMinDistanceLInf(
const OtherShape& other)
const;
2435 template <
class ResultNumber,
class OtherShape>
2436 constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
2438 edgeFoldIntersection(
const OtherShape& other)
const;
2451 template <
class ResultNumber>
2452 static constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
2457 template <
bool Oriented>
2470 template <SegmentConcept OldSegment, SegmentConcept NewSegment>
2471 constexpr std::optional<std::vector<PointType>> flipVertices(
const OldSegment& oldEdge,
2472 const NewSegment& newEdge)
const;
2485 constexpr bool storedIsCanonical()
const {
2486 if (points_.size() < 2) {
2489 const auto cmp = points_.front() <=> points_.back();
2497 return !std::lexicographical_compare(points_.rbegin(), points_.rend(),
2498 points_.begin(), points_.end());
2508 constexpr PointType canonicalAt(std::size_t
index,
bool reversed)
const {
2514 using BaseIterator = std::vector<PointType>::const_iterator;
2519 using iterator_category = std::random_access_iterator_tag;
2520 using difference_type = std::ptrdiff_t;
2525 Iterator() =
default;
2526 Iterator(BaseIterator it,
PointType x) : it(it), x(x) {}
2534 Iterator& operator++() {
2540 Iterator operator++(
int) {
2541 Iterator tmp = *
this;
2547 Iterator& operator--() {
2553 Iterator operator--(
int) {
2554 Iterator tmp = *
this;
2560 bool operator==(
const Iterator& other)
const {
2561 return it == other.it;
2565 auto operator<=>(
const Iterator& other)
const {
2566 return it <=> other.it;
2570 Iterator operator+(difference_type n)
const {
2571 return Iterator(it + n, x);
2575 Iterator operator-(difference_type n)
const {
2576 return Iterator(it - n, x);
2580 difference_type operator-(
const Iterator& other)
const {
2581 return it - other.it;
2585 PointType operator[](difference_type n)
const {
2586 return *(it + n) + x;
2593template <
class TPo
int,
class TLabel>
2600template <
class Po
intType_,
class TLabel,
class Storage>
2607template <
class Po
intType,
class LabelType,
class TranslationNumber,
class TranslationLabel>
2609 return polyline + (-translation);
2612template <
class Po
intType,
class LabelType,
class Scalar>
2613 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
2618 if constexpr (detail::has_label_v<LabelType>) {
2619 result.
label() = LabelType{};
2624template <
class Scalar,
class Po
intType,
class LabelType>
2625 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
2627 return polyline * scalar;
2630template <
class Po
intType,
class LabelType,
class Scalar>
2631 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
2636 if constexpr (detail::has_label_v<LabelType>) {
2637 result.
label() = LabelType{};
2642template <
class Po
intType,
class LabelType>
std::ptrdiff_t difference_type
Definition polyline.hpp:2345
std::forward_iterator_tag iterator_category
Definition polyline.hpp:2342
value_type reference
Definition polyline.hpp:2346
BoundaryType< Oriented > value_type
Definition polyline.hpp:2344
std::forward_iterator_tag iterator_concept
Definition polyline.hpp:2343
constexpr BoundaryIterator operator++(int)
Definition polyline.hpp:2360
constexpr BoundaryIterator & operator++()
Definition polyline.hpp:2355
constexpr value_type operator*() const
Definition polyline.hpp:2350
constexpr BoundaryIterator()=default
friend struct Polyline
Definition polyline.hpp:2369
constexpr bool operator==(const BoundaryIterator &other) const =default
Bounded polygonal primitives, convex or not.
Definition forward.hpp:373
Shape pairs whose Minkowski sum Pangolin can represent.
Definition forward.hpp:476
Definition forward.hpp:306
Definition forward.hpp:316
Definition forward.hpp:317
Definition arrangement.hpp:67
@ y
Definition intervaltree.hpp:24
@ x
Definition intervaltree.hpp:24
@ vertex
Definition bitmatrix.hpp:37
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
Segment() -> Segment< Point<>, NoLabel >
Polyline() -> Polyline< Point<>, NoLabel >
Definition polyline.hpp:2369
Closed convex polygon stored by its vertices.
Definition convex.hpp:170
constexpr Segment< PointType > diameter() const
Returns a segment realizing the diameter (the farthest vertex pair).
Definition measures.hpp:696
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
constexpr Polyline< PointType > asPolyline() const
Returns the chain as a polyline traversing its vertices in lexicographic order.
Definition polyline.hpp:2602
constexpr std::vector< PointType > vertices() const
Returns the vertices of the chain (translation applied).
Definition monotonechain.hpp:569
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
Open polygonal chain stored in traversal order; may self-intersect.
Definition polyline.hpp:69
constexpr bool crosses(const OtherPolyline &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1022
constexpr auto distanceL1(const OtherConvex &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1366
constexpr OrientedEdgeIterator orientedEdgesBegin() const
Returns an iterator to the first oriented edge.
Definition polyline.hpp:659
constexpr bool intersects(const OtherDisk &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1721
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition polyline.hpp:793
constexpr bool isSegment() const
Checks whether the polyline covers exactly one segment of positive length.
Definition polyline.hpp:450
constexpr auto distanceL1(const OtherOrientedLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1321
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2182
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool interiorContains(const OtherOrientedLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1610
constexpr auto distanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1263
constexpr auto distanceLInf(const OtherRay &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1318
constexpr bool interiorsIntersect(const OtherHalfplane &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:1984
constexpr bool interiorsIntersect(const OtherDisk &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2012
constexpr bool boundaryContains(const OtherDisk &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:868
constexpr auto intersection(const OtherShape &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition polyline.hpp:1567
constexpr const Rectangle< PointType > & bbox() const
Computes the bounding box of the polyline.
Definition bounding.hpp:515
constexpr bool crosses(const OtherTriangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:998
constexpr bool intersects(const OtherOrientedLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1678
constexpr void scaleUpY(const OtherNumber scalar)
Multiplies the polyline's y-coordinates by a factor in place.
Definition transformations.hpp:2042
bool isSimple() const
Tests whether the polyline is simple (it does not touch or cross itself).
Definition xysweep.hpp:314
constexpr bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3935
constexpr void pushBack(Range &&points)
Appends a range of vertices in order.
Definition polyline.hpp:303
constexpr Polyline(const Polyline< OtherPointType, OtherLabelType > &other)
Converts a polyline with compatible vertex type.
Definition polyline.hpp:136
constexpr bool intersects(const OtherRectangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1696
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1598
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherChain &other) const
Returns the regularized Minkowski sum of the two chains (A ⊕ B).
constexpr auto distanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition polyline.hpp:1838
constexpr bool boundaryContains(const OtherChain &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:874
constexpr bool interiorsIntersect(const Shape< OtherPoint > &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2084
constexpr bool intersects(const OtherOrientedSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1643
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > polygonIntersection(const OtherArea &other) const
Returns the intersection with a polygon or a region (A ∩ B), a sequence of points and segments sorted...
Definition intersection.hpp:2987
constexpr auto closestSegments(const OtherShape &other) const
Returns the pair of elements realizing the distance, nothing when the shapes meet.
Definition closest.hpp:398
constexpr auto distanceLInf(const OtherLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1300
constexpr bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3911
constexpr bool intersects(const OtherChain &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1727
constexpr auto squaredDistance(const OtherRay &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1664
constexpr bool interiorsIntersect(const OtherRectangle &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:1990
constexpr bool boundaryContains(const OtherHalfplane &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:841
constexpr bool operator==(const Polyline &other) const
Checks equality of two polylines.
Definition polyline.hpp:367
constexpr auto distanceLInf(const OtherRectangle &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1336
constexpr bool separates(const OtherPoint &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition polyline.hpp:1176
constexpr bool interiorContains(const OtherSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1587
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2197
constexpr void rotate90(int k=1)
Rotates the polyline by 90k degrees around the origin in place.
Definition transformations.hpp:2004
constexpr A & label() const
Returns the polyline label.
Definition polyline.hpp:149
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2227
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1652
constexpr bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3472
constexpr Polyline()=default
Creates a polyline with no vertex.
constexpr auto squaredDistance(const OtherOrientedSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1637
constexpr bool separates(const EmptyShape< EmptyPoint > &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition polyline.hpp:1352
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2244
constexpr bool crosses(const OtherOrientedSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:958
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
constexpr bool intersects(const OtherPolyline &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1752
constexpr Polyline flipped(const OldSegment &oldEdge, const NewSegment &newEdge) const
Returns the polyline with oldEdge flipped to newEdge.
constexpr bool isDegenerate() const
Checks if the polyline is degenerate (all vertices are equal, so it covers at most a single point).
Definition polyline.hpp:409
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:6002
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherPolyline &other) const
Returns the intersection of the two polylines (A ∩ B), a sequence of points and segments sorted by le...
Definition intersection.hpp:2943
constexpr auto distanceLInf(const OtherHalfplane &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1327
constexpr bool boundaryContains(const OtherTriangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:850
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 polyline.hpp:1768
constexpr bool flippable(const OldSegment &oldEdge, const NewSegment &newEdge) const
Tests whether oldEdge can be flipped to newEdge.
Definition transformations.hpp:2156
constexpr bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4693
constexpr bool crosses(const OtherLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:964
constexpr bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3899
constexpr const PointType operator[](std::size_t index) const
Accesses a vertex by index (in traversal order).
Definition polyline.hpp:158
constexpr EdgeIterator edgesEnd() const
Returns an iterator past the last unoriented edge.
Definition polyline.hpp:651
constexpr auto distanceL1(const OtherRectangle &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1348
constexpr auto squaredDistance(const OtherSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1619
constexpr bool crosses(const OtherChain &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1016
constexpr auto distanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1284
constexpr bool boundaryContains(const OtherPolygon &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:862
detail::floating_result_t< ResultNumber > squaredDistance(const Disk< DiskPointType, DiskLabel > &disk) const
Returns the squared Euclidean distance to a disk.
Definition distance.hpp:1718
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition polyline.hpp:1331
constexpr std::vector< PointType > vertices() const
Returns the vertices of the polyline (translation applied).
Definition polyline.hpp:570
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition polyline.hpp:964
constexpr auto distanceL1(const OtherShape &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition polyline.hpp:1748
constexpr void insert(std::size_t index, Range &&points)
Inserts a range of vertices at the given index, shifting the later vertices back.
Definition polyline.hpp:262
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 polyline.hpp:1777
constexpr Rectangle< Point< ResultNumber > > fbox() const
Computes the floating-point bounding box of the polyline.
Definition bounding.hpp:527
constexpr auto distanceL1(const OtherHalfplane &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1339
constexpr bool contains(const OtherOrientedLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2209
constexpr bool separates(const Shape< OtherPoint > &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3950
constexpr bool crosses(const Shape< OtherPoint > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1028
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherSegment &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2828
constexpr auto squaredDistance(const OtherConvex &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1700
constexpr void scaleUpX(const OtherNumber scalar)
Multiplies the polyline's x-coordinates by a factor in place.
Definition transformations.hpp:2023
constexpr std::ptrdiff_t index(const PointType &point) const
Definition polyline.hpp:212
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:2690
constexpr bool intersects(const OtherTriangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1709
constexpr bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3800
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherLine &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2844
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition polyline.hpp:1573
constexpr void insert(std::size_t index, const OtherPoint &point)
Inserts a vertex at the given index, shifting the later vertices back.
Definition polyline.hpp:236
constexpr bool interiorsIntersect(const OtherLine &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:1896
constexpr auto distanceL1(const OtherRay &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1330
constexpr bool isUndefined() const
Checks whether the polyline is degenerate without covering a point or a segment.
Definition polyline.hpp:477
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2301
BoundaryIterator< false > EdgeIterator
Definition polyline.hpp:81
constexpr auto lengthLInf() const
Computes the Chebyshev (LInf) length of the polyline.
Definition measures.hpp:1275
constexpr bool contains(const OtherHalfplane &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2221
constexpr bool interiorsIntersect(const OtherConvex &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2006
constexpr OrientedEdgeIterator orientedEdgesEnd() const
Returns an iterator past the last oriented edge.
Definition polyline.hpp:667
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition polyline.hpp:1155
constexpr bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3887
constexpr bool interiorsIntersect(const OtherChain &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2018
constexpr void flip(const OldSegment &oldEdge, const NewSegment &newEdge)
Flips oldEdge to newEdge in place.
Definition transformations.hpp:2172
constexpr auto distanceL1(const OtherPolyline &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1293
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherRay &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2860
constexpr void scaleDownX(const OtherNumber scalar)
Divides the polyline's x-coordinates by a divisor in place.
Definition transformations.hpp:2061
constexpr auto distanceLInf(const OtherConvex &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1354
constexpr auto distanceLInf(const OtherChain &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1363
constexpr bool interiorsIntersect(const OtherRay &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:1934
TLabel LabelType
Definition polyline.hpp:72
constexpr auto closestPoints(const OtherShape &other) const
Returns the pair of points realizing the distance, nothing when the shapes meet.
Definition closest.hpp:405
constexpr Polyline & operator+=(const OtherPoint &translation)
Translates the polyline by the given point.
Definition polyline.hpp:2270
constexpr bool intersects(const OtherSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1626
constexpr EdgeIterator edgesBegin() const
Returns an iterator to the first unoriented edge.
Definition polyline.hpp:643
constexpr std::vector< OrientedSegment< PointType > > orientedEdges() const
Returns the oriented edges of the polyline, each directed from vertex i to vertex i + 1 in traversal ...
Definition polyline.hpp:598
constexpr auto begin() const
Definition polyline.hpp:310
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition polyline.hpp:1069
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition polyline.hpp:1309
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherTriangle &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2884
constexpr auto distanceLInf(const OtherOrientedLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1309
constexpr auto squaredDistance(const OtherTriangle &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1691
constexpr bool interiorContains(const OtherLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1604
constexpr bool intersects(const OtherRay &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1684
constexpr auto distanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1291
constexpr Polyline rotated90(int k=1) const
Returns the polyline rotated by 90k degrees around the origin.
Definition transformations.hpp:1994
constexpr PointType get(std::ptrdiff_t index) const
Accesses a vertex by index modulo the vertex count.
Definition polyline.hpp:174
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition polyline.hpp:1403
EPoint PointType
Definition polyline.hpp:70
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition polyline.hpp:970
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:1320
constexpr auto end() const
Definition polyline.hpp:324
constexpr bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3923
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5750
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2134
constexpr Polyline scaledUpX(const OtherNumber scalar) const
Returns the polyline with its x-coordinates multiplied by a factor.
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2151
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherPolygon &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr bool interiorsIntersect(const OtherOrientedLine &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:1928
ApproximateNumber length() const
Computes the Euclidean length of the polyline (the sum of its edge lengths).
Definition measures.hpp:1257
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1640
constexpr bool interiorsIntersect(const OtherPoint &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:1848
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherSet &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B), as a set of regions.
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherRectangle &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherConvex &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr Polyline scaledDownX(const OtherNumber scalar) const
Returns the polyline with its x-coordinates divided by a divisor.
constexpr bool crosses(const OtherConvex &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1010
constexpr auto squaredDistance(const OtherHalfplane &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1673
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherOrientedSegment &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2836
constexpr auto orientedEdgesView() const
Lazy view counterpart of orientedEdges(); see edgesView().
Definition polyline.hpp:635
constexpr Convex< PointType > convexHull() const
Returns the convex hull of the polyline's vertices.
Definition polyline.hpp:521
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2256
constexpr bool intersects(const OtherPoint &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1620
constexpr bool crosses(const OtherSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:952
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:638
constexpr auto lengthL1() const
Computes the Manhattan (L1) length of the polyline.
Definition measures.hpp:1266
constexpr auto distanceLInf(const OtherTriangle &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1345
constexpr bool interiorsIntersect(const OtherOrientedSegment &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:1890
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2895
PointType::NumberType NumberType
Definition polyline.hpp:71
constexpr bool boundaryContains(const OtherPoint &point) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1268
constexpr bool interiorsIntersect(const OtherTriangle &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2000
constexpr bool interiorContains(const OtherHalfplane &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1622
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2319
constexpr auto distanceL1(const OtherTriangle &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1357
constexpr auto cend() const
Returns a constant iterator past the last vertex.
Definition polyline.hpp:331
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherPolyline &other) const
Returns the regularized Minkowski sum of the two chains (A ⊕ B).
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherSegment &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr auto squaredDistance(const OtherRectangle &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1682
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints() const
Returns the integer points the polyline contains.
Definition lattice.hpp:534
constexpr Point< ResultNumber > pointInside() const
Returns a point inside the polyline.
Definition measures.hpp:1285
constexpr bool boundaryContains(const OtherOrientedSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:826
constexpr bool empty() const
Checks whether the polyline has no vertex.
Definition polyline.hpp:395
constexpr bool interiorContains(const OtherRay &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1616
constexpr bool intersects(const Shape< OtherPoint > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1777
constexpr auto verticesView() const
Returns a lazy view over the vertices, translating each on the fly instead of allocating a vector.
Definition polyline.hpp:615
constexpr bool crosses(const OtherRectangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:988
constexpr bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3871
constexpr bool intersects(const OtherHalfplane &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1690
constexpr std::vector< Segment< PointType > > edges() const
Returns the edges of the polyline.
Definition polyline.hpp:585
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherTriangle &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr std::optional< BoundaryType< false > > getIfSegment() const
Returns the segment the polyline collapses to, if it does.
Definition polyline.hpp:461
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > minkowskiErosion(const OtherShape &other) const
Returns the regularized Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B),...
Definition minkowskierosion.hpp:723
constexpr bool interiorsIntersect(const OtherPolyline &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2051
constexpr bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3459
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherHalfplane &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2868
constexpr bool crosses(const OtherOrientedLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:970
constexpr bool boundaryContains(const OtherRectangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:844
constexpr void pushBack(const OtherPoint &point)
Appends a vertex, extending the polyline by one edge.
Definition polyline.hpp:286
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherRegion &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr bool interiorsIntersect(const OtherSegment &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:1855
constexpr bool intersects(const OtherLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1672
constexpr bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3820
constexpr bool interiorContains(const Shape< OtherPoint > &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1664
constexpr bool separates(const OtherHalfplane &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3865
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherChain &other) const
Returns the intersection with a monotone chain (A ∩ B), a sequence of points and segments sorted by l...
Definition intersection.hpp:2900
constexpr bool boundaryContains(const OtherPolyline &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:881
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr auto distanceL1(const OtherChain &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1375
constexpr bool crosses(const OtherRay &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:976
constexpr auto distanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1272
constexpr auto squaredDistance(const OtherLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1646
constexpr Polyline(Range &&points)
Creates a polyline from a range of points.
Definition polyline.hpp:101
constexpr auto distanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1275
constexpr auto distanceL1(const OtherLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1312
constexpr std::optional< PointType > getIfPoint() const
Returns the point the polyline collapses to, if it does.
Definition polyline.hpp:433
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherConvex &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2892
constexpr auto distanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:1303
constexpr auto squaredDistance(const OtherChain &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1709
constexpr bool crosses(const OtherHalfplane &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:982
BoundaryIterator< true > OrientedEdgeIterator
Definition polyline.hpp:82
constexpr bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3806
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 polyline.hpp:1847
constexpr Polyline(std::initializer_list< NumberType > coords)
Creates a polyline from a flat list of coordinates.
Definition polyline.hpp:116
constexpr auto squaredDistance(const OtherShape &other) const
Returns the squared Euclidean distance to the given shape.
Definition polyline.hpp:1651
constexpr Segment< PointType > diameter() const
Returns a segment realizing the diameter (the farthest vertex pair).
Definition polyline.hpp:514
constexpr bool contains(const OtherRay &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2215
constexpr bool boundaryContains(const OtherConvex &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:856
constexpr std::size_t size() const
Returns the number of vertices in the polyline.
Definition polyline.hpp:388
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2271
constexpr bool crosses(const OtherDisk &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1004
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:2013
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:888
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherRectangle &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2876
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1628
constexpr auto distanceLInf(const OtherPolyline &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:1281
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1774
constexpr auto squaredDistance(const OtherOrientedLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1655
constexpr Polyline scaledUpY(const OtherNumber scalar) const
Returns the polyline with its y-coordinates multiplied by a factor.
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition polyline.hpp:958
constexpr Polyline scaledDownY(const OtherNumber scalar) const
Returns the polyline with its y-coordinates divided by a divisor.
constexpr bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3814
constexpr bool interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition polyline.hpp:952
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2295
constexpr auto operator<=>(const Polyline &other) const
Compares two polylines by their canonical vertex sequences.
Definition polyline.hpp:344
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:805
constexpr void scaleDownY(const OtherNumber scalar)
Divides the polyline's y-coordinates by a divisor in place.
Definition transformations.hpp:2080
constexpr bool boundaryContains(const OtherOrientedLine &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:835
constexpr bool crosses(const OtherPoint &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition polyline.hpp:1362
constexpr bool boundaryContains(const OtherSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:820
constexpr auto squaredDistance(const OtherPoint &point) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1610
constexpr bool boundaryContains(const OtherRay &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:838
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition polyline.hpp:1080
constexpr bool isPoint() const
Checks whether the polyline covers exactly one point.
Definition polyline.hpp:422
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition polyline.hpp:1414
constexpr bool intersects(const OtherConvex &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1715
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition polyline.hpp:984
constexpr std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherOrientedLine &other) const
Returns the intersection with a one-dimensional or convex shape (A ∩ B), a sequence of points and seg...
Definition intersection.hpp:2852
constexpr bool boundaryContains(const OtherLine &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polyline.hpp:832
constexpr bool contains(const Shape< OtherPoint > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2337
constexpr auto squaredDistance(const OtherPolyline &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1628
constexpr bool contains(const OtherLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2203
constexpr void set(std::size_t index, const OtherPoint &point)
Replaces the vertex at the given index.
Definition polyline.hpp:194
constexpr Polyline & operator-=(const OtherPoint &translation)
Translates the polyline by the negation of the given point.
Definition polyline.hpp:2288
constexpr bool interiorContains(const OtherPoint &point) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1581
constexpr auto cbegin() const
Returns a constant iterator to the first vertex.
Definition polyline.hpp:317
std::conditional_t< Oriented, OrientedSegment< PointType >, Segment< PointType > > BoundaryType
Definition polyline.hpp:76
constexpr bool boundaryContains(const Shape< OtherPoint > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1277
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition polyline.hpp:1166
constexpr auto edgesView() const
Returns a lazy view over the edges, materializing each Segment on the fly instead of allocating a vec...
Definition polyline.hpp:627
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
constexpr std::array< PointType, 2 > vertices() const
Returns the two endpoints in canonical order.
Definition bounding.hpp:93
constexpr Polyline< PointType > asPolyline() const
Returns the segment as a two-vertex polyline.
Definition polyline.hpp:2595
Runtime variant wrapper over the supported primitive shapes.
Definition shape.hpp:160