21namespace pgl::detail {
47template <
class RandomIt,
class Key = std::
identity>
48constexpr RandomIt cyclicMax(RandomIt first, RandomIt last, Key key = {}) {
49 using diff_t =
typename std::iterator_traits<RandomIt>::difference_type;
50 const diff_t n = last - first;
59 const diff_t mid = lo + (hi - lo) / 2;
60 const auto k_lo = key(first[lo]);
61 const auto k_hi = key(first[hi]);
62 const auto k_mid = key(first[mid]);
63 const auto k_next = key(first[mid + 1]);
68 if (k_next > k_lo || k_hi > k_lo)
75 if (k_mid > k_hi || k_lo > k_hi)
103template <
class RandomIt,
class Key = std::
identity>
104constexpr RandomIt cyclicMaxOrPositive(RandomIt first, RandomIt last, Key key = {}) {
105 using diff_t =
typename std::iterator_traits<RandomIt>::difference_type;
106 const diff_t n = last - first;
115 const diff_t mid = lo + (hi - lo) / 2;
116 const auto k_lo = key(first[lo]);
117 if (k_lo > 0)
return first + lo;
118 const auto k_hi = key(first[hi]);
119 if (k_hi > 0)
return first + hi;
120 const auto k_mid = key(first[mid]);
121 if (k_mid > 0)
return first + mid;
122 const auto k_next = key(first[mid + 1]);
123 if (k_next > 0)
return first + mid + 1;
125 if (k_mid < k_next) {
128 if (k_next > k_lo || k_hi > k_lo)
135 if (k_mid > k_hi || k_lo > k_hi)
151template <
class Po
intType = Po
int<>,
class Label>
156template <std::ranges::input_range Range>
157requires detail::is_point_v<std::ranges::range_value_t<Range>>
160template <
class Number>
161requires (!detail::is_point_v<Number>)
164template <
class Number>
165requires (!detail::is_point_v<Number>)
169template <
class Po
intType_,
class TLabel>
174 static_assert(detail::is_point_v<PointType>,
"Convex requires pgl::Point vertices");
176 template <
bool Oriented>
179 template <
bool Oriented>
180 class BoundaryIterator;
197 template<std::ranges::input_range Range = std::initializer_list<Po
intType>>
198 requires std::ranges::common_range<Range> &&
199 std::convertible_to<std::ranges::range_value_t<Range>,
PointType>
200 constexpr explicit Convex(Range&& points,
bool trusted =
false) {
202 points_.reserve(points.size());
203 for (
const auto &p : points) {
204 points_.push_back(p);
212 if constexpr (std::is_same_v<std::remove_cvref_t<
decltype(hull)>, std::vector<PointType>>) {
213 points_ = std::move(hull);
215 points_.reserve(hull.size());
216 for (
const auto &p : hull) {
232 constexpr explicit Convex(std::initializer_list<NumberType> coords,
bool trusted =
false) {
233 assert(coords.size() % 2 == 0);
234 std::vector<PointType> points;
235 points.reserve(coords.size() / 2);
236 for (
auto it = coords.begin(); it != coords.end(); ) {
239 points.emplace_back(
x,
y);
242 points_ = std::move(points);
255 template<Po
intConcept OtherPo
intType,
class OtherLabelType>
256 requires(std::constructible_from<PointType, const OtherPointType&>)
258 : points_(other.
begin(), other.
end()), label_(detail::copyLabel<LabelType>(other)) {}
268 template <
class A = LabelType>
269 requires(detail::has_label_v<A>)
281 return points_[
index] + translation_;
290 const std::ptrdiff_t n =
static_cast<std::ptrdiff_t
>(
size());
291 return (*
this)[
static_cast<std::size_t
>(((
index % n) + n) % n)];
299 return Iterator(points_.begin(), translation_);
307 return Iterator(points_.cbegin(), translation_);
314 constexpr auto end()
const {
315 return Iterator(points_.end(), translation_);
323 return Iterator(points_.cend(), translation_);
332 if (
auto cmp = points_.size() <=> other.points_.size(); cmp != 0) {
335 for (std::size_t i = 0; i < points_.size(); ++i) {
336 if (
auto cmp = points_[i] + translation_ <=> other.points_[i] + other.translation_; cmp != 0) {
340 return std::strong_ordering::equal;
349 if (points_.size() != other.points_.size()) {
352 for (std::size_t i = 0; i < points_.size(); ++i) {
353 if (points_[i] + translation_ != other.points_[i] + other.translation_) {
361 template<AnyShapeConcept OtherShape>
362 [[nodiscard]]
constexpr bool samePointSet(
const OtherShape& other)
const;
375 template <
class ResultNumber = division_result_t<NumberType>>
390 [[nodiscard]]
constexpr bool empty()
const {
423 [[nodiscard]]
constexpr std::optional<PointType>
getIfPoint()
const;
445 [[nodiscard]]
constexpr std::optional<BoundaryType<false>>
getIfSegment()
const;
491 template <
class ResultNumber = gr
id_number_t<
typename Po
intType_::NumberType>>
492 requires(detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
501 template <std::
floating_po
int ResultNumber =
double>
508 constexpr const std::vector<PointType>
vertices()
const {
510 for (
auto&
vertex : ret) {
529 constexpr std::vector<Segment<PointType>>
edges()
const {
530 std::vector<Segment<PointType>> result;
531 auto translatedVertices =
vertices();
532 for (std::size_t i = 0; i < translatedVertices.size(); ++i) {
533 const auto& p1 = translatedVertices[i];
534 const auto& p2 = translatedVertices[(i + 1) % translatedVertices.size()];
535 result.emplace_back(p1, p2);
545 std::vector<OrientedSegment<PointType>> result;
546 auto translatedVertices =
vertices();
547 for (std::size_t i = 0; i < translatedVertices.size(); ++i) {
548 const auto& p1 = translatedVertices[i];
549 const auto& p2 = translatedVertices[(i + 1) % translatedVertices.size()];
550 result.emplace_back(p1, p2);
564 return std::ranges::subrange(
begin(),
end());
698 const std::size_t maximum =
maxIndex();
699 std::vector<PointType> chain;
700 chain.reserve(maximum + 1);
701 for (std::size_t i = 0; i <= maximum; ++i) {
702 chain.push_back((*
this)[i]);
726 const std::size_t n =
size();
727 const std::size_t maximum =
maxIndex();
728 std::vector<PointType> chain;
729 chain.reserve(n - maximum + 1);
730 chain.push_back((*
this)[0]);
731 for (std::size_t i = n; i > maximum; --i) {
732 chain.push_back((*
this)[i - 1]);
746 template <Po
intConcept OtherPo
int>
747 constexpr void insert(
const OtherPoint& point);
761 template <
class TShape>
762 requires(!detail::is_point_v<TShape> &&
requires(
const TShape& shape) { shape.vertices(); })
763 constexpr void insert(
const TShape& shape);
776 template <std::ranges::input_range Range = std::initializer_list<Po
intType>>
777 requires std::ranges::common_range<Range> &&
778 std::convertible_to<std::ranges::range_value_t<Range>,
PointType> &&
779 (!
requires(
const std::remove_cvref_t<Range>& shape) { shape.vertices(); })
783 std::vector<PointType> points =
vertices();
784 const std::size_t oldSize = points.size();
785 for (
const auto& point : range) {
786 points.push_back(
static_cast<PointType>(point));
788 if (points.size() == oldSize) {
800 template <
class ResultNumber = division_result_t<NumberType>>
809 template <
class ResultNumber = division_result_t<NumberType>>
822 template <
class ResultNumber = division_result_t<NumberType>>
833 template <
class OtherShape>
841 return points_.size();
862 template<Po
intConcept OtherPo
int>
891 constexpr std::vector<std::pair<std::size_t, std::size_t>>
1003 template <
class ResultNumber = division_result_t<NumberType>>
1022 template <
class ApproximateNumber =
double>
1042 template <
class UniformRandomBitGenerator>
1073 template<Po
intConcept OtherPo
int>
1090 template<SegmentConcept OtherSegment>
1098 template<OrientedSegmentConcept OtherOrientedSegment>
1106 template<LineConcept OtherLine>
1114 template<OrientedLineConcept OtherOrientedLine>
1122 template<RayConcept OtherRay>
1130 template<HalfplaneConcept OtherHalfplane>
1138 template<RectangleConcept OtherRectangle>
1146 template<TriangleConcept OtherTriangle>
1155 template<ConvexConcept OtherConvex>
1159 template<PolygonConcept OtherPolygon>
1168 template<DiskConcept OtherDisk>
1174 template<Po
intConcept OtherPo
int>
1192 template<
class OtherNumberType>
1193 constexpr std::optional<std::array<Segment<PointType>, 2>>
edgesAtX(OtherNumberType
x)
const;
1204 template<Po
intConcept OtherPo
int>
1205 constexpr bool contains(
const OtherPoint& point)
const;
1216 template<SegmentConcept OtherSegment>
1217 constexpr bool contains(
const OtherSegment& other)
const;
1228 template<OrientedSegmentConcept OtherOrientedSegment>
1229 constexpr bool contains(
const OtherOrientedSegment& other)
const;
1237 template<LineConcept OtherLine>
1246 template<OrientedLineConcept OtherOrientedLine>
1247 constexpr bool contains(
const OtherOrientedLine&)
const;
1255 template<RayConcept OtherRay>
1264 template<HalfplaneConcept OtherHalfplane>
1276 template<RectangleConcept OtherRectangle>
1277 constexpr bool contains(
const OtherRectangle& other)
const;
1289 template<TriangleConcept OtherTriangle>
1290 constexpr bool contains(
const OtherTriangle& other)
const;
1302 template<ConvexConcept OtherConvex>
1303 constexpr bool contains(
const OtherConvex& other)
const;
1306 template<PolygonConcept OtherPolygon>
1307 constexpr bool contains(
const OtherPolygon& other)
const;
1315 template<DiskConcept OtherDisk>
1321 template<Po
intConcept OtherPo
int>
1329 template <
class EmptyPo
int>
1334 template <
class EmptyPo
int>
1339 template <
class EmptyPo
int>
1344 template <
class EmptyPo
int>
1358 template<Po
intConcept OtherPo
int>
1370 template<SegmentConcept OtherSegment>
1382 template<OrientedSegmentConcept OtherOrientedSegment>
1391 template<LineConcept OtherLine>
1400 template<OrientedLineConcept OtherOrientedLine>
1409 template<RayConcept OtherRay>
1418 template<HalfplaneConcept OtherHalfplane>
1430 template<RectangleConcept OtherRectangle>
1442 template<TriangleConcept OtherTriangle>
1455 template<ConvexConcept OtherConvex>
1459 template<PolygonConcept OtherPolygon>
1467 template<DiskConcept OtherDisk>
1473 template<Po
intConcept OtherPo
int>
1485 template<SegmentConcept OtherSegment>
1497 template<OrientedSegmentConcept OtherOrientedSegment>
1498 constexpr bool intersects(
const OtherOrientedSegment& other)
const;
1509 template<LineConcept OtherLine>
1521 template<OrientedLineConcept OtherOrientedLine>
1533 template<RayConcept OtherRay>
1545 template<RectangleConcept OtherRectangle>
1557 template<TriangleConcept OtherTriangle>
1569 template<Po
intConcept OtherPo
int>
1581 template<HalfplaneConcept OtherHalfplane>
1594 template<ConvexConcept OtherConvex>
1602 template<DiskConcept OtherDisk>
1608 template<Po
intConcept OtherPo
int>
1612 template<
typename OtherShape>
1614 [[nodiscard]]
constexpr bool intersects(
const OtherShape& other)
const {
1615 return other.intersects(*
this);
1619 template <
class EmptyPo
int>
1629 template<Po
intConcept OtherPo
int>
1637 template<LineConcept OtherLine>
1645 template<OrientedLineConcept OtherOrientedLine>
1657 template<SegmentConcept OtherSegment>
1665 template<OrientedSegmentConcept OtherOrientedSegment>
1677 template<RayConcept OtherRay>
1685 template<HalfplaneConcept OtherHalfplane>
1694 template<RectangleConcept OtherRectangle>
1703 template<TriangleConcept OtherTriangle>
1712 template<ConvexConcept OtherConvex>
1720 template<DiskConcept OtherDisk>
1726 template<Po
intConcept OtherPo
int>
1730 template<
typename OtherShape>
1733 return other.interiorsIntersect(*
this);
1737 template <
class EmptyPo
int>
1747 template<Po
intConcept OtherPo
int>
1761 template<SegmentConcept OtherSegment>
1769 template<OrientedSegmentConcept OtherOrientedSegment>
1770 constexpr bool separates(
const OtherOrientedSegment& other)
const;
1777 template<LineConcept OtherLine>
1785 template<OrientedLineConcept OtherOrientedLine>
1786 constexpr bool separates(
const OtherOrientedLine& other)
const;
1796 template<RayConcept OtherRay>
1804 template<HalfplaneConcept OtherHalfplane>
1812 template<RectangleConcept OtherRectangle>
1813 constexpr bool separates(
const OtherRectangle& other)
const;
1820 template<TriangleConcept OtherTriangle>
1828 template<ConvexConcept OtherConvex>
1845 template<PolygonConcept OtherPolygon>
1849 template<MonotoneChainConcept OtherChain>
1850 [[nodiscard]]
constexpr bool contains(
const OtherChain& other)
const;
1853 template<MonotoneChainConcept OtherChain>
1857 template<MonotoneChainConcept OtherChain>
1861 template<MonotoneChainConcept OtherChain>
1862 [[nodiscard]]
constexpr bool separates(
const OtherChain& other)
const;
1865 template<PolylineConcept OtherPolyline>
1866 [[nodiscard]]
constexpr bool contains(
const OtherPolyline& other)
const;
1869 template<PolylineConcept OtherPolyline>
1873 template<PolylineConcept OtherPolyline>
1877 template<PolylineConcept OtherPolyline>
1878 [[nodiscard]]
constexpr bool separates(
const OtherPolyline& other)
const;
1881 template<HalfplaneIntersectionConcept OtherRegion>
1882 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1885 template<HalfplaneIntersectionConcept OtherRegion>
1889 template<HalfplaneIntersectionConcept OtherRegion>
1893 template<HalfplaneIntersectionConcept OtherRegion>
1894 [[nodiscard]]
constexpr bool separates(
const OtherRegion& other)
const;
1903 template<PolygonWithHolesConcept OtherRegion>
1904 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1912 template<PolygonWithHolesConcept OtherRegion>
1916 template<PolygonWithHolesConcept OtherRegion>
1926 template<PolygonWithHolesConcept OtherRegion>
1927 [[nodiscard]]
bool separates(
const OtherRegion& other)
const;
1938 template<PolygonSetConcept OtherSet>
1939 [[nodiscard]]
constexpr bool contains(
const OtherSet& other)
const {
1940 for (
const auto& component : other) {
1949 template<PolygonSetConcept OtherSet>
1951 for (
const auto& component : other) {
1960 template<PolygonSetConcept OtherSet>
1962 for (
const auto& component : other) {
1978 template<PolygonSetConcept OtherSet>
1986 template<DiskConcept OtherDisk>
1992 template<Po
intConcept OtherPo
int>
2000 template<Po
intConcept OtherPo
int>
2008 template<SegmentConcept OtherSegment>
2009 constexpr bool crosses(
const OtherSegment& other)
const;
2016 template<OrientedSegmentConcept OtherOrientedSegment>
2017 constexpr bool crosses(
const OtherOrientedSegment& other)
const;
2024 template<LineConcept OtherLine>
2025 constexpr bool crosses(
const OtherLine& other)
const;
2032 template<OrientedLineConcept OtherOrientedLine>
2033 constexpr bool crosses(
const OtherOrientedLine& other)
const;
2040 template<RayConcept OtherRay>
2041 constexpr bool crosses(
const OtherRay& other)
const;
2048 template<HalfplaneConcept OtherHalfplane>
2049 constexpr bool crosses(
const OtherHalfplane&)
const;
2056 template<RectangleConcept OtherRectangle>
2057 constexpr bool crosses(
const OtherRectangle& other)
const;
2064 template<TriangleConcept OtherTriangle>
2065 constexpr bool crosses(
const OtherTriangle& other)
const;
2073 template<ConvexConcept OtherConvex>
2074 constexpr bool crosses(
const OtherConvex& other)
const;
2081 template<DiskConcept OtherDisk>
2082 constexpr bool crosses(
const OtherDisk& other)
const;
2087 template<Po
intConcept OtherPo
int>
2091 template<
typename OtherShape>
2093 [[nodiscard]]
constexpr bool crosses(
const OtherShape& other)
const {
2094 return other.crosses(*
this);
2098 template <
class EmptyPo
int>
2128 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2160 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2179 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2209 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2228 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2247 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2273 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
2292 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
2322 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
2343 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
2362 template <
class ResultNumber =
double, DiskConcept OtherDisk>
2363 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherDisk& other)
const;
2372 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
2373 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
2374 &&
requires(
const OtherShape& o,
const Convex& self) {
2393 template <
class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
2394 requires detail::ClosestPairConcept<Convex<PointType_, TLabel>, OtherShape>
2413 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
2414 requires detail::ClosestPointsPairConcept<Convex<PointType_, TLabel>, OtherShape>
2425 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2426 [[nodiscard]]
constexpr auto distanceL1(
const OtherPoint& point)
const;
2429 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2430 [[nodiscard]]
constexpr auto distanceL1(
const OtherSegment& other)
const;
2433 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2434 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedSegment& other)
const;
2437 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2438 [[nodiscard]]
constexpr auto distanceL1(
const OtherConvex& other)
const;
2441 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2442 [[nodiscard]]
constexpr auto distanceL1(
const OtherTriangle& other)
const;
2445 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2446 [[nodiscard]]
constexpr auto distanceL1(
const OtherRectangle& other)
const;
2449 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
2450 [[nodiscard]]
constexpr auto distanceL1(
const OtherLine& other)
const;
2453 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
2454 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedLine& other)
const;
2457 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
2458 [[nodiscard]]
constexpr auto distanceL1(
const OtherRay& other)
const;
2461 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
2462 [[nodiscard]]
constexpr auto distanceL1(
const OtherHalfplane& other)
const;
2471 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
2472 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
2473 &&
requires(
const OtherShape& o,
const Convex& self) {
2476 [[nodiscard]]
constexpr auto distanceL1(
const OtherShape& other)
const {
2495 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2501 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2518 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2537 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2554 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2566 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
2579 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2583 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2584 [[nodiscard]]
constexpr auto distanceLInf(
const OtherSegment& other)
const;
2587 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2588 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedSegment& other)
const;
2591 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2595 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2596 [[nodiscard]]
constexpr auto distanceLInf(
const OtherTriangle& other)
const;
2599 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2600 [[nodiscard]]
constexpr auto distanceLInf(
const OtherRectangle& other)
const;
2603 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
2607 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
2608 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedLine& other)
const;
2611 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
2615 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
2616 [[nodiscard]]
constexpr auto distanceLInf(
const OtherHalfplane& other)
const;
2625 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
2626 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
2627 &&
requires(
const OtherShape& o,
const Convex& self) {
2635 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
2641 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
2645 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2649 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2653 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2657 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2661 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2671 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
2672 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
2673 &&
requires(
const OtherShape& o,
const Convex& self) {
2681 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2687 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
2691 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2695 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2699 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2703 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2707 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2717 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
2718 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
2719 &&
requires(
const OtherShape& o,
const Convex& self) {
2727 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2741 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
2745 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2749 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2753 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2757 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2761 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2771 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
2772 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
2773 &&
requires(
const OtherShape& o,
const Convex& self) {
2790 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
2791 [[nodiscard]]
constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
2805 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2820 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2835 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
2850 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
2865 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
2881 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
2886 template <
class ResultNumber = NumberType, HalfplaneIntersectionConcept OtherRegion>
2887 [[nodiscard]]
constexpr auto intersection(
const OtherRegion& other)
const {
2902 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2918 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2933 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2938 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
2941 && (detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
2942 &&
requires(
const OtherShape& o,
const Convex& self) {
2950 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
2952 && (detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
2953 &&
requires(
const OtherShape& o,
const Convex& self) {
2961 template <
class ResultNumber = NumberType,
class EmptyPo
int>
2982 template <
class OtherNumber>
2986 template <
class OtherNumber>
2990 template <
class OtherNumber>
2994 template <
class OtherNumber>
2998 template <
class OtherNumber>
3002 template <
class OtherNumber>
3006 template <
class OtherNumber>
3010 template <
class OtherNumber>
3026 template <
class OtherShape>
3053 template <
class OtherShape>
3079 template <
class OtherShape>
3094 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
3096 && (detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
3097 &&
requires(
const OtherShape& o,
const Convex& self) {
3119 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
3124 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
3129 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
3140 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
3141 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
3142 &&
requires(
const OtherShape& o,
const Convex& self) {
3164 template <
class ResultNumber = division_result_t<NumberType>, PolygonalRegionConcept OtherRegion>
3177 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
3187 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
3203 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
3208 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
3213 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
3224 template <
class ResultNumber = division_result_t<NumberType>,
typename OtherShape>
3225 requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Convex>)
3226 &&
requires(
const OtherShape& o,
const Convex& self) {
3234 template<Po
intConcept OtherPo
int>
3246 template<Po
intConcept OtherPo
int>
3258 template <
class Scalar>
3260 constexpr Convex&
operator*=(
const Scalar& scalar);
3271 template <
class Scalar>
3273 constexpr Convex&
operator/=(
const Scalar& scalar);
3281 template <
bool Oriented>
3293 assert(convex !=
nullptr);
3294 return convex->template boundaryAt<Oriented>(index);
3314 : convex(convex_arg), index(index_arg) {}
3316 const Convex* convex =
nullptr;
3317 std::size_t
index = 0;
3321 std::vector<PointType> points_{};
3322 [[no_unique_address]]
mutable LabelType label_{};
3328 mutable Rectangle<PointType> bbox_{};
3329 mutable std::ptrdiff_t maxIndex_ = -1;
3336 static constexpr std::size_t hashUnset_ = pgl::detail::numeric_limits<std::size_t>::max();
3337 mutable std::size_t hash_ = hashUnset_;
3338 friend struct std::hash<
Convex>;
3344 constexpr void resetCache()
const {
3352 constexpr void rebuildHull(
const std::vector<PointType>& points) {
3358 template <
bool Oriented>
3360 const auto i =
static_cast<std::ptrdiff_t
>(
index);
3367 struct LexLessCrossType {
3368 template <
class A,
class B>
3369 constexpr bool operator()(
const A& a,
const B& b)
const {
3370 using AX = std::remove_cvref_t<
decltype(a.x())>;
3371 using BX = std::remove_cvref_t<
decltype(b.x())>;
3372 using C = std::common_type_t<AX, BX>;
3373 const auto ax =
static_cast<C
>(a.x());
3374 const auto bx =
static_cast<C
>(b.x());
3375 if (ax < bx)
return true;
3376 if (bx < ax)
return false;
3377 return detail::asNumber<C>(a.y()) < detail::asNumber<C>(b.y());
3380 static constexpr LexLessCrossType lexLessCrossType{};
3384 std::vector<PointType>::const_iterator it;
3388 using iterator_category = std::random_access_iterator_tag;
3389 using difference_type = std::ptrdiff_t;
3394 Iterator() =
default;
3395 Iterator(std::vector<PointType>::const_iterator it,
PointType x) : it(it), x(x) {}
3403 Iterator& operator++() {
3409 Iterator operator++(
int) {
3410 Iterator tmp = *
this;
3416 Iterator& operator--() {
3422 Iterator operator--(
int) {
3423 Iterator tmp = *
this;
3429 bool operator==(
const Iterator& other)
const {
3430 return it == other.it;
3434 auto operator<=>(
const Iterator& other)
const {
3435 return it <=> other.it;
3439 Iterator operator+(difference_type n)
const {
3440 return Iterator(it + n, x);
3444 Iterator operator-(difference_type n)
const {
3445 return Iterator(it - n, x);
3449 difference_type operator-(
const Iterator& other)
const {
3450 return it - other.it;
3454 PointType operator[](difference_type n)
const {
3455 return *(it + n) + x;
3460template <
class Po
intType,
class LabelType,
class TranslationNumber,
class TranslationLabel>
3462 return convex + (-translation);
3465template <
class Po
intType,
class LabelType,
class Scalar>
3466 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
3471 if constexpr (detail::has_label_v<LabelType>) {
3472 result.
label() = LabelType{};
3477template <
class Scalar,
class Po
intType,
class LabelType>
3478 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
3480 return convex * scalar;
3483template <
class Po
intType,
class LabelType,
class Scalar>
3484 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
3489 if constexpr (detail::has_label_v<LabelType>) {
3490 result.
label() = LabelType{};
3495template <
class Po
intType,
class LabelType>
friend struct Convex
Definition convex.hpp:3311
std::forward_iterator_tag iterator_category
Definition convex.hpp:3284
constexpr bool operator==(const BoundaryIterator &other) const =default
value_type reference
Definition convex.hpp:3288
constexpr BoundaryIterator()=default
std::forward_iterator_tag iterator_concept
Definition convex.hpp:3285
std::ptrdiff_t difference_type
Definition convex.hpp:3287
constexpr BoundaryIterator operator++(int)
Definition convex.hpp:3302
constexpr value_type operator*() const
Definition convex.hpp:3292
constexpr BoundaryIterator & operator++()
Definition convex.hpp:3297
BoundaryType< Oriented > value_type
Definition convex.hpp:3286
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
Declaration of pgl::Disk.
Definition arrangement.hpp:67
HalfplaneIntersection() -> HalfplaneIntersection< Point<>, NoLabel >
Definition halfplaneintersection.hpp:2308
@ y
Definition intervaltree.hpp:24
@ x
Definition intervaltree.hpp:24
@ vertex
Definition bitmatrix.hpp:37
auto grahamScan(const Container &points_)
Computes the convex hull of a point container using Graham's scan.
Definition convexhull.hpp:177
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
MonotoneChain() -> MonotoneChain< Point<>, NoLabel >
Definition monotonechain.hpp:2439
Shape(const std::variant< T, Ts... > &) -> Shape< detail::shape_point_type_t< T > >
Convex() -> Convex< Point<>, NoLabel >
Definition convex.hpp:3311
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
Closed convex polygon stored by its vertices.
Definition convex.hpp:170
constexpr auto squaredHausdorffDistance(const OtherSegment &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:1116
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1750
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherTriangle &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr bool interiorsIntersect(const OtherConvex &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:932
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherRectangle &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:2001
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5723
constexpr void scaleUpY(const OtherNumber scalar)
Multiplies the convex polygon's y-coordinates by a factor in place.
Definition transformations.hpp:1666
constexpr auto squaredDistance(const OtherLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:999
constexpr bool contains(const OtherHalfplane &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1194
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherConvex &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr const Rectangle< PointType > & bbox() const
Computes the bounding box of the convex polygon.
Definition bounding.hpp:374
constexpr auto hausdorffDistanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1074
constexpr bool intersects(const OtherSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:716
constexpr auto verticesView() const
Returns a lazy view over the vertices, translating each on the fly instead of allocating a vector.
Definition convex.hpp:563
constexpr bool intersects(const Shape< OtherPoint > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:971
constexpr MonotoneChain< PointType > lowerHull() const
Returns the lower hull: the boundary chain running from the lexicographically smallest vertex to the ...
Definition convex.hpp:691
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > >, Convex< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherRectangle &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1581
constexpr bool crosses(const OtherTriangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:603
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition convex.hpp:2099
constexpr void scaleDownX(const OtherNumber scalar)
Divides the convex polygon's x-coordinates by a divisor in place.
Definition transformations.hpp:1685
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:803
constexpr auto twiceArea() const
Computes twice the area of the convex polygon.
Definition measures.hpp:516
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition convex.hpp:2093
constexpr auto squaredDistance(const OtherRectangle &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:993
constexpr bool intersects(const OtherHalfplane &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:838
constexpr auto squaredDistance(const OtherHalfplane &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1098
constexpr Rectangle< Point< ResultNumber > > fbox() const
Computes the floating-point bounding box of the convex polygon.
Definition bounding.hpp:420
constexpr Point< ResultNumber > pointInside() const
Returns a point inside the convex polygon.
Definition measures.hpp:582
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints() const
Returns the integer points the convex polygon contains.
Definition lattice.hpp:649
constexpr bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1666
constexpr Convex< PointType > convexHull() const
Returns the convex hull of the polygon's vertices.
Definition convex.hpp:521
std::conditional_t< Oriented, OrientedSegment< PointType >, Segment< PointType > > BoundaryType
Definition convex.hpp:177
constexpr bool intersects(const OtherDisk &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:887
constexpr Point< ResultNumber > verticesCentroid() const
Computes the centroid of the vertex set.
Definition measures.hpp:566
constexpr auto cend() const
Returns a constant iterator to the end of vertices.
Definition convex.hpp:322
constexpr bool interiorsIntersect(const Shape< OtherPoint > &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:983
constexpr bool empty() const
Returns whether the convex polygon is the empty set of points.
Definition convex.hpp:390
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2459
constexpr auto squaredDistance(const OtherConvex &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:958
constexpr bool crosses(const OtherDisk &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:618
constexpr std::optional< PointType > getIfPoint() const
Returns the point the convex polygon collapses to, if it does.
Definition predicates.hpp:994
constexpr bool boundaryContains(const OtherHalfplane &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:782
constexpr bool interiorsIntersect(const OtherTriangle &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:926
constexpr 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 convex.hpp:289
constexpr bool interiorsIntersect(const OtherHalfplane &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:901
constexpr auto edgesView() const
Returns a lazy view over the edges, materializing each Segment on the fly instead of allocating a vec...
Definition convex.hpp:575
constexpr auto hausdorffDistanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1062
BoundaryIterator< true > OrientedEdgeIterator
Definition convex.hpp:183
constexpr auto hausdorffDistanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1068
auto minkowskiSum(const OtherShape &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
Definition convex.hpp:3100
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition convex.hpp:1614
constexpr auto squaredHausdorffDistance(const OtherOrientedSegment &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:1124
constexpr bool interiorsIntersect(const OtherRay &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:874
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition convex.hpp:1939
constexpr bool boundaryContains(const OtherOrientedSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:758
constexpr bool boundaryContains(const OtherRectangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:788
auto regularizedUnion(const OtherShape &other) const
Returns the regularized union of the two shapes (A ∪ B).
Definition convex.hpp:3145
constexpr HalfplaneIntersection< PointType > asHalfplaneIntersection() const
Returns the convex polygon as a half-plane intersection.
Definition convex.hpp:672
constexpr auto squaredHausdorffDistance(const OtherShape &other) const
Returns the squared Hausdorff distance to the given shape.
Definition convex.hpp:2776
constexpr auto distanceL1(const OtherRay &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:815
constexpr auto intersection(const OtherShape &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition convex.hpp:2945
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1164
constexpr Convex scaledDownX(const OtherNumber scalar) const
Returns the convex polygon with its x-coordinates divided by a divisor.
constexpr auto intersection(const OtherRegion &other) const
Adds this convex polygon's constraints to a half-plane intersection without deriving vertices.
Definition convex.hpp:2887
constexpr auto hausdorffDistanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1080
constexpr EdgeIterator edgesBegin() const
Returns an iterator to the first unoriented edge.
Definition convex.hpp:591
constexpr bool boundaryContains(const OtherConvex &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:817
constexpr auto closestPoints(const OtherShape &other) const
Returns the pair of points realizing the distance, nothing when the shapes meet.
Definition closest.hpp:377
constexpr bool interiorsIntersect(const OtherRectangle &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:916
constexpr MonotoneChain< PointType > upperHull() const
Returns the upper hull: the boundary chain running from the lexicographically smallest vertex to the ...
Definition convex.hpp:718
constexpr auto hausdorffDistanceL1(const OtherConvex &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1112
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition convex.hpp:1950
constexpr void scaleDownY(const OtherNumber scalar)
Divides the convex polygon's y-coordinates by a divisor in place.
Definition transformations.hpp:1704
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition convex.hpp:1732
constexpr auto squaredHausdorffDistance(const OtherPoint &point) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:1110
constexpr bool crosses(const OtherSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:557
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > >, Convex< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherHalfplane &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1511
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition convex.hpp:1738
constexpr auto squaredHausdorffDistance(const OtherConvex &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:1148
detail::floating_result_t< ResultNumber > squaredDistance(const OtherDisk &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1183
constexpr bool boundaryContains(const Shape< OtherPoint > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:841
constexpr bool contains(const Shape< OtherPoint > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1685
constexpr auto distanceLInf(const OtherLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:781
constexpr bool boundaryContains(const OtherTriangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:805
constexpr bool interiorsIntersect(const OtherOrientedSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:868
constexpr bool crosses(const Shape< OtherPoint > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:624
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition convex.hpp:2962
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1274
constexpr auto distanceLInf(const OtherPoint &point) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:703
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:809
constexpr bool separates(const OtherPoint &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1522
constexpr bool interiorContains(const OtherPoint &point) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:792
constexpr auto hausdorffDistanceLInf(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition convex.hpp:2728
constexpr bool isDegenerate() const
Checks if the convex polygon is degenerate (has zero area).
Definition predicates.hpp:982
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1766
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherTriangle &other) const
Returns the regularized union of the two shapes (A ∪ B).
constexpr EdgeIterator edgesEnd() const
Returns an iterator past the last unoriented edge.
Definition convex.hpp:599
constexpr auto distanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:749
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
constexpr auto squaredHausdorffDistance(const OtherTriangle &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:1140
constexpr auto squaredDistance(const OtherPoint &point) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:791
constexpr void scaleUpX(const OtherNumber scalar)
Multiplies the convex polygon's x-coordinates by a factor in place.
Definition transformations.hpp:1647
auto symmetricDifference(const OtherShape &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
Definition convex.hpp:3229
constexpr bool interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:839
constexpr OrientedEdgeIterator orientedEdgesBegin() const
Returns an iterator to the first oriented edge.
Definition convex.hpp:607
constexpr auto hausdorffDistanceL1(const OtherShape &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition convex.hpp:2676
constexpr auto distanceLInf(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition convex.hpp:2636
constexpr bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1537
constexpr bool separates(const Shape< OtherPoint > &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1849
constexpr bool interiorsIntersect(const OtherPoint &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:804
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1233
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2097
constexpr bool interiorsIntersect(const OtherDisk &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:964
constexpr auto distanceLInf(const OtherRay &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:803
constexpr auto distanceL1(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition convex.hpp:2567
constexpr auto distanceLInf(const OtherRectangle &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:775
constexpr PolygonWithHoles< PointType > asPolygonWithHoles() const
Returns the convex polygon as a hole-free region.
Definition convex.hpp:646
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:1272
constexpr bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1543
constexpr void insert(Range &&range)
Enlarges the convex polygon so that it contains every point in a range.
Definition convex.hpp:780
constexpr bool interiorsIntersect(const OtherOrientedLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:836
constexpr auto squaredDistance(const OtherSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:892
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:1244
constexpr auto hausdorffDistanceLInf(const OtherConvex &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1100
constexpr auto distanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:737
constexpr bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:3207
constexpr bool interiorContains(const OtherLine &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:815
constexpr bool boundaryContains(const OtherPolygon &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:999
constexpr bool intersects(const OtherOrientedSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:736
constexpr auto distanceL1(const OtherRectangle &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:787
constexpr bool interiorContains(const OtherRay &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:827
constexpr Convex & operator+=(const OtherPoint &translation)
Translates the convex polygon by the given point in place.
constexpr bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1528
constexpr Convex(std::initializer_list< NumberType > coords, bool trusted=false)
Creates a convex from a flat list of coordinates.
Definition convex.hpp:232
constexpr auto distanceL1(const OtherHalfplane &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:832
constexpr bool crosses(const OtherPoint &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:551
constexpr std::ptrdiff_t index(const PointType &point) const
constexpr auto distanceL1(const OtherLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:793
constexpr bool intersects(const OtherOrientedLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:756
constexpr Convex & operator-=(const OtherPoint &translation)
Translates the convex polygon by the negation of the given point.
constexpr auto distanceLInf(const OtherOrientedLine &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:797
auto difference(const Shape< OtherPoint > &other) const
Returns the regularized set difference of the two shapes (A ∖ B), re-dispatching through the wrapper'...
Definition convex.hpp:2538
constexpr auto squaredDistance(const OtherShape &other) const
Returns the squared Euclidean distance to the given shape.
Definition convex.hpp:2377
constexpr PolygonSet< PointType > asPolygonSet() const
Returns the convex polygon as a one-component set of regions.
Definition convex.hpp:659
PointType::NumberType NumberType
Definition convex.hpp:172
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5978
constexpr bool contains(const OtherRay &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1188
constexpr size_t maxIndex() const
Returns the index of the maximum vertex (rightmost and highest in case of ties).
Definition predicates.hpp:1022
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherRegion &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1793
constexpr bool intersects(const OtherPoint &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:829
constexpr bool boundaryContains(const OtherLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:764
constexpr Convex rotated90(int k=1) const
Returns the convex polygon rotated by 90k degrees around the origin.
Definition transformations.hpp:1618
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 convex.hpp:2496
constexpr auto area() const
Computes the area of the convex polygon.
Definition measures.hpp:531
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition convex.hpp:1340
constexpr bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:2034
constexpr Convex scaledUpX(const OtherNumber scalar) const
Returns the convex polygon with its x-coordinates multiplied by a factor.
constexpr A & label() const
Returns the convex-polygon label.
Definition convex.hpp:270
constexpr auto hausdorffDistanceL1(const OtherOrientedSegment &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1088
constexpr Convex scaledUpY(const OtherNumber scalar) const
Returns the convex polygon with its y-coordinates multiplied by a factor.
constexpr void insert(const OtherPoint &point)
Enlarges the convex polygon so that it contains the given point.
Definition bounding.hpp:426
constexpr bool interiorsIntersect(const OtherLine &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:811
constexpr bool intersects(const OtherConvex &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:858
constexpr auto hausdorffDistanceL1(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition convex.hpp:2682
constexpr bool boundaryContains(const OtherDisk &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:832
constexpr bool operator==(const Convex &other) const
Checks equality of two convex polygons.
Definition convex.hpp:348
auto regularizedIntersection(const Shape< OtherPoint > &other) const
Re-dispatches a regularized intersection through a runtime shape.
Definition convex.hpp:2502
constexpr bool boundaryContains(const OtherSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:721
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition convex.hpp:1620
constexpr bool crosses(const OtherOrientedLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:575
constexpr bool interiorContains(const OtherHalfplane &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:833
constexpr bool verticesContain(const OtherPoint &point) const
Checks if the vertices list contains the given point.
Definition predicates.hpp:1051
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition convex.hpp:1335
constexpr ResultNumber squaredMinimumWidth() const
Returns the squared minimum width of the convex polygon.
Definition measures.hpp:1019
ApproximateNumber minimumWidth() const
Returns the minimum width of the convex polygon.
Definition measures.hpp:1032
constexpr auto closestSegments(const OtherShape &other) const
Returns the pair of elements realizing the distance, nothing when the shapes meet.
Definition closest.hpp:370
constexpr bool isSegment() const
Returns whether the convex polygon collapses to a non-degenerate segment.
Definition predicates.hpp:1002
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:1278
TLabel LabelType
Definition convex.hpp:173
constexpr bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4012
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition convex.hpp:1330
constexpr HalfplaneIntersection< PointType > smallestEnclosingSlab() const
Returns the narrowest slab containing the convex polygon.
Definition measures.hpp:993
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1170
constexpr bool contains(const OtherLine &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1176
constexpr auto squaredDistance(const OtherOrientedSegment &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:951
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:1488
constexpr bool crosses(const OtherOrientedSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:563
constexpr bool separates(const EmptyShape< EmptyPoint > &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition convex.hpp:1345
constexpr std::vector< Segment< PointType > > edges() const
Returns the edges of the convex polygon.
Definition convex.hpp:529
constexpr bool intersects(const OtherTriangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:807
constexpr std::optional< BoundaryType< false > > getIfSegment() const
Returns the segment the convex polygon collapses to, if it does.
Definition predicates.hpp:1008
constexpr auto squaredDistance(const OtherOrientedLine &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1041
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherHalfplane &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr auto distanceL1(const OtherSegment &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:732
constexpr bool crosses(const OtherRectangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:593
constexpr bool isPoint() const
Returns whether the convex polygon collapses to a single point.
Definition predicates.hpp:987
constexpr bool intersects(const OtherRay &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:762
constexpr bool isUndefined() const
Returns whether the convex polygon is degenerate without collapsing to a point or to a segment.
Definition predicates.hpp:1016
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1202
constexpr Polygon< PointType > asPolygon() const
Returns the convex polygon as a simple polygon.
Definition convex.hpp:636
constexpr bool separates(const OtherHalfplane &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1562
constexpr bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1549
constexpr bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1568
constexpr bool boundaryContains(const OtherPolyline &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1336
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:1253
constexpr auto end() const
Returns a constant iterator to the end of vertices.
Definition convex.hpp:314
constexpr OrientedEdgeIterator orientedEdgesEnd() const
Returns an iterator past the last oriented edge.
Definition convex.hpp:615
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:603
constexpr bool boundaryContains(const OtherOrientedLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:770
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > >, Convex< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherTriangle &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1587
constexpr auto hausdorffDistanceLInf(const OtherOrientedSegment &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1076
constexpr auto operator<=>(const Convex &other) const
Compares two convex polygons.
Definition convex.hpp:331
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:1540
constexpr auto distanceL1(const OtherShape &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition convex.hpp:2476
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1135
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).
Disk< Point< NumberType > > smallestEnclosingDisk() const
Returns the smallest closed disk containing the convex polygon.
Definition mindisk.hpp:192
constexpr Convex()=default
Creates a convex with no vertex.
constexpr auto distanceL1(const OtherTriangle &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:781
constexpr bool crosses(const OtherRay &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:581
constexpr bool intersects(const OtherRectangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:780
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2152
constexpr auto orientedEdgesView() const
Lazy view counterpart of orientedEdges(); see edgesView().
Definition convex.hpp:583
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:1482
constexpr bool interiorContains(const OtherOrientedLine &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:821
constexpr auto begin() const
Returns a constant iterator to the beginning of vertices.
Definition convex.hpp:298
constexpr bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:4667
constexpr auto squaredDistance(const OtherTriangle &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:987
constexpr bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1584
constexpr std::optional< std::array< Segment< PointType >, 2 > > edgesAtX(OtherNumberType x) const
Returns two edges of the convex polygon that intersect with the vertical line at x.
Definition atxy.hpp:289
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > >, Convex< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherConvex &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition intersection.hpp:1593
constexpr bool intersects(const OtherLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:742
constexpr void rotate90(int k=1)
Rotates the convex polygon by 90k degrees around the origin in place.
Definition transformations.hpp:1628
constexpr bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1555
constexpr bool boundaryContains(const OtherRay &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:776
constexpr bool crosses(const OtherLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:569
constexpr auto hausdorffDistanceLInf(const OtherTriangle &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1092
auto symmetricDifference(const Shape< OtherPoint > &other) const
Returns the regularized symmetric difference of the two shapes (A △ B), re-dispatching through the wr...
Definition convex.hpp:2555
constexpr bool crosses(const OtherHalfplane &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:587
constexpr auto regularizedIntersection(const OtherShape &other) const
Forwards a regularized intersection to the shape that owns it.
Definition convex.hpp:2956
constexpr void insert(const TShape &shape)
Enlarges the convex polygon so that it contains a finite shape.
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1200
constexpr std::vector< OrientedSegment< PointType > > orientedEdges() const
Returns the oriented edges of the convex polygon.
Definition convex.hpp:544
constexpr auto distanceLInf(const OtherConvex &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:744
constexpr Point< ResultNumber > centroid() const
Computes the centroid of the convex polygon.
Definition measures.hpp:538
constexpr Segment< PointType > diameter() const
Returns a segment realizing the diameter (the farthest vertex pair).
Definition measures.hpp:696
constexpr const std::vector< PointType > vertices() const
Returns the vertices of the convex polygon.
Definition convex.hpp:508
constexpr auto hausdorffDistanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition convex.hpp:2722
constexpr std::vector< std::pair< std::size_t, std::size_t > > antipodalPairs() const
Returns every antipodal vertex-index pair, via rotating calipers.
Definition measures.hpp:615
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
constexpr auto squaredHausdorffDistance(const OtherRectangle &other) const
Returns the squared Hausdorff distance to the given shape.
Definition distance.hpp:1132
constexpr Convex(Range &&points, bool trusted=false)
Creates a convex from a range of points.
Definition convex.hpp:200
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:636
constexpr auto distanceLInf(const OtherSegment &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:720
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Disk< Point< NumberType > > smallestEnclosingDisk(UniformRandomBitGenerator &&generator) const
Returns the smallest closed disk containing the convex polygon.
constexpr auto hausdorffDistanceL1(const OtherRectangle &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1096
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1219
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:907
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2854
constexpr bool boundaryContains(const OtherChain &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1226
constexpr auto hausdorffDistanceL1(const OtherTriangle &other) const
Returns the Manhattan (L1) Hausdorff distance to the given shape.
Definition distancel1.hpp:1104
constexpr auto distanceLInf(const OtherHalfplane &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:820
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherIntersection &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr bool interiorContains(const OtherSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:803
constexpr auto distanceL1(const OtherOrientedLine &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:809
constexpr bool contains(const OtherOrientedLine &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:1182
BoundaryIterator< false > EdgeIterator
Definition convex.hpp:182
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition convex.hpp:1961
constexpr bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:1578
constexpr bool crosses(const OtherConvex &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:609
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherConvex &other) const
Returns the regularized union of the two shapes (A ∪ B).
constexpr auto hausdorffDistanceLInf(const OtherRectangle &other) const
Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
Definition distancelinf.hpp:1084
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 convex.hpp:2519
constexpr auto distanceL1(const OtherPoint &point) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:715
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:872
size_t size() const
Returns the number of vertices in the convex polygon.
Definition convex.hpp:840
constexpr bool interiorsIntersect(const OtherSegment &other) const
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
Definition interiorsintersect.hpp:842
constexpr auto cbegin() const
Returns a constant iterator to the beginning of vertices.
Definition convex.hpp:306
constexpr auto distanceL1(const OtherConvex &other) const
Returns the Manhattan (L1) distance to the given shape.
Definition distancel1.hpp:756
constexpr bool interiorContains(const Shape< OtherPoint > &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:918
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:858
constexpr Convex(const Convex< OtherPointType, OtherLabelType > &other)
Converts a convex with compatible vertex type.
Definition convex.hpp:257
constexpr const PointType operator[](std::size_t index) const
Accesses a vertex by index.
Definition convex.hpp:279
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherRectangle &other) const
Returns the regularized union of the two shapes (A ∪ B).
constexpr auto squaredDistance(const OtherRay &other) const
Returns the squared Euclidean distance to the given shape.
Definition distance.hpp:1047
constexpr bool boundaryContains(const OtherPoint &point) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:652
constexpr HalfplaneIntersection< PointType > smallestEnclosingRectangle() const
Returns the smallest-area rectangle containing the convex polygon.
Definition measures.hpp:725
constexpr auto distanceLInf(const OtherTriangle &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition distancelinf.hpp:769
PointType PointType
Definition convex.hpp:171
constexpr auto distanceLInf(const OtherShape &other) const
Returns the Chebyshev (LInf) distance to the given shape.
Definition convex.hpp:2630
constexpr Convex scaledDownY(const OtherNumber scalar) const
Returns the convex polygon with its y-coordinates divided by a divisor.
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
Weakly x-monotone polyline stored by lexicographically sorted vertices.
Definition monotonechain.hpp:146
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
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