28template <
class Po
intType = Po
int<>,
class Label>
33template <
class Po
intType>
36template <
class Po
intType,
class A>
39template <
class Number>
52template <
class Po
intType_,
class TLabel>
67 using iterator =
typename std::array<PointType, 3>::const_iterator;
70 template <
bool Oriented>
73 template <
bool Oriented>
74 class BoundaryIterator;
79 static_assert(detail::is_point_v<PointType>,
"Triangle requires pgl::Point vertices");
97 : points_(canonicalizeVertices(std::move(first), std::move(second), std::move(third))) {}
120 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
122 : points_(canonicalizeVertices(std::move(first), std::move(second), std::move(third))),
123 label_(std::forward<A>(
label)) {}
127 requires(detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
138 template<Po
intConcept OtherPo
intType,
class OtherLabelType>
139 requires(std::constructible_from<PointType, const OtherPointType&>)
142 label_ = detail::copyLabel<LabelType>(other);
152 template<Po
intConcept OtherPo
intType,
class OtherLabelType>
153 requires(std::constructible_from<PointType, const OtherPointType&>)
155 points_ = canonicalizeVertices(
159 label_ = detail::copyLabel<LabelType>(other);
171 return points_[
index];
177 static constexpr std::size_t
size() {
186 const std::ptrdiff_t n =
static_cast<std::ptrdiff_t
>(
size());
187 return (*
this)[
static_cast<std::size_t
>(((
index % n) + n) % n)];
195 for (std::ptrdiff_t i = 0; i < static_cast<std::ptrdiff_t>(
size()); ++i) {
196 if ((*
this)[
static_cast<std::size_t
>(i)] == point) {
236 return points_.cbegin();
245 return points_.cbegin();
253 constexpr auto end()
const {
254 return points_.cend();
263 return points_.cend();
273 return points_ == other.points_;
277 template<AnyShapeConcept OtherShape>
278 [[nodiscard]]
constexpr bool samePointSet(
const OtherShape& other)
const;
282 return points_ <=> other.points_;
293 template <
class A = LabelType>
294 requires(detail::has_label_v<A>)
314 template <
class ResultNumber = division_result_t<NumberType>>
315 [[nodiscard]]
constexpr ResultNumber
area()
const;
340 [[nodiscard]]
constexpr std::optional<PointType>
getIfPoint()
const;
362 [[nodiscard]]
constexpr std::optional<BoundaryType<false>>
getIfSegment()
const;
401 template <
class ResultNumber = gr
id_number_t<
typename Po
intType_::NumberType>>
402 requires(detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
412 template <std::
floating_po
int ResultNumber =
double>
420 [[nodiscard]]
constexpr std::array<PointType, 3>
vertices()
const;
427 [[nodiscard]]
constexpr std::array<Segment<PointType>, 3>
edges()
const;
452 [[nodiscard]]
constexpr std::array<OrientedSegment<PointType>, 3>
orientedEdges()
const;
575 template <
class OtherNumber>
579 template <
class OtherNumber>
583 template <
class OtherNumber>
587 template <
class OtherNumber>
591 template <
class OtherNumber>
595 template <
class OtherNumber>
599 template <
class OtherNumber>
603 template <
class OtherNumber>
613 template <
class ResultNumber = division_result_t<NumberType>>
641 template <
class ResultNumber = division_result_t<NumberType>>
652 template <
class OtherShape>
683 template<Po
intConcept OtherPo
int>
693 template<Po
intConcept OtherPo
int>
697 template<SegmentConcept OtherSegment>
701 template<OrientedSegmentConcept OtherOrientedSegment>
705 template<LineConcept OtherLine>
709 template<OrientedLineConcept OtherOrientedLine>
713 template<RayConcept OtherRay>
717 template<HalfplaneConcept OtherHalfplane>
721 template<RectangleConcept OtherRectangle>
725 template<TriangleConcept OtherTriangle>
737 template<Po
intConcept OtherPo
int>
738 [[nodiscard]]
constexpr bool contains(
const OtherPoint& point)
const;
741 template<SegmentConcept OtherSegment>
742 [[nodiscard]]
constexpr bool contains(
const OtherSegment& other)
const;
745 template<OrientedSegmentConcept OtherOrientedSegment>
746 [[nodiscard]]
constexpr bool contains(
const OtherOrientedSegment& other)
const;
749 template<LineConcept OtherLine>
750 [[nodiscard]]
constexpr bool contains(
const OtherLine& other)
const;
753 template<OrientedLineConcept OtherOrientedLine>
754 [[nodiscard]]
constexpr bool contains(
const OtherOrientedLine& other)
const;
757 template<RayConcept OtherRay>
758 [[nodiscard]]
constexpr bool contains(
const OtherRay& other)
const;
761 template<HalfplaneConcept OtherHalfplane>
762 [[nodiscard]]
constexpr bool contains(
const OtherHalfplane& other)
const;
765 template<RectangleConcept OtherRectangle>
766 [[nodiscard]]
constexpr bool contains(
const OtherRectangle& other)
const;
769 template<TriangleConcept OtherTriangle>
770 [[nodiscard]]
constexpr bool contains(
const OtherTriangle& other)
const;
773 template<ConvexConcept OtherConvex>
774 [[nodiscard]]
constexpr bool contains(
const OtherConvex& other)
const;
777 template<PolygonConcept OtherPolygon>
778 [[nodiscard]]
constexpr bool contains(
const OtherPolygon& other)
const;
781 template<DiskConcept OtherDisk>
782 [[nodiscard]]
constexpr bool contains(
const OtherDisk& other)
const;
795 template <
class EmptyPo
int>
800 template <
class EmptyPo
int>
805 template <
class EmptyPo
int>
810 template <
class EmptyPo
int>
822 template<Po
intConcept OtherPo
int>
826 template<SegmentConcept OtherSegment>
830 template<OrientedSegmentConcept OtherOrientedSegment>
834 template<LineConcept OtherLine>
838 template<OrientedLineConcept OtherOrientedLine>
842 template<RayConcept OtherRay>
846 template<HalfplaneConcept OtherHalfplane>
850 template<RectangleConcept OtherRectangle>
854 template<TriangleConcept OtherTriangle>
864 template<Po
intConcept OtherPo
int>
865 [[nodiscard]]
constexpr bool intersects(
const OtherPoint& other)
const;
868 template<LineConcept OtherLine>
869 [[nodiscard]]
constexpr bool intersects(
const OtherLine& other)
const;
872 template<OrientedLineConcept OtherOrientedLine>
873 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedLine& other)
const;
876 template<SegmentConcept OtherSegment>
877 [[nodiscard]]
constexpr bool intersects(
const OtherSegment& other)
const;
880 template<OrientedSegmentConcept OtherOrientedSegment>
881 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedSegment& other)
const;
884 template<RayConcept OtherRay>
885 [[nodiscard]]
constexpr bool intersects(
const OtherRay& other)
const;
888 template<HalfplaneConcept OtherHalfplane>
889 [[nodiscard]]
constexpr bool intersects(
const OtherHalfplane& other)
const;
892 template<RectangleConcept OtherRectangle>
893 [[nodiscard]]
constexpr bool intersects(
const OtherRectangle& other)
const;
896 template<TriangleConcept OtherTriangle>
897 [[nodiscard]]
constexpr bool intersects(
const OtherTriangle& other)
const;
903 template<
typename OtherShape>
905 [[nodiscard]]
constexpr bool intersects(
const OtherShape& other)
const {
906 return other.intersects(*
this);
910 template <
class EmptyPo
int>
916 template<Po
intConcept OtherPo
int>
920 template<LineConcept OtherLine>
924 template<OrientedLineConcept OtherOrientedLine>
928 template<SegmentConcept OtherSegment>
932 template<OrientedSegmentConcept OtherOrientedSegment>
936 template<RayConcept OtherRay>
940 template<HalfplaneConcept OtherHalfplane>
944 template<RectangleConcept OtherRectangle>
948 template<TriangleConcept OtherTriangle>
952 template<
typename OtherShape>
955 return other.interiorsIntersect(*
this);
959 template <
class EmptyPo
int>
968 template<SegmentConcept OtherSegment>
969 [[nodiscard]]
constexpr bool separates(
const OtherSegment& other)
const;
972 template<Po
intConcept OtherPo
int>
973 [[nodiscard]]
constexpr bool separates(
const OtherPoint& other)
const;
976 template<OrientedSegmentConcept OtherOrientedSegment>
977 [[nodiscard]]
constexpr bool separates(
const OtherOrientedSegment& other)
const;
980 template<LineConcept OtherLine>
981 [[nodiscard]]
constexpr bool separates(
const OtherLine& other)
const;
984 template<OrientedLineConcept OtherOrientedLine>
985 [[nodiscard]]
constexpr bool separates(
const OtherOrientedLine& other)
const;
988 template<RayConcept OtherRay>
989 [[nodiscard]]
constexpr bool separates(
const OtherRay& other)
const;
992 template<HalfplaneConcept OtherHalfplane>
993 [[nodiscard]]
constexpr bool separates(
const OtherHalfplane& other)
const;
996 template<RectangleConcept OtherRectangle>
997 [[nodiscard]]
constexpr bool separates(
const OtherRectangle& other)
const;
1000 template<TriangleConcept OtherTriangle>
1001 [[nodiscard]]
constexpr bool separates(
const OtherTriangle& other)
const;
1004 template<ConvexConcept OtherConvex>
1005 [[nodiscard]]
constexpr bool separates(
const OtherConvex& other)
const;
1008 template<DiskConcept OtherDisk>
1009 [[nodiscard]]
constexpr bool separates(
const OtherDisk& other)
const;
1012 template<PolygonConcept OtherPolygon>
1013 [[nodiscard]]
constexpr bool separates(
const OtherPolygon& other)
const;
1016 template<MonotoneChainConcept OtherChain>
1017 [[nodiscard]]
constexpr bool contains(
const OtherChain& other)
const;
1020 template<MonotoneChainConcept OtherChain>
1024 template<MonotoneChainConcept OtherChain>
1028 template<MonotoneChainConcept OtherChain>
1029 [[nodiscard]]
constexpr bool separates(
const OtherChain& other)
const;
1032 template<PolylineConcept OtherPolyline>
1033 [[nodiscard]]
constexpr bool contains(
const OtherPolyline& other)
const;
1036 template<PolylineConcept OtherPolyline>
1040 template<PolylineConcept OtherPolyline>
1044 template<PolylineConcept OtherPolyline>
1045 [[nodiscard]]
constexpr bool separates(
const OtherPolyline& other)
const;
1048 template<HalfplaneIntersectionConcept OtherRegion>
1049 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1052 template<HalfplaneIntersectionConcept OtherRegion>
1056 template<HalfplaneIntersectionConcept OtherRegion>
1060 template<HalfplaneIntersectionConcept OtherRegion>
1061 [[nodiscard]]
constexpr bool separates(
const OtherRegion& other)
const;
1070 template<PolygonWithHolesConcept OtherRegion>
1071 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1079 template<PolygonWithHolesConcept OtherRegion>
1083 template<PolygonWithHolesConcept OtherRegion>
1093 template<PolygonWithHolesConcept OtherRegion>
1094 [[nodiscard]]
bool separates(
const OtherRegion& other)
const;
1105 template<PolygonSetConcept OtherSet>
1106 [[nodiscard]]
constexpr bool contains(
const OtherSet& other)
const {
1107 for (
const auto& component : other) {
1116 template<PolygonSetConcept OtherSet>
1118 for (
const auto& component : other) {
1127 template<PolygonSetConcept OtherSet>
1129 for (
const auto& component : other) {
1145 template<PolygonSetConcept OtherSet>
1153 template<DiskConcept OtherDisk>
1157 template<ConvexConcept OtherConvex>
1161 template<PolygonConcept OtherPolygon>
1165 template<DiskConcept OtherDisk>
1169 template<ConvexConcept OtherConvex>
1173 template<PolygonConcept OtherPolygon>
1178 template<SegmentConcept OtherSegment>
1179 [[nodiscard]]
constexpr bool crosses(
const OtherSegment& other)
const;
1182 template<Po
intConcept OtherPo
int>
1183 [[nodiscard]]
constexpr bool crosses(
const OtherPoint& other)
const;
1186 template<OrientedSegmentConcept OtherOrientedSegment>
1187 [[nodiscard]]
constexpr bool crosses(
const OtherOrientedSegment& other)
const;
1190 template<LineConcept OtherLine>
1191 [[nodiscard]]
constexpr bool crosses(
const OtherLine& other)
const;
1194 template<OrientedLineConcept OtherOrientedLine>
1195 [[nodiscard]]
constexpr bool crosses(
const OtherOrientedLine& other)
const;
1198 template<RayConcept OtherRay>
1199 [[nodiscard]]
constexpr bool crosses(
const OtherRay& other)
const;
1202 template<HalfplaneConcept OtherHalfplane>
1203 [[nodiscard]]
constexpr bool crosses(
const OtherHalfplane& other)
const;
1206 template<RectangleConcept OtherRectangle>
1207 [[nodiscard]]
constexpr bool crosses(
const OtherRectangle& other)
const;
1210 template<TriangleConcept OtherTriangle>
1211 [[nodiscard]]
constexpr bool crosses(
const OtherTriangle& other)
const;
1214 template<
typename OtherShape>
1216 [[nodiscard]]
constexpr bool crosses(
const OtherShape& other)
const {
1217 return other.crosses(*
this);
1221 template <
class EmptyPo
int>
1237 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
1238 [[nodiscard]]
constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
1242 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1247 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1252 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1257 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1262 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1267 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1268 [[nodiscard]]
constexpr auto intersection(
const OtherHalfplane& other)
const;
1271 template <
class ResultNumber = NumberType, HalfplaneIntersectionConcept OtherRegion>
1272 [[nodiscard]]
constexpr auto intersection(
const OtherRegion& other)
const {
1277 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1278 [[nodiscard]]
constexpr auto intersection(
const OtherRectangle& other)
const;
1281 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1282 [[nodiscard]]
constexpr auto intersection(
const OtherTriangle& other)
const;
1285 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1288 && (detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1289 &&
requires(
const OtherShape& o,
const Triangle& self) {
1297 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1299 && (detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1300 &&
requires(
const OtherShape& o,
const Triangle& self) {
1308 template <
class ResultNumber = NumberType,
class EmptyPo
int>
1327 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1331 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1335 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1339 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1343 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1347 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1351 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1355 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1359 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1368 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1369 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1370 &&
requires(
const OtherShape& o,
const Triangle& self) {
1384 template <
class ResultNumber =
double,
class DiskPo
intType,
class DiskLabel>
1401 template <
class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
1402 requires detail::ClosestPairConcept<Triangle<PointType_, TLabel>, OtherShape>
1421 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
1422 requires detail::ClosestPointsPairConcept<Triangle<PointType_, TLabel>, OtherShape>
1426 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1427 [[nodiscard]]
constexpr auto distanceL1(
const OtherPoint& point)
const;
1430 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1431 [[nodiscard]]
constexpr auto distanceL1(
const OtherSegment& other)
const;
1434 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1435 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedSegment& other)
const;
1438 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1439 [[nodiscard]]
constexpr auto distanceL1(
const OtherLine& other)
const;
1442 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1443 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedLine& other)
const;
1446 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1447 [[nodiscard]]
constexpr auto distanceL1(
const OtherRay& other)
const;
1450 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1451 [[nodiscard]]
constexpr auto distanceL1(
const OtherHalfplane& other)
const;
1454 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1455 [[nodiscard]]
constexpr auto distanceL1(
const OtherRectangle& other)
const;
1458 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1459 [[nodiscard]]
constexpr auto distanceL1(
const OtherTriangle& other)
const;
1467 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1468 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1469 &&
requires(
const OtherShape& o,
const Triangle& self) {
1472 [[nodiscard]]
constexpr auto distanceL1(
const OtherShape& other)
const {
1491 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1497 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1514 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1533 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1550 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1563 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
1569 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1573 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1574 [[nodiscard]]
constexpr auto distanceLInf(
const OtherSegment& other)
const;
1577 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1578 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedSegment& other)
const;
1581 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1585 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1586 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedLine& other)
const;
1589 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1593 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1594 [[nodiscard]]
constexpr auto distanceLInf(
const OtherHalfplane& other)
const;
1597 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1598 [[nodiscard]]
constexpr auto distanceLInf(
const OtherRectangle& other)
const;
1601 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1602 [[nodiscard]]
constexpr auto distanceLInf(
const OtherTriangle& other)
const;
1610 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1611 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1612 &&
requires(
const OtherShape& o,
const Triangle& self) {
1627 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
1633 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
1637 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1641 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1645 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1649 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1658 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1659 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1660 &&
requires(
const OtherShape& o,
const Triangle& self) {
1675 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1681 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
1685 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1689 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1693 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1697 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1706 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1707 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1708 &&
requires(
const OtherShape& o,
const Triangle& self) {
1723 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
1737 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
1741 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1745 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1749 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1753 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1762 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1763 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1764 &&
requires(
const OtherShape& o,
const Triangle& self) {
1784 template <
class OtherShape>
1811 template <
class OtherShape>
1837 template <
class OtherShape>
1852 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1854 && (detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1855 &&
requires(
const OtherShape& o,
const Triangle& self) {
1877 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1882 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1893 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1894 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1895 &&
requires(
const OtherShape& o,
const Triangle& self) {
1917 template <
class ResultNumber = division_result_t<NumberType>, PolygonalRegionConcept OtherRegion>
1930 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
1940 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1956 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1961 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1972 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
1973 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
1974 &&
requires(
const OtherShape& o,
const Triangle& self) {
1982 template<Po
intConcept OtherPo
int>
1986 template<Po
intConcept OtherPo
int>
1990 template <
class Scalar>
1995 template <
class Scalar>
1999 template <
bool Oriented>
2011 assert(triangle !=
nullptr);
2012 return triangle->template boundaryAt<Oriented>(index);
2032 : triangle(triangle_arg), index(index_arg) {}
2034 const Triangle* triangle =
nullptr;
2035 std::size_t
index = 0;
2039 static constexpr std::size_t edgeCount = 3;
2048 template <
class ResultNumber,
class OtherShape>
2049 constexpr ResultNumber edgeMinSquaredDistance(
const OtherShape& other)
const;
2058 template <
class ResultNumber,
class OtherShape>
2059 constexpr ResultNumber vertexMinSquaredDistance(
const OtherShape& other)
const;
2062 template <
class ResultNumber,
class OtherShape>
2063 constexpr ResultNumber edgeMinDistanceL1(
const OtherShape& other)
const;
2066 template <
class ResultNumber,
class OtherShape>
2067 constexpr ResultNumber vertexMinDistanceL1(
const OtherShape& other)
const;
2070 template <
class ResultNumber,
class OtherShape>
2071 constexpr ResultNumber edgeMinDistanceLInf(
const OtherShape& other)
const;
2074 template <
class ResultNumber,
class OtherShape>
2075 constexpr ResultNumber vertexMinDistanceLInf(
const OtherShape& other)
const;
2101 constexpr void normalize() {
2102 points_ = canonicalizeVertices(points_[0], points_[1], points_[2]);
2105 template <
bool Oriented>
2107 assert(
index < edgeCount);
2119 std::array<PointType, 3> points_{};
2120 [[no_unique_address]]
mutable LabelType label_{};
2124template <
class Po
intType,
class LabelType,
class TranslationNumber,
class TranslationLabel>
2128template <
class Po
intType,
class LabelType,
class Scalar>
2133template <
class Scalar,
class Po
intType,
class LabelType>
2138template <
class Po
intType,
class LabelType,
class Scalar>
2143template <
class Po
intType,
class LabelType>
constexpr value_type operator*() const
Definition triangle.hpp:2010
constexpr BoundaryIterator operator++(int)
Definition triangle.hpp:2020
std::forward_iterator_tag iterator_concept
Definition triangle.hpp:2003
constexpr bool operator==(const BoundaryIterator &other) const =default
constexpr BoundaryIterator & operator++()
Definition triangle.hpp:2015
constexpr BoundaryIterator()=default
value_type reference
Definition triangle.hpp:2006
friend struct Triangle
Definition triangle.hpp:2029
std::ptrdiff_t difference_type
Definition triangle.hpp:2005
std::forward_iterator_tag iterator_category
Definition triangle.hpp:2002
BoundaryType< Oriented > value_type
Definition triangle.hpp:2004
Bounded polygonal primitives, convex or not.
Definition forward.hpp:373
Definition forward.hpp:319
Shape pairs whose Minkowski sum Pangolin can represent.
Definition forward.hpp:476
Definition forward.hpp:306
Definition arrangement.hpp:67
HalfplaneIntersection() -> HalfplaneIntersection< Point<>, NoLabel >
Definition halfplaneintersection.hpp:2308
constexpr auto operator-(const Point< LeftNumber, LeftLabel > &left, const Point< RightNumber, RightLabel > &right)
Translates a point by the opposite of another point.
Definition transformations.hpp:130
Shape(const std::variant< T, Ts... > &) -> Shape< detail::shape_point_type_t< T > >
std::ostream & operator<<(std::ostream &stream, const Point< Number, Label > &point)
Streams a point as (x,y) or label:(x,y).
Definition io.hpp:27
constexpr auto orientationDeterminant(const Point< ANumber, ALabel > &a, const Point< BNumber, BLabel > &b, const Point< CNumber, CLabel > &c)
Returns the signed orientation determinant of three points.
Definition orientation.hpp:518
Triangle() -> Triangle< Point<>, NoLabel >
Definition triangle.hpp:2029
Public declaration of pgl::Rectangle.
Closed convex polygon stored by its vertices.
Definition convex.hpp:170
Closed Euclidean disk stored by boundary points plus optional disk label.
Definition disk.hpp:66
The empty set of points in the plane.
Definition emptyshape.hpp:33
Intersection of closed half-planes; convex but possibly unbounded or empty.
Definition halfplaneintersection.hpp:244
Sentinel type used when a point carries no extra label.
Definition point.hpp:31
Two-dimensional point with optional label payload.
Definition point.hpp:129
ERational NumberType
Definition point.hpp:131
Set of closed regions with pairwise disjoint interiors.
Definition polygonset.hpp:165
Closed region bounded by one outer simple polygon minus disjoint polygonal holes.
Definition polygonwithholes.hpp:89
Closed simple polygon stored by its vertices.
Definition polygon.hpp:59
Axis-aligned rectangle stored by minimum and maximum corners.
Definition rectangle.hpp:75
Unoriented closed segment between two endpoints plus optional segment label.
Definition segment.hpp:58
Runtime variant wrapper over the supported primitive shapes.
Definition shape.hpp:160
Closed triangle stored by three vertices.
Definition triangle.hpp:53
constexpr PolygonSet< PointType > asPolygonSet() const
Returns the triangle as a one-component set of regions.
Definition triangle.hpp:555
constexpr bool intersects(const OtherSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:169
constexpr auto squaredDistance(const OtherSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:679
constexpr bool contains(const OtherRay &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:267
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).
constexpr auto hausdorffDistanceL1(const OtherRectangle &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1058
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition triangle.hpp:1128
constexpr auto hausdorffDistanceL1(const OtherShape &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition triangle.hpp:1663
constexpr bool verticesContain(const OtherPoint &point) const
Tests whether a point equals one of the vertices.
Definition predicates.hpp:270
constexpr bool intersects(const OtherTriangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:244
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
constexpr Disk< PointType, NoLabel > circumcircle() const
Returns the circumcircle of the triangle.
Definition measures.hpp:376
constexpr bool boundaryContains(const OtherTriangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:183
TLabel LabelType
Definition triangle.hpp:59
constexpr const PointType & operator[](std::size_t index) const
Returns vertex 0, 1, or 2.
Definition triangle.hpp:169
constexpr bool crosses(const OtherRectangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:147
constexpr bool interiorsIntersect(const OtherLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:139
iterator const_iterator
Definition triangle.hpp:68
constexpr bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:602
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:801
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:223
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2117
static constexpr std::size_t size()
Returns the number of vertices (always 3).
Definition triangle.hpp:177
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherOrientedLine &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1187
constexpr bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:559
constexpr bool interiorContains(const OtherRay &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:180
constexpr auto hausdorffDistanceL1(const OtherTriangle &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1066
constexpr Triangle & operator-=(const OtherPoint &translation)
Translates all vertices by the opposite of a point in place.
constexpr auto distanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition triangle.hpp:1615
constexpr auto hausdorffDistanceLInf(const Shape< OtherPoint > &other) const
Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own haus...
Definition triangle.hpp:1724
constexpr auto operator<=>(const Triangle &other) const
Orders triangles lexicographically by their vertices, ignoring the label.
Definition triangle.hpp:281
constexpr bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4000
constexpr bool isUndefined() const
Returns whether the triangle is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:264
constexpr auto squaredHausdorffDistance(const OtherOrientedSegment &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:765
constexpr bool separates(const OtherHalfplane &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:576
constexpr auto distanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:645
constexpr bool boundaryContains(const Shape< PointType > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1143
constexpr bool separates(const Shape< PointType > &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:693
constexpr auto intersection(const OtherRectangle &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1223
constexpr const PointType & b() const
Definition triangle.hpp:217
constexpr bool crosses(const OtherTriangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:157
constexpr auto distanceL1(const OtherRay &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:672
constexpr bool contains(const OtherLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:255
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherOrientedSegment &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1201
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherLine &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1180
auto regularizedUnion(const OtherShape &other) const
Returns the regularized union of the two shapes (A ∪ B).
Definition triangle.hpp:1898
constexpr bool isPoint() const
Returns whether the triangle collapses to a single point.
Definition predicates.hpp:236
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1749
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1523
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition triangle.hpp:801
constexpr auto intersection(const OtherShape &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition triangle.hpp:1292
constexpr auto squaredHausdorffDistance(const OtherPoint &point) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:751
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:162
constexpr bool boundaryContains(const OtherPolyline &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1316
constexpr bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:535
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition triangle.hpp:796
constexpr Triangle()=default
Creates the degenerate triangle (0,0),(0,0),(0,0).
constexpr auto squaredDistance(const OtherOrientedSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:688
constexpr std::array< PointType, 3 > vertices() const
Returns the vertices in canonical order.
Definition bounding.hpp:235
constexpr auto cend() const
Returns an iterator past the last vertex.
Definition triangle.hpp:262
constexpr bool interiorsIntersect(const Shape< PointType > &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:279
constexpr auto distanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:627
constexpr auto begin() const
Returns an iterator to the first vertex.
Definition triangle.hpp:235
constexpr bool isIsosceles() const
Tests whether two sides have the same length.
Definition measures.hpp:459
constexpr auto hausdorffDistanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1042
constexpr bool separates(const OtherPoint &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:541
constexpr auto distanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:636
constexpr bool crosses(const OtherLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:123
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:279
BoundaryIterator< false > EdgeIterator
Definition triangle.hpp:76
constexpr auto distanceL1(const OtherOrientedLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:663
constexpr const PointType & a() const
Definition triangle.hpp:208
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherHalfplane &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr bool isRectangle() const
Tests whether the triangle has a right angle.
Definition measures.hpp:420
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition triangle.hpp:911
constexpr bool interiorsIntersect(const OtherRay &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:202
constexpr Segment< PointType > diameter() const
Returns a segment defining the diameter.
Definition measures.hpp:381
constexpr auto distanceLInf(const OtherLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:642
constexpr bool interiorContains(const OtherPoint &point) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:150
constexpr Triangle(PointType first, PointType second, PointType third)
Creates a triangle from three vertices.
Definition triangle.hpp:96
constexpr auto squaredHausdorffDistance(const OtherTriangle &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:781
constexpr auto distanceLInf(const Shape< OtherPoint > &other) const
Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own dist...
Definition triangle.hpp:1628
auto regularizedIntersection(const Shape< OtherPoint > &other) const
Re-dispatches a regularized intersection through a runtime shape.
Definition triangle.hpp:1498
constexpr bool intersects(const OtherLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:140
constexpr bool pointInsideInteriorContainedIn(const OtherShape &shape) const
Tests whether some point in this shape's relative interior lies in the strict interior of shape.
Definition measures.hpp:409
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:249
constexpr Triangle & operator+=(const OtherPoint &translation)
Translates all vertices by a point in place.
constexpr bool boundaryContains(const OtherConvex &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:195
constexpr Triangle scaledDownX(const OtherNumber scalar) const
Returns the triangle with its x-coordinates divided by a divisor.
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints() const
Returns the integer points the triangle contains.
Definition lattice.hpp:583
constexpr auto intersection(const OtherHalfplane &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1217
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherRectangle &other) const
Returns the regularized union of the two shapes (A ∪ B).
constexpr bool interiorsIntersect(const OtherPoint &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:132
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition triangle.hpp:1222
auto minkowskiSum(const OtherShape &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
Definition triangle.hpp:1858
constexpr bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4652
constexpr bool intersects(const OtherRectangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:220
constexpr bool crosses(const OtherOrientedLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:129
constexpr auto cbegin() const
Returns an iterator to the first vertex.
Definition triangle.hpp:244
constexpr bool contains(const OtherOrientedLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:261
constexpr void scaleUpX(const OtherNumber scalar)
Multiplies the triangle's x-coordinates by a factor in place.
Definition transformations.hpp:1341
constexpr bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:547
constexpr bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:661
constexpr A & label() const
Definition triangle.hpp:295
constexpr bool boundaryContains(const OtherOrientedLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:148
constexpr bool boundaryContains(const OtherSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:130
constexpr Triangle scaledUpX(const OtherNumber scalar) const
Returns the triangle with its x-coordinates multiplied by a factor.
constexpr auto squaredHausdorffDistance(const OtherSegment &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:757
constexpr auto squaredDistance(const OtherRay &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:715
constexpr auto distanceL1(const Shape< OtherPoint > &other) const
Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own dist...
Definition triangle.hpp:1564
constexpr bool boundaryContains(const OtherOrientedSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:136
constexpr Triangle(const Triangle< OtherPointType, OtherLabelType > &other)
Converts a triangle with compatible vertex type.
Definition triangle.hpp:140
constexpr auto squaredDistance(const OtherPoint &point) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:670
constexpr OrientedEdgeIterator orientedEdgesBegin() const
Returns an iterator to the first oriented edge.
Definition triangle.hpp:459
constexpr HalfplaneIntersection< PointType > asHalfplaneIntersection() const
Returns the triangle as a half-plane intersection.
Definition triangle.hpp:512
constexpr auto distanceLInf(const OtherOrientedLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:651
constexpr auto distanceLInf(const OtherHalfplane &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:669
constexpr bool isObtuse() const
Tests whether the triangle has an obtuse angle.
Definition measures.hpp:442
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1322
constexpr bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:595
constexpr bool boundaryContains(const OtherLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:142
constexpr bool boundaryContains(const OtherPoint &point) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:123
constexpr bool intersects(const OtherRay &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:191
constexpr ResultNumber area() const
Returns the non-negative area of the triangle.
Definition measures.hpp:357
constexpr OrientedEdgeIterator orientedEdgesEnd() const
Returns an iterator past the last oriented edge.
Definition triangle.hpp:468
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:296
constexpr bool crosses(const OtherSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:105
constexpr void scaleUpY(const OtherNumber scalar)
Multiplies the triangle's y-coordinates by a factor in place.
Definition transformations.hpp:1355
detail::floating_result_t< ResultNumber > squaredDistance(const Disk< DiskPointType, DiskLabel > &disk) const
Returns the squared Euclidean distance to a disk.
Definition triangle.hpp:1385
constexpr auto end() const
Returns an iterator past the last vertex.
Definition triangle.hpp:253
constexpr bool interiorsIntersect(const OtherRectangle &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:220
constexpr bool intersects(const OtherOrientedSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:185
constexpr bool isSegment() const
Returns whether the triangle collapses to a non-degenerate segment.
Definition predicates.hpp:249
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:215
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1328
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:302
constexpr bool operator==(const Triangle &other) const
Compares triangles lexicographically by canonical vertices.
Definition triangle.hpp:272
constexpr NumberType twiceArea() const
Returns twice the area of the triangle.
Definition measures.hpp:351
constexpr auto distanceL1(const OtherLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:654
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherIntersection &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr bool crosses(const Shape< PointType > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:162
constexpr bool interiorsIntersect(const OtherSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:185
constexpr bool boundaryContains(const OtherHalfplane &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:160
constexpr auto intersection(const Shape< OtherPoint > &other) const
Returns the intersection of the two shapes (A ∩ B), re-dispatching through the wrapper's own intersec...
Definition triangle.hpp:1492
constexpr bool intersects(const OtherOrientedLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:163
constexpr auto hausdorffDistanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition triangle.hpp:1711
constexpr bool intersects(const OtherPoint &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:134
constexpr auto hausdorffDistanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1036
constexpr bool interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:192
constexpr Triangle scaledDownY(const OtherNumber scalar) const
Returns the triangle with its y-coordinates divided by a divisor.
EPoint PointType
Definition triangle.hpp:55
constexpr auto squaredDistance(const OtherRectangle &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:733
constexpr auto hausdorffDistanceL1(const Shape< OtherPoint > &other) const
Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own haus...
Definition triangle.hpp:1676
auto regularizedUnion(const Shape< OtherPoint > &other) const
Returns the regularized union of the two shapes (A ∪ B), re-dispatching through the wrapper's own reg...
Definition triangle.hpp:1515
constexpr bool intersects(const OtherHalfplane &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:206
constexpr bool crosses(const OtherRay &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:135
constexpr Rectangle< PointType > bbox() const
Returns the axis-aligned bounding box of the vertices.
Definition bounding.hpp:224
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5972
constexpr auto regularizedIntersection(const OtherShape &other) const
Forwards a regularized intersection to the shape that owns it.
Definition triangle.hpp:1303
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:319
constexpr auto hausdorffDistanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1038
constexpr bool interiorContains(const OtherSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:156
auto symmetricDifference(const Shape< OtherPoint > &other) const
Returns the regularized symmetric difference of the two shapes (A △ B), re-dispatching through the wr...
Definition triangle.hpp:1551
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition triangle.hpp:1309
constexpr bool boundaryContains(const OtherRay &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:154
constexpr bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:565
constexpr bool boundaryContains(const OtherPolygon &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1040
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:634
constexpr void rotate90(int k=1)
Rotates the triangle by 90k degrees around the origin in place.
Definition transformations.hpp:1327
constexpr std::optional< BoundaryType< false > > getIfSegment() const
Returns the segment the triangle collapses to, if it does.
Definition predicates.hpp:255
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:243
constexpr auto distanceL1(const OtherHalfplane &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:681
constexpr Triangle(NumberType x1, NumberType y1, NumberType x2, NumberType y2, NumberType x3, NumberType y3, A &&label)
Same as the six-coordinate constructor, and stores a label.
Definition triangle.hpp:128
constexpr bool boundaryContains(const OtherDisk &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1034
constexpr Polygon< PointType > asPolygon() const
Returns the triangle as a simple polygon.
Definition triangle.hpp:533
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherTriangle &other) const
Returns the regularized union of the two shapes (A ∪ B).
std::ptrdiff_t difference_type
Definition triangle.hpp:64
constexpr Triangle scaledUpY(const OtherNumber scalar) const
Returns the triangle with its y-coordinates multiplied by a factor.
constexpr auto distanceL1(const OtherTriangle &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:699
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherRegion &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr Rectangle< Point< ResultNumber > > fbox() const
Returns a floating-point bounding box containing the triangle.
Definition bounding.hpp:230
constexpr auto hausdorffDistanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1050
constexpr Convex< PointType > convexHull() const
Returns the convex hull of the triangle's vertices.
Definition triangle.hpp:499
constexpr Convex< PointType > asConvex() const
Returns the triangle as a convex polygon.
Definition triangle.hpp:490
constexpr bool contains(const Shape< PointType > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:330
constexpr bool isDegenerate() const
Tests whether the three vertices are collinear.
Definition predicates.hpp:223
auto symmetricDifference(const OtherShape &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
Definition triangle.hpp:1977
constexpr auto squaredHausdorffDistance(const OtherRectangle &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:773
constexpr auto squaredDistance(const OtherTriangle &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:742
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:1989
const PointType & const_reference
Definition triangle.hpp:66
constexpr EdgeIterator edgesEnd() const
Returns an iterator past the last unoriented edge.
Definition triangle.hpp:443
constexpr void scaleDownY(const OtherNumber scalar)
Divides the triangle's y-coordinates by a divisor in place.
Definition transformations.hpp:1383
BoundaryIterator< true > OrientedEdgeIterator
Definition triangle.hpp:77
constexpr bool crosses(const OtherHalfplane &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:141
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition triangle.hpp:1106
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition triangle.hpp:1117
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition triangle.hpp:905
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition triangle.hpp:960
constexpr bool interiorsIntersect(const OtherOrientedSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:196
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1714
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2437
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition triangle.hpp:954
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherSegment &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1194
constexpr auto squaredDistance(const OtherShape &other) const
Returns the squared Euclidean distance to the given shape.
Definition triangle.hpp:1373
constexpr std::optional< Point< ResultNumber, typename PointType::LabelType > > intersection(const OtherPoint &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1170
constexpr bool contains(const OtherHalfplane &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:273
constexpr PolygonWithHoles< PointType > asPolygonWithHoles() const
Returns the triangle as a hole-free region.
Definition triangle.hpp:543
constexpr auto squaredDistance(const OtherOrientedLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:706
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition triangle.hpp:1216
constexpr bool interiorsIntersect(const OtherTriangle &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:254
constexpr auto closestPoints(const OtherShape &other) const
Returns the pair of points realizing the distance, nothing when the shapes meet.
Definition closest.hpp:363
constexpr bool interiorContains(const OtherLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:168
constexpr const PointType & get(std::ptrdiff_t index) const
Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the en...
Definition triangle.hpp:185
constexpr bool interiorsIntersect(const OtherHalfplane &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:211
auto difference(const Shape< OtherPoint > &other) const
Returns the regularized set difference of the two shapes (A ∖ B), re-dispatching through the wrapper'...
Definition triangle.hpp:1534
constexpr auto distanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:624
constexpr std::optional< PointType > getIfPoint() const
Returns the point the triangle collapses to, if it does.
Definition predicates.hpp:241
constexpr bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:553
constexpr bool crosses(const OtherOrientedSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:117
constexpr std::ptrdiff_t index(const PointType &point) const
Definition triangle.hpp:194
constexpr Triangle(PointType first, PointType second, PointType third, A &&label)
Creates a triangle from three vertices and stores a label.
Definition triangle.hpp:121
constexpr bool interiorsIntersect(const OtherOrientedLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:162
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
constexpr Point< ResultNumber > pointInside() const
Returns a point inside the triangle.
Definition measures.hpp:401
std::conditional_t< Oriented, OrientedSegment< PointType >, Segment< PointType > > BoundaryType
Definition triangle.hpp:71
const PointType & reference
Definition triangle.hpp:65
constexpr bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:582
constexpr auto squaredDistance(const OtherLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:697
constexpr auto distanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:633
constexpr bool intersects(const Shape< PointType > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:262
constexpr auto distanceL1(const OtherRectangle &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:690
constexpr void scaleDownX(const OtherNumber scalar)
Divides the triangle's x-coordinates by a divisor in place.
Definition transformations.hpp:1369
constexpr auto hausdorffDistanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1024
constexpr auto hausdorffDistanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1030
constexpr auto distanceLInf(const OtherRay &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:660
PointType::NumberType NumberType
Definition triangle.hpp:57
constexpr bool boundaryContains(const OtherChain &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1207
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherRectangle &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:2028
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherRay &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1208
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5717
constexpr Triangle(NumberType x1, NumberType y1, NumberType x2, NumberType y2, NumberType x3, NumberType y3)
Creates a triangle from six coordinates.
Definition triangle.hpp:109
constexpr bool separates(const EmptyShape< EmptyPoint > &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition triangle.hpp:811
constexpr bool boundaryContains(const OtherRectangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:166
constexpr std::array< Segment< PointType >, 3 > edges() const
Returns the three unoriented boundary edges.
Definition bounding.hpp:240
constexpr Triangle rotated90(int k=1) const
Returns the triangle rotated by 90k degrees around the origin.
Definition transformations.hpp:1322
constexpr auto hausdorffDistanceLInf(const OtherTriangle &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1054
constexpr const PointType & c() const
Definition triangle.hpp:226
constexpr auto distanceLInf(const OtherRectangle &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:678
constexpr bool interiorContains(const OtherHalfplane &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:186
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2815
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:209
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherTriangle &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition triangle.hpp:806
constexpr auto distanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:615
constexpr auto intersection(const OtherRegion &other) const
Adds this triangle's three constraints to a half-plane intersection without deriving vertices.
Definition triangle.hpp:1272
constexpr auto closestSegments(const OtherShape &other) const
Returns the pair of elements realizing the distance, nothing when the shapes meet.
Definition closest.hpp:356
constexpr auto distanceL1(const OtherShape &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition triangle.hpp:1472
std::size_t size_type
Definition triangle.hpp:63
typename std::array< PointType, 3 >::const_iterator iterator
Definition triangle.hpp:67
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1782
constexpr auto intersection(const OtherTriangle &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1233
constexpr bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3195
constexpr std::array< OrientedSegment< PointType >, 3 > orientedEdges() const
Returns the three oriented boundary edges.
Definition bounding.hpp:249
constexpr bool interiorContains(const OtherOrientedLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:174
constexpr auto squaredHausdorffDistance(const OtherShape &other) const
Returns the squared Hausdorff distance to the given shape.
Definition triangle.hpp:1767
constexpr Point< ResultNumber > centroid() const
Returns the arithmetic centroid.
Definition measures.hpp:364
constexpr auto distanceLInf(const OtherTriangle &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:687
PointType value_type
Definition triangle.hpp:62
constexpr bool crosses(const OtherPoint &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:111
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2075
constexpr auto hausdorffDistanceLInf(const OtherRectangle &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1046
constexpr EdgeIterator edgesBegin() const
Returns an iterator to the first unoriented edge.
Definition triangle.hpp:434
constexpr auto squaredDistance(const OtherHalfplane &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:724