34template <
class Po
intType = Po
int<>,
class Label = NoLabel>
41template <
class Po
intType>
45template <Po
intConcept Po
intType>
49template <
class Number>
65template <
class Po
intType_,
class TLabel>
72 static_assert(detail::is_point_v<PointType>,
"Disk requires pgl::Point boundary points");
77 constexpr Disk() =
default;
87 : points_(canonicalizePoints(std::move(first), std::move(second), std::move(third))) {}
96 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
99 :
Disk(std::move(first), std::move(second), std::move(third)) {
100 label_ = std::forward<A>(
label);
117 const auto point_label = detail::copyLabel<PointLabelType>(
center);
119 points_ = canonicalizePoints(
127 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
130 label_ = std::forward<A>(
label);
141 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
152 template <Po
intConcept OtherPo
intType,
class OtherLabelType>
153 requires(std::constructible_from<PointType, const OtherPointType&>)
156 label_(detail::copyLabel<
LabelType>(other)) {}
165 template <Po
intConcept OtherPo
intType,
class OtherLabelType>
166 requires(std::constructible_from<PointType, const OtherPointType&>)
169 label_ = detail::copyLabel<LabelType>(other);
181 template <
class A = LabelType>
182 requires(detail::has_label_v<A>)
193 return points_[
index];
199 static constexpr std::size_t
size() {
208 const std::ptrdiff_t n =
static_cast<std::ptrdiff_t
>(
size());
209 return (*
this)[
static_cast<std::size_t
>(((
index % n) + n) % n)];
217 for (std::ptrdiff_t i = 0; i < static_cast<std::ptrdiff_t>(
size()); ++i) {
218 if ((*
this)[
static_cast<std::size_t
>(i)] == point) {
252 return PointIterator(
this, 0);
259 return PointIterator(
this, 0);
265 constexpr auto end()
const {
266 return PointIterator(
this,
size());
273 return PointIterator(
this,
size());
283 template <
class ResultNumber = division_result_t<NumberType>>
285 if (
auto cr = centerAndRadius()) {
293 using Coordinate = detail::promoted_number_t<std::common_type_t<NumberType, ResultNumber>>;
294 const Coordinate ax =
static_cast<Coordinate
>(
a().x()), ay =
static_cast<Coordinate
>(
a().
y());
295 const Coordinate bx =
static_cast<Coordinate
>(
b().x()), by =
static_cast<Coordinate
>(
b().
y());
296 const Coordinate cx =
static_cast<Coordinate
>(
c().x()), cy =
static_cast<Coordinate
>(
c().
y());
298 const Coordinate aa = ax * ax + ay * ay;
299 const Coordinate bb = bx * bx + by * by;
300 const Coordinate cc = cx * cx + cy * cy;
301 const Coordinate two =
static_cast<Coordinate
>(2);
303 const Coordinate denominator = two * (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by));
306 (aa * (by - cy) + bb * (cy - ay) + cc * (ay - by)) / denominator,
307 (aa * (cx - bx) + bb * (ax - cx) + cc * (bx - ax)) / denominator,
332 template <
class ResultNumber =
double>
333 [[nodiscard]]
constexpr ResultNumber
radius()
const {
334 if (
auto cr = centerAndRadius()) {
335 return static_cast<ResultNumber
>(cr->second);
338 if constexpr (!
requires(ResultNumber v) { std::sqrt(v); }) {
339 throw std::runtime_error(
"std::sqrt is not available for the requested ResultNumber type");
360 [[nodiscard]]
constexpr bool isPoint()
const {
361 return a() ==
b() &&
b() ==
c();
372 [[nodiscard]]
constexpr std::optional<PointType>
getIfPoint()
const {
401 template <
class ResultNumber = division_result_t<NumberType>>
403 if (
auto cr = centerAndRadius()) {
404 return detail::asNumber<ResultNumber>(cr->second) * detail::asNumber<ResultNumber>(cr->second);
408 return ResultNumber{};
418 const ResultNumber four =
static_cast<ResultNumber
>(4);
420 return (ab2 * bc2 * ca2) / (four * determinant * determinant);
443 template <std::
floating_po
int ResultNumber =
double>
444 [[nodiscard]]
constexpr ResultNumber
area()
const {
459 if (
auto cr = centerAndRadius()) {
460 const auto radius = cr->second;
480 if constexpr (std::floating_point<NumberType>) {
494 using Wide = std::conditional_t<
495 detail::extended_integral<NumberType>,
496 detail::promoted_number_t<detail::promoted_number_t<NumberType>>,
497 detail::promoted_number_t<NumberType>>;
498 const Wide ax =
a().x(), ay =
a().y();
499 const Wide bx =
b().x(), by =
b().y();
500 const Wide cx =
c().x(), cy =
c().y();
501 const Wide aa = ax * ax + ay * ay;
502 const Wide bb = bx * bx + by * by;
503 const Wide cc = cx * cx + cy * cy;
505 Wide d = Wide{2} * (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by));
506 Wide nx = aa * (by - cy) + bb * (cy - ay) + cc * (ay - by);
507 Wide ny = aa * (cx - bx) + bb * (ax - cx) + cc * (bx - ax);
509 d = -d; nx = -nx; ny = -ny;
512 const Wide ab2 = (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
513 const Wide bc2 = (bx - cx) * (bx - cx) + (by - cy) * (by - cy);
514 const Wide ca2 = (cx - ax) * (cx - ax) + (cy - ay) * (cy - ay);
518 const auto ceilIntSqrt = [](
auto n) {
519 using Int =
decltype(n);
521 if constexpr (
requires { std::sqrt(n); }) {
522 r =
static_cast<Int
>(std::sqrt(n));
523 }
else if (n >= Int{2}) {
524 Int
x = n,
y = (n + Int{1}) / Int{2};
525 while (
y <
x) {
x =
y;
y = (
x + n /
x) / Int{2}; }
530 while (r * r < n) { ++r; }
540 const Wide s = (ab2 * bc2 * ca2).simplified();
541 using Int = std::remove_cvref_t<
decltype(s.numerator())>;
542 const Int sn = s.numerator();
543 const Int sd = s.denominator();
544 const Wide u(ceilIntSqrt(sn * sd), sd);
563 const Wide q = ceilIntSqrt(ab2) * ceilIntSqrt(bc2) * ceilIntSqrt(ca2);
564 const auto floorDiv = [](Wide p, Wide den) {
565 return p >= Wide{0} ? p / den : -((-p + den - Wide{1}) / den);
567 const auto ceilDiv = [](Wide p, Wide den) {
568 return p >= Wide{0} ? (p + den - Wide{1}) / den : -((-p) / den);
572 static_cast<NumberType>(floorDiv(ny - q, d))),
574 static_cast<NumberType>(ceilDiv(ny + q, d))));
595 template <
class ResultNumber = gr
id_number_t<
typename Po
intType_::NumberType>>
596 requires(detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
609 template <std::
floating_po
int ResultNumber =
double>
613 const ResultNumber cx = center_point.x();
614 const ResultNumber cy = center_point.y();
629 template <
class ResultNumber = division_result_t<NumberType>>
631 const ResultNumber two =
static_cast<ResultNumber
>(2);
633 (detail::asNumber<ResultNumber>(
a().
x()) + detail::asNumber<ResultNumber>(
b().
x())) / two,
634 (detail::asNumber<ResultNumber>(
a().
y()) + detail::asNumber<ResultNumber>(
b().
y())) / two,
648 template <
class ResultNumber = division_result_t<NumberType>>
652 if (
auto cr = centerAndRadius()) {
661 ResultPoint anti_a = center_point + (center_point-
a());
677 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
678 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherPoint& point)
const;
693 template <
class ResultNumber =
double, SegmentConcept OtherSegment>
694 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherSegment& other)
const;
697 template <
class ResultNumber =
double, OrientedSegmentConcept OtherOrientedSegment>
698 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherOrientedSegment& other)
const;
701 template <
class ResultNumber =
double, LineConcept OtherLine>
702 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherLine& other)
const;
705 template <
class ResultNumber =
double, OrientedLineConcept OtherOrientedLine>
706 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherOrientedLine& other)
const;
709 template <
class ResultNumber =
double, RayConcept OtherRay>
710 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherRay& other)
const;
713 template <
class ResultNumber =
double, HalfplaneConcept OtherHalfplane>
714 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherHalfplane& other)
const;
717 template <
class ResultNumber =
double, RectangleConcept OtherRectangle>
718 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherRectangle& other)
const;
721 template <
class ResultNumber =
double, TriangleConcept OtherTriangle>
722 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherTriangle& other)
const;
733 template <
class ResultNumber =
double, DiskConcept OtherDisk>
734 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherDisk& other)
const;
743 template <
class ResultNumber =
double,
typename OtherShape>
745 &&
requires(
const OtherShape& o,
const Disk& self) { o.squaredDistance(self); })
746 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherShape& other)
const {
760 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
761 [[nodiscard]] detail::floating_result_t<ResultNumber>
distanceL1(
const OtherPoint& point)
const;
768 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
769 [[nodiscard]] detail::floating_result_t<ResultNumber>
distanceLInf(
const OtherPoint& point)
const;
786 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
801 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
802 [[nodiscard]] detail::floating_result_t<ResultNumber>
804 using FloatingResult = detail::floating_result_t<ResultNumber>;
809 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
810 [[nodiscard]] detail::floating_result_t<ResultNumber>
812 using FloatingResult = detail::floating_result_t<ResultNumber>;
826 template <Po
intConcept OtherPo
int>
827 [[nodiscard]]
constexpr bool contains(
const OtherPoint& other)
const;
837 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
838 [[nodiscard]]
constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
842 template <
class ResultNumber = NumberType,
class EmptyPo
int>
848 template <SegmentConcept OtherSegment>
849 [[nodiscard]]
constexpr bool contains(
const OtherSegment& other)
const;
852 template <OrientedSegmentConcept OtherOrientedSegment>
853 [[nodiscard]]
constexpr bool contains(
const OtherOrientedSegment& other)
const;
856 template <LineConcept OtherLine>
857 [[nodiscard]]
constexpr bool contains(
const OtherLine& other)
const;
860 template <OrientedLineConcept OtherOrientedLine>
861 [[nodiscard]]
constexpr bool contains(
const OtherOrientedLine& other)
const;
864 template <RayConcept OtherRay>
865 [[nodiscard]]
constexpr bool contains(
const OtherRay& other)
const;
868 template <HalfplaneConcept OtherHalfplane>
869 [[nodiscard]]
constexpr bool contains(
const OtherHalfplane& other)
const;
872 template <TriangleConcept OtherTriangle>
873 [[nodiscard]]
constexpr bool contains(
const OtherTriangle& other)
const;
876 template <RectangleConcept OtherRectangle>
877 [[nodiscard]]
constexpr bool contains(
const OtherRectangle& other)
const;
880 template <ConvexConcept OtherConvex>
881 [[nodiscard]]
constexpr bool contains(
const OtherConvex& other)
const;
884 template<PolygonConcept OtherPolygon>
885 [[nodiscard]]
constexpr bool contains(
const OtherPolygon& other)
const;
888 template <DiskConcept OtherDisk>
889 [[nodiscard]]
constexpr bool contains(
const OtherDisk& other)
const;
898 template <
class EmptyPo
int>
903 template <
class EmptyPo
int>
908 template <
class EmptyPo
int>
920 template <Po
intConcept OtherPo
int>
924 template <SegmentConcept OtherSegment>
928 template <OrientedSegmentConcept OtherOrientedSegment>
932 template <LineConcept OtherLine>
936 template <OrientedLineConcept OtherOrientedLine>
940 template <RayConcept OtherRay>
944 template <HalfplaneConcept OtherHalfplane>
948 template <TriangleConcept OtherTriangle>
952 template <RectangleConcept OtherRectangle>
956 template <ConvexConcept OtherConvex>
960 template <DiskConcept OtherDisk>
966 template <SegmentConcept OtherSegment>
967 [[nodiscard]]
constexpr bool intersects(
const OtherSegment& other)
const;
975 template <DiskConcept OtherDisk>
976 [[nodiscard]]
constexpr bool intersects(
const OtherDisk& other)
const;
987 template <Po
intConcept OtherPo
int>
991 template <SegmentConcept OtherSegment>
995 template <OrientedSegmentConcept OtherOrientedSegment>
999 template <LineConcept OtherLine>
1003 template <OrientedLineConcept OtherOrientedLine>
1007 template <RayConcept OtherRay>
1011 template <HalfplaneConcept OtherHalfplane>
1015 template <TriangleConcept OtherTriangle>
1019 template <RectangleConcept OtherRectangle>
1023 template <ConvexConcept OtherConvex>
1027 template<PolygonConcept OtherPolygon>
1031 template <DiskConcept OtherDisk>
1039 template<PolygonConcept OtherPolygon>
1043 template<PolygonConcept OtherPolygon>
1044 [[nodiscard]]
constexpr bool separates(
const OtherPolygon& other)
const;
1047 template<MonotoneChainConcept OtherChain>
1048 [[nodiscard]]
constexpr bool contains(
const OtherChain& other)
const;
1051 template<MonotoneChainConcept OtherChain>
1055 template<MonotoneChainConcept OtherChain>
1059 template<MonotoneChainConcept OtherChain>
1060 [[nodiscard]]
constexpr bool separates(
const OtherChain& other)
const;
1063 template<PolylineConcept OtherPolyline>
1064 [[nodiscard]]
constexpr bool contains(
const OtherPolyline& other)
const;
1067 template<PolylineConcept OtherPolyline>
1071 template<PolylineConcept OtherPolyline>
1075 template<PolylineConcept OtherPolyline>
1076 [[nodiscard]]
constexpr bool separates(
const OtherPolyline& other)
const;
1079 template<HalfplaneIntersectionConcept OtherRegion>
1080 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1083 template<HalfplaneIntersectionConcept OtherRegion>
1087 template<HalfplaneIntersectionConcept OtherRegion>
1091 template<HalfplaneIntersectionConcept OtherRegion>
1092 [[nodiscard]]
constexpr bool separates(
const OtherRegion& other)
const;
1101 template<PolygonWithHolesConcept OtherRegion>
1102 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1110 template<PolygonWithHolesConcept OtherRegion>
1114 template<PolygonWithHolesConcept OtherRegion>
1126 template<PolygonWithHolesConcept OtherRegion>
1127 [[nodiscard]]
bool separates(
const OtherRegion& other)
const;
1138 template<PolygonSetConcept OtherSet>
1139 [[nodiscard]]
constexpr bool contains(
const OtherSet& other)
const {
1140 for (
const auto& component : other) {
1149 template<PolygonSetConcept OtherSet>
1151 for (
const auto& component : other) {
1160 template<PolygonSetConcept OtherSet>
1162 for (
const auto& component : other) {
1178 template<PolygonSetConcept OtherSet>
1183 template<Po
intConcept OtherPo
int>
1184 [[nodiscard]]
constexpr bool separates(
const OtherPoint& other)
const;
1189 template <SegmentConcept OtherSegment>
1190 [[nodiscard]]
constexpr bool separates(
const OtherSegment& other)
const;
1193 template <OrientedSegmentConcept OtherOrientedSegment>
1194 [[nodiscard]]
constexpr bool separates(
const OtherOrientedSegment& other)
const;
1197 template <LineConcept OtherLine>
1198 [[nodiscard]]
constexpr bool separates(
const OtherLine& other)
const;
1201 template <OrientedLineConcept OtherOrientedLine>
1202 [[nodiscard]]
constexpr bool separates(
const OtherOrientedLine& other)
const;
1205 template <ConvexConcept OtherConvex>
1206 [[nodiscard]]
constexpr bool separates(
const OtherConvex& other)
const;
1209 template<RayConcept OtherRay>
1210 [[nodiscard]]
constexpr bool separates(
const OtherRay& other)
const;
1213 template<HalfplaneConcept OtherHalfplane>
1214 [[nodiscard]]
constexpr bool separates(
const OtherHalfplane& other)
const;
1217 template<RectangleConcept OtherRectangle>
1218 [[nodiscard]]
constexpr bool separates(
const OtherRectangle& other)
const;
1221 template<TriangleConcept OtherTriangle>
1222 [[nodiscard]]
constexpr bool separates(
const OtherTriangle& other)
const;
1225 template<DiskConcept OtherDisk>
1226 [[nodiscard]]
constexpr bool separates(
const OtherDisk& other)
const;
1237 template<Po
intConcept OtherPo
int>
1238 [[nodiscard]]
constexpr bool intersects(
const OtherPoint& other)
const;
1240 template<OrientedSegmentConcept OtherOrientedSegment>
1241 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedSegment& other)
const;
1243 template<LineConcept OtherLine>
1244 [[nodiscard]]
constexpr bool intersects(
const OtherLine& other)
const;
1246 template<OrientedLineConcept OtherOrientedLine>
1247 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedLine& other)
const;
1249 template<RayConcept OtherRay>
1250 [[nodiscard]]
constexpr bool intersects(
const OtherRay& other)
const;
1252 template<HalfplaneConcept OtherHalfplane>
1253 [[nodiscard]]
constexpr bool intersects(
const OtherHalfplane& other)
const;
1255 template<RectangleConcept OtherRectangle>
1256 [[nodiscard]]
constexpr bool intersects(
const OtherRectangle& other)
const;
1258 template<TriangleConcept OtherTriangle>
1259 [[nodiscard]]
constexpr bool intersects(
const OtherTriangle& other)
const;
1262 template<Po
intConcept OtherPo
int>
1265 template<SegmentConcept OtherSegment>
1268 template<OrientedSegmentConcept OtherOrientedSegment>
1271 template<LineConcept OtherLine>
1274 template<OrientedLineConcept OtherOrientedLine>
1277 template<RayConcept OtherRay>
1280 template<HalfplaneConcept OtherHalfplane>
1283 template<RectangleConcept OtherRectangle>
1286 template<TriangleConcept OtherTriangle>
1289 template<DiskConcept OtherDisk>
1293 template<Po
intConcept OtherPo
int>
1294 [[nodiscard]]
constexpr bool crosses(
const OtherPoint& other)
const;
1296 template<SegmentConcept OtherSegment>
1297 [[nodiscard]]
constexpr bool crosses(
const OtherSegment& other)
const;
1299 template<OrientedSegmentConcept OtherOrientedSegment>
1300 [[nodiscard]]
constexpr bool crosses(
const OtherOrientedSegment& other)
const;
1302 template<LineConcept OtherLine>
1303 [[nodiscard]]
constexpr bool crosses(
const OtherLine& other)
const;
1305 template<OrientedLineConcept OtherOrientedLine>
1306 [[nodiscard]]
constexpr bool crosses(
const OtherOrientedLine& other)
const;
1308 template<RayConcept OtherRay>
1309 [[nodiscard]]
constexpr bool crosses(
const OtherRay& other)
const;
1311 template<HalfplaneConcept OtherHalfplane>
1312 [[nodiscard]]
constexpr bool crosses(
const OtherHalfplane& other)
const;
1314 template<RectangleConcept OtherRectangle>
1315 [[nodiscard]]
constexpr bool crosses(
const OtherRectangle& other)
const;
1317 template<TriangleConcept OtherTriangle>
1318 [[nodiscard]]
constexpr bool crosses(
const OtherTriangle& other)
const;
1320 template<DiskConcept OtherDisk>
1321 [[nodiscard]]
constexpr bool crosses(
const OtherDisk& other)
const;
1324 template<Po
intConcept OtherPo
int>
1327 template<Po
intConcept OtherPo
int>
1330 template<Po
intConcept OtherPo
int>
1334 template<
typename OtherShape>
1336 [[nodiscard]]
constexpr bool intersects(
const OtherShape& other)
const {
1337 return other.intersects(*
this);
1341 template <
class EmptyPo
int>
1346 template<
typename OtherShape>
1349 return other.interiorsIntersect(*
this);
1353 template <
class EmptyPo
int>
1358 template<
typename OtherShape>
1360 [[nodiscard]]
constexpr bool crosses(
const OtherShape& other)
const {
1361 return other.crosses(*
this);
1365 template <
class EmptyPo
int>
1375 template <
class Scalar>
1377 constexpr Disk&
operator/=(
const Scalar& scalar) {
1378 for (
auto& point : points_) {
1381 points_ = canonicalizePoints(points_[0], points_[1], points_[2]);
1400 return a() == other.
a() &&
1407 return inCircleSign(
a(),
b(),
c(), other.
a()) == std::partial_ordering::equivalent &&
1408 inCircleSign(
a(),
b(),
c(), other.
b()) == std::partial_ordering::equivalent &&
1409 inCircleSign(
a(),
b(),
c(), other.
c()) == std::partial_ordering::equivalent;
1413 template<AnyShapeConcept OtherShape>
1435 return isDegenerate() ? std::partial_ordering::less : std::partial_ordering::greater;
1443 if (radius_order != 0) {
1444 return radius_order;
1450 const auto first_point_order =
a() <=> other.
a();
1451 if (first_point_order != 0) {
1452 return first_point_order;
1455 const auto second_point_order =
b() <=> other.
b();
1456 if (second_point_order != 0) {
1457 return second_point_order;
1460 return c() <=> other.
c();
1491 template <
class OtherShape>
1517 template <
class OtherShape>
1546 template <
class ResultNumber =
double, DiskConcept OtherDisk>
1547 [[nodiscard]] std::optional<Disk<Point<ResultNumber, PointLabelType>>>
1564 template <
class ResultNumber =
double, HalfplaneConcept OtherHalfplane>
1598 template <
class ResultNumber =
double, DiskConcept OtherDisk>
1611 template <
class ResultNumber =
double, HalfplaneConcept OtherHalfplane>
1619 template <Po
intConcept OtherPo
int>
1621 for (
auto& point : points_) {
1622 point += translation;
1631 template <Po
intConcept OtherPo
int>
1633 for (
auto& point : points_) {
1634 point -= translation;
1644 template <
class Scalar>
1646 constexpr Disk&
operator*=(
const Scalar& scalar) {
1647 for (
auto& point : points_) {
1650 points_ = canonicalizePoints(points_[0], points_[1], points_[2]);
1670 assert(disk !=
nullptr);
1671 return (*disk)[index];
1695 : disk(disk_arg), index(index_arg) {}
1697 const Disk* disk =
nullptr;
1698 std::size_t
index = 0;
1713 template <
class OtherShape>
1717 return shape.interiorContains(p);
1731 std::array<PointType, 3> points{
1738 if (points[1] < points[0]) {
1739 std::swap(points[0], points[1]);
1741 if (points[2] < points[1]) {
1742 std::swap(points[1], points[2]);
1744 if (points[1] < points[0]) {
1745 std::swap(points[0], points[1]);
1749 if (
orientationSign(points[0], points[1], points[2]) == std::partial_ordering::less) {
1750 std::swap(points[1], points[2]);
1760 [[nodiscard]]
constexpr std::optional<std::pair<PointType, NumberType>> centerAndRadius()
const {
1761 if (
a().
y() ==
b().
y()) {
1764 if (r >= 0 &&
b().
x() == center_x + r &&
c().
x() == center_x) {
1765 return std::make_pair(
PointType(center_x,
a().
y()), r);
1768 return std::nullopt;
1771 std::array<PointType, 3> points_{};
1772 [[no_unique_address]]
mutable LabelType label_{};
1780template <
class Po
intType,
class LabelType,
class TranslationNumber,
class TranslationLabel>
1783 result -= translation;
1784 if constexpr (detail::has_label_v<LabelType>) {
1785 result.label() = LabelType{};
1791template <
class Po
intType,
class LabelType,
class Scalar>
1792 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1796 if constexpr (detail::has_label_v<LabelType>) {
1797 result.label() = LabelType{};
1803template <
class Scalar,
class Po
intType,
class LabelType>
1804 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1806 return disk * scalar;
1810template <
class Po
intType,
class LabelType,
class Scalar>
1811 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
1815 if constexpr (detail::has_label_v<LabelType>) {
1816 result.label() = LabelType{};
1822template <
class Po
intType,
class LabelType>
friend struct Disk
Deduces a default disk with Point<> boundary points and no label.
Definition disk.hpp:1691
constexpr bool operator==(const PointIterator &other) const =default
Returns whether both iterators refer to the same position.
const PointType & reference
Definition disk.hpp:1663
constexpr PointIterator()=default
Creates a singular (past-the-end style) iterator.
constexpr PointIterator & operator++()
Advances to the next boundary point (pre-increment).
Definition disk.hpp:1675
std::forward_iterator_tag iterator_concept
Definition disk.hpp:1660
constexpr PointIterator operator++(int)
Advances to the next boundary point (post-increment).
Definition disk.hpp:1681
std::ptrdiff_t difference_type
Definition disk.hpp:1662
std::forward_iterator_tag iterator_category
Definition disk.hpp:1659
constexpr reference operator*() const
Returns the boundary point at the current position.
Definition disk.hpp:1669
PointType value_type
Definition disk.hpp:1661
Shape pairs whose Minkowski sum Pangolin can represent.
Definition forward.hpp:476
Definition forward.hpp:306
Definition arrangement.hpp:67
constexpr std::partial_ordering inCircleSign(const Point< ANumber, ALabel > &a, const Point< BNumber, BLabel > &b, const Point< CNumber, CLabel > &c, const Point< DNumber, DLabel > &d)
Classifies a point with respect to the circumcircle of three others.
Definition orientation.hpp:894
@ y
Definition intervaltree.hpp:24
@ x
Definition intervaltree.hpp:24
constexpr bool is_Rational_v
Definition rational.hpp:37
typename DivisionResult< Number >::type division_result_t
Convenience alias for DivisionResult.
Definition rational.hpp:1175
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
constexpr std::partial_ordering orientationSign(const Point< ANumber, ALabel > &a, const Point< BNumber, BLabel > &b, const Point< CNumber, CLabel > &c)
Classifies the orientation of three points.
Definition orientation.hpp:544
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 >
constexpr auto orientationDeterminant(const Point< ANumber, ALabel > &a, const Point< BNumber, BLabel > &b, const Point< CNumber, CLabel > &c)
Returns the signed orientation determinant of three points.
Definition orientation.hpp:518
Disk() -> Disk< Point<>, NoLabel >
Deduces a default disk with Point<> boundary points and no label.
Definition disk.hpp:1691
Closed Euclidean disk stored by boundary points plus optional disk label.
Definition disk.hpp:66
constexpr ResultNumber squaredRadius() const
Definition disk.hpp:402
constexpr bool boundaryContains(const OtherPoint &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:489
constexpr Point< ResultNumber, PointLabelType > center() const
Definition disk.hpp:284
constexpr bool boundaryContains(const OtherDisk &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:620
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1149
constexpr bool intersects(const OtherSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:904
constexpr bool interiorsIntersect(const OtherLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1464
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition disk.hpp:899
constexpr bool interiorsIntersect(const OtherSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1409
constexpr Disk rotated90(int k=1) const
Returns the disk rotated by 90k degrees around the origin.
Definition transformations.hpp:2183
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:1995
constexpr bool crosses(const OtherTriangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:784
constexpr std::optional< PointType > getIfPoint() const
Returns the point the disk collapses to, if it does.
Definition disk.hpp:372
constexpr bool intersects(const OtherLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1194
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1119
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1726
constexpr bool contains(const OtherLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1041
constexpr bool boundaryContains(const OtherPolygon &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1014
constexpr bool boundaryContains(const OtherLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:526
constexpr bool interiorContains(const OtherLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1125
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition disk.hpp:904
constexpr bool isDegenerate() const
Returns whether the three boundary points are collinear.
Definition disk.hpp:348
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition disk.hpp:1336
constexpr const PointType & c() const
Definition disk.hpp:244
constexpr bool crosses(const OtherSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:738
constexpr bool pointInsideInteriorContainedIn(const OtherShape &shape) const
Tests whether some point strictly inside this disk lies in the strict interior of shape.
Definition disk.hpp:1714
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 disk.hpp:787
constexpr const PointType & operator[](std::size_t index) const
Returns boundary point index in canonical order.
Definition disk.hpp:191
Disk< Point< ResultNumber, PointLabelType > > minkowskiSum(const OtherDisk &other) const
Returns the Minkowski sum of the two disks (A ⊕ B), a disk.
constexpr bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4006
constexpr bool separates(const OtherPoint &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1712
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr bool intersects(const OtherOrientedLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1228
constexpr bool boundaryContains(const OtherSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:502
detail::floating_result_t< ResultNumber > squaredDistance(const OtherOrientedSegment &other) const
Returns the squared Euclidean distance from this disk to a shape.
Definition distance.hpp:1223
constexpr bool intersects(const OtherPoint &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1182
constexpr bool boundaryContains(const OtherOrientedLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:538
constexpr bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1826
constexpr bool crosses(const OtherPoint &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:732
constexpr bool contains(const OtherOrientedLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1047
constexpr bool interiorContains(const OtherOrientedLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1131
constexpr bool crosses(const OtherRectangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:774
constexpr bool contains(const OtherPoint &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1015
constexpr auto end() const
Returns an iterator past the last boundary point.
Definition disk.hpp:265
constexpr bool interiorContains(const OtherPoint &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1107
TLabel LabelType
Definition disk.hpp:70
detail::floating_result_t< ResultNumber > squaredDistance(const OtherSegment &other) const
Returns the squared Euclidean distance from this disk to a shape.
Definition distance.hpp:1212
PointType::LabelType PointLabelType
Definition disk.hpp:69
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition disk.hpp:1342
constexpr bool crosses(const OtherHalfplane &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:768
constexpr A & label() const
Definition disk.hpp:183
constexpr bool contains(const OtherHalfplane &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1059
constexpr Disk(PointType first, PointType second, PointType third)
Creates the disk through three boundary points.
Definition disk.hpp:85
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2448
constexpr Disk & operator=(const Disk< OtherPointType, OtherLabelType > &other)
Assigns from a disk with compatible point and label types.
Definition disk.hpp:167
constexpr bool interiorsIntersect(const Shape< OtherPoint > &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1610
detail::floating_result_t< ResultNumber > squaredDistance(const OtherShape &other) const
Returns the squared Euclidean distance to the given shape.
Definition disk.hpp:746
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2834
constexpr auto cend() const
Returns a const iterator past the last boundary point.
Definition disk.hpp:272
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition disk.hpp:909
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1071
constexpr bool intersects(const OtherTriangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1301
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:6008
detail::floating_result_t< ResultNumber > distanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) distance from this disk to a point.
Definition distancelinf.hpp:191
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints() const
Returns the integer points the disk contains.
Definition lattice.hpp:594
detail::floating_result_t< ResultNumber > squaredDistance(const OtherPoint &point) const
Returns the squared Euclidean distance from this disk to a point.
Definition distance.hpp:1194
Halfplane< Point< ResultNumber, PointLabelType > > minkowskiSum(const OtherHalfplane &other) const
Returns the Minkowski sum of this disk and a half-plane (A ⊕ B), a half-plane.
detail::floating_result_t< ResultNumber > squaredDistance(const OtherHalfplane &other) const
Returns the squared Euclidean distance from this disk to a shape.
Definition distance.hpp:1267
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1529
constexpr ResultNumber radius() const
Definition disk.hpp:333
detail::floating_result_t< ResultNumber > squaredDistance(const OtherRectangle &other) const
Returns the squared Euclidean distance from this disk to a shape.
Definition distance.hpp:1278
constexpr bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1748
constexpr bool interiorsIntersect(const OtherRay &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1497
constexpr Disk & operator-=(const OtherPoint &translation)
Translates the disk by -translation in place.
Definition disk.hpp:1632
constexpr bool operator==(const Disk &other) const
Returns whether two disks describe the same closed region.
Definition disk.hpp:1391
constexpr bool boundaryContains(const OtherOrientedSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:514
constexpr bool boundaryContains(const OtherConvex &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:607
constexpr bool interiorsIntersect(const OtherTriangle &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1569
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1083
constexpr bool interiorsIntersect(const OtherOrientedLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1491
constexpr Disk(PointType center, NumberType radius)
Creates a disk from its center and radius.
Definition disk.hpp:111
constexpr bool boundaryContains(const Shape< PointType > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:638
constexpr Point< ResultNumber, PointLabelType > pointInside() const
Returns the midpoint of the first two boundary points.
Definition disk.hpp:630
constexpr bool interiorsIntersect(const OtherPoint &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1402
constexpr bool intersects(const Shape< OtherPoint > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1317
constexpr bool boundaryContains(const OtherTriangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:574
constexpr bool intersects(const OtherOrientedSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1188
constexpr bool crosses(const OtherLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:750
constexpr bool crosses(const OtherRay &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:762
constexpr bool boundaryContains(const OtherRectangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:588
constexpr Disk()=default
Creates a disk with all three boundary points at the origin.
constexpr Rectangle< PointType > bbox() const
Returns an axis-aligned bounding box in the coordinate type.
Definition disk.hpp:457
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition disk.hpp:1348
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:802
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2086
constexpr Disk(PointType first, PointType second, PointType third, A &&label)
Creates a disk from three boundary points and stores a label.
Definition disk.hpp:97
detail::floating_result_t< ResultNumber > distanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) distance from this disk to a point.
Definition distancel1.hpp:203
detail::floating_result_t< ResultNumber > distanceLInf(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition disk.hpp:811
constexpr void rotate90(int k=1)
Rotates the disk by 90k degrees around the origin in place.
Definition transformations.hpp:2188
constexpr Disk(PointType center, NumberType radius, A &&label)
Same as above, and stores a disk label.
Definition disk.hpp:128
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition disk.hpp:843
static constexpr std::size_t size()
Returns the number of stored boundary points (always 3).
Definition disk.hpp:199
constexpr bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1718
PointType::NumberType NumberType
Definition disk.hpp:68
constexpr bool intersects(const OtherRectangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1281
constexpr bool interiorsIntersect(const OtherHalfplane &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1537
detail::floating_result_t< ResultNumber > squaredDistance(const OtherTriangle &other) const
Returns the squared Euclidean distance from this disk to a shape.
Definition distance.hpp:1289
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1179
detail::floating_result_t< ResultNumber > squaredDistance(const OtherOrientedLine &other) const
Returns the squared Euclidean distance from this disk to a shape.
Definition distance.hpp:1245
constexpr bool interiorContains(const OtherRay &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1137
constexpr bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1792
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
constexpr ResultNumber area() const
Returns the area pi * R^2 of the closed disk.
Definition disk.hpp:444
constexpr bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1727
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1094
constexpr bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4658
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:2421
constexpr const PointType & a() const
Definition disk.hpp:228
constexpr bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1843
constexpr auto begin() const
Returns an iterator to the first boundary point.
Definition disk.hpp:251
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1168
constexpr bool interiorsIntersect(const OtherRectangle &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1547
detail::floating_result_t< ResultNumber > squaredDistance(const OtherLine &other) const
Returns the squared Euclidean distance from this disk to a shape.
Definition distance.hpp:1234
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2131
constexpr std::ptrdiff_t index(const PointType &point) const
Definition disk.hpp:216
constexpr bool contains(const OtherRay &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1053
constexpr Disk & operator+=(const OtherPoint &translation)
Translates the disk by translation in place.
Definition disk.hpp:1620
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1755
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1035
constexpr std::partial_ordering operator<=>(const Disk &other) const
Orders disks by increasing squared radius, then by center.
Definition disk.hpp:1432
constexpr bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1804
constexpr bool boundaryContains(const OtherRay &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:550
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1804
detail::floating_result_t< ResultNumber > distanceL1(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition disk.hpp:803
constexpr bool interiorsIntersect(const OtherDisk &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1587
constexpr bool interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1155
constexpr bool isUndefined() const
Returns whether the disk is degenerate without collapsing to a point.
Definition disk.hpp:391
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1029
constexpr Disk(NumberType x, NumberType y, NumberType radius)
Creates a disk from center coordinates and a radius.
Definition disk.hpp:136
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5759
constexpr bool boundaryContains(const OtherChain &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1213
constexpr bool intersects(const OtherDisk &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:954
constexpr bool contains(const Shape< PointType > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1121
constexpr auto cbegin() const
Returns a const iterator to the first boundary point.
Definition disk.hpp:258
constexpr bool intersects(const OtherRay &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1234
EmptyShape< Point< ResultNumber, PointLabelType > > minkowskiErosion(const OtherHalfplane &other) const
Returns the Minkowski erosion of this disk by a half-plane (A ⊖ B), which is empty.
constexpr Segment< Point< ResultNumber, PointLabelType > > diameter() const
Returns a segment defining a diameter of the disk.
Definition disk.hpp:649
constexpr bool crosses(const OtherDisk &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:790
constexpr bool interiorContains(const OtherHalfplane &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1143
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition disk.hpp:1360
detail::floating_result_t< ResultNumber > squaredDistance(const OtherRay &other) const
Returns the squared Euclidean distance from this disk to a shape.
Definition distance.hpp:1256
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition disk.hpp:1150
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition disk.hpp:1139
constexpr Disk(NumberType x, NumberType y, NumberType radius, A &&label)
Same as above, and stores a disk label.
Definition disk.hpp:142
constexpr bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1742
constexpr bool boundaryContains(const OtherPolyline &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1322
constexpr bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:2294
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition disk.hpp:1161
constexpr Disk(const Disk< OtherPointType, OtherLabelType > &other)
Converts a disk with a different point and/or label type.
Definition disk.hpp:154
constexpr bool crosses(const OtherOrientedSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:744
constexpr bool isPoint() const
Returns whether the disk collapses to a single point.
Definition disk.hpp:360
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1065
constexpr bool crosses(const OtherOrientedLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:756
detail::floating_result_t< ResultNumber > squaredDistance(const OtherDisk &other) const
Returns the squared Euclidean distance between two disks.
Definition distance.hpp:1300
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition disk.hpp:1354
constexpr const PointType & b() const
Definition disk.hpp:235
constexpr bool separates(const OtherHalfplane &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1798
constexpr bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1733
constexpr bool interiorsIntersect(const OtherOrientedSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:1458
constexpr bool crosses(const Shape< OtherPoint > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:796
constexpr bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3201
constexpr bool interiorContains(const OtherSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1113
Point< typename min_disk_input_point_t< Container >::NumberType > PointType
Definition disk.hpp:67
std::optional< Disk< Point< ResultNumber, PointLabelType > > > minkowskiErosion(const OtherDisk &other) const
Returns the Minkowski erosion of this disk by another (A ⊖ B), a disk when there is one.
constexpr bool intersects(const OtherHalfplane &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:1275
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition disk.hpp:1366
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1334
constexpr bool boundaryContains(const OtherHalfplane &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:562
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:635
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 disk.hpp:207
constexpr Rectangle< Point< ResultNumber > > fbox() const
Returns a floating-point bounding box of the disk.
Definition disk.hpp:610
The empty set of points in the plane.
Definition emptyshape.hpp:33
Closed half-plane defined by an oriented boundary line.
Definition halfplane.hpp:51
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
TLabel LabelType
Definition point.hpp:133
TNumber NumberType
Definition point.hpp:131
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
Public declaration of pgl::Triangle.