22template <
class Po
intType = Po
int<>,
class Label>
27template <PolygonConcept OuterPolygon>
30template <PolygonConcept OuterPolygon>
33template <PolygonConcept OuterPolygon, std::ranges::input_range HoleRange>
34 requires detail::is_polygon_v<std::ranges::range_value_t<HoleRange>>
37template <PolygonConcept OuterPolygon, std::ranges::input_range HoleRange>
38 requires detail::is_polygon_v<std::ranges::range_value_t<HoleRange>>
88template <
class Po
intType_,
class TLabel>
95 static_assert(detail::is_point_v<PointType>,
"PolygonWithHoles requires pgl::Point vertices");
110 : outer_(std::move(
outer)) {}
127 template <std::ranges::input_range HoleRange>
128 requires detail::is_polygon_v<std::ranges::range_value_t<HoleRange>>
130 : outer_(std::move(
outer)) {
132 holes_.emplace_back(
hole);
150 template <Po
intConcept OtherPo
intType,
class OtherLabelType>
151 requires(std::constructible_from<PointType, const OtherPointType&>)
153 : outer_(other.
outer()) {
156 holes_.emplace_back(hole);
168 template <
class A = LabelType>
169 requires(detail::has_label_v<A>)
184 return holes_.size();
189 return !holes_.empty();
197 assert(index < holes_.size());
198 return holes_[index];
202 [[nodiscard]]
constexpr const std::vector<PolygonType>&
holes()
const {
207 [[nodiscard]]
constexpr auto begin()
const {
return holes_.begin(); }
210 [[nodiscard]]
constexpr auto cbegin()
const {
return holes_.cbegin(); }
213 [[nodiscard]]
constexpr auto end()
const {
return holes_.end(); }
216 [[nodiscard]]
constexpr auto cend()
const {
return holes_.cend(); }
228 if (
hole.isDegenerate()) {
231 const auto position = std::lower_bound(holes_.begin(), holes_.end(),
hole);
232 holes_.insert(position, std::move(
hole));
247 assert(index < holes_.size());
248 holes_.erase(holes_.begin() +
static_cast<std::ptrdiff_t
>(index));
263 const auto position = std::lower_bound(holes_.begin(), holes_.end(),
hole);
264 if (position == holes_.end() || !(*position ==
hole)) {
267 holes_.erase(position);
280 std::size_t total = outer_.size();
281 for (
const auto&
hole : holes_) {
282 total +=
hole.size();
298 std::size_t total = outer_.chainCount();
299 for (
const auto&
hole : holes_) {
300 total +=
hole.chainCount();
306 [[nodiscard]]
constexpr std::vector<PointType>
vertices()
const {
307 std::vector<PointType> result;
309 for (
const auto&
vertex : outer_) {
312 for (
const auto&
hole : holes_) {
334 return VertexIterator(
this, 0);
339 return VertexIterator(
this, 1 + holes_.size());
343 [[nodiscard]]
constexpr std::vector<EdgeType>
edges()
const {
344 std::vector<EdgeType> result;
346 for (
const auto&
edge : outer_.edgesView()) {
347 result.push_back(
edge);
349 for (
const auto&
hole : holes_) {
350 for (
const auto&
edge :
hole.edgesView()) {
351 result.push_back(
edge);
364 [[nodiscard]]
constexpr std::vector<OrientedSegment<PointType>>
orientedEdges()
const {
365 std::vector<OrientedSegment<PointType>> result;
367 for (
const auto&
edge : outer_.orientedEdgesView()) {
368 result.push_back(
edge);
370 for (
const auto&
hole : holes_) {
371 for (
const auto&
edge :
hole.orientedEdgesView()) {
372 result.emplace_back(
edge.target(),
edge.source());
395 if (
auto cmp = outer_ <=> other.outer_; cmp != 0) {
398 if (
auto cmp = holes_.size() <=> other.holes_.size(); cmp != 0) {
401 for (std::size_t i = 0; i < holes_.size(); ++i) {
402 if (
auto cmp = holes_[i] <=> other.holes_[i]; cmp != 0) {
406 return std::strong_ordering::equal;
411 if (!(outer_ == other.outer_) || holes_.size() != other.holes_.size()) {
414 for (std::size_t i = 0; i < holes_.size(); ++i) {
415 if (!(holes_[i] == other.holes_[i])) {
423 template<AnyShapeConcept OtherShape>
424 [[nodiscard]]
constexpr bool samePointSet(
const OtherShape& other)
const;
430 [[nodiscard]]
constexpr bool empty()
const {
431 return outer_.size() == 0;
442 using Exact = detail::promoted_number_t<NumberType>;
452 [[nodiscard]]
constexpr bool isPoint()
const {
453 return outer_.isPoint();
458 return outer_.isSegment();
477 template <
class Rational = pgl::Rational<pgl::BigInt>>
482 for (
const auto&
hole : holes_) {
507 template <
class Rational = pgl::Rational<pgl::BigInt>>
558 template <
class ResultNumber = division_result_t<NumberType>>
576 template <
class ResultNumber = NumberType>
577 [[nodiscard]]
constexpr ResultNumber
twiceArea()
const {
579 for (
const auto&
hole : holes_) {
589 template <
class ResultNumber = division_result_t<NumberType>>
590 [[nodiscard]]
constexpr auto area()
const {
591 ResultNumber result =
static_cast<ResultNumber
>(
twiceArea());
592 return result / ResultNumber(2);
606 template <
class ResultNumber = division_result_t<NumberType>>
610 template <
class ResultNumber = division_result_t<NumberType>>
631 template <
class ResultNumber = division_result_t<NumberType>>
642 template <
class OtherShape>
666 template <
class SegmentRange>
774 template <
class ResultNumber = division_result_t<NumberType>>
831 template <
class ResultNumber = gr
id_number_t<
typename Po
intType_::NumberType>>
832 requires(std::signed_integral<ResultNumber>)
848 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
853 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
858 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
863 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
868 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
881 template <
class ResultNumber = division_result_t<NumberType>, PolygonSetConcept OtherSet>
907 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
920 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
936 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
941 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
946 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
951 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
956 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
970 template <
class ResultNumber = division_result_t<NumberType>, PolygonSetConcept OtherSet>
982 template <
class ResultNumber = NumberType, Po
intConcept OtherPo
int>
983 [[nodiscard]]
constexpr std::optional<Point<ResultNumber, typename PointType::LabelType>>
1009 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1010 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1021 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
1022 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1039 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
1040 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1051 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
1052 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1068 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
1069 [[nodiscard]]
constexpr std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1090 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
1091 [[nodiscard]]
constexpr auto intersection(
const OtherPolyline& other)
const;
1106 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
1136 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
1137 [[nodiscard]] std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1143 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
1144 [[nodiscard]] std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1150 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1151 [[nodiscard]] std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1157 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1158 [[nodiscard]] std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1164 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
1165 [[nodiscard]] std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1184 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
1185 [[nodiscard]] std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1197 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1198 [[nodiscard]] std::vector<std::variant<Point<ResultNumber, typename PointType::LabelType>,
1228 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
1233 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
1238 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1243 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1248 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
1267 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
1285 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
1290 template <
class ResultNumber = NumberType,
class EmptyPo
int>
1307 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
1312 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
1317 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1322 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1327 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
1341 template <
class ResultNumber = division_result_t<NumberType>, PolygonSetConcept OtherSet>
1373 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
1378 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
1383 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
1388 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
1393 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
1405 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
1419 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
1435 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
1445 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherSegment>
1459 template <
class ResultNumber = division_result_t<NumberType>, PolygonSetConcept OtherSet>
1477 template <
class OtherShape>
1504 template <
class OtherShape>
1539 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
1572 return outer_.
bbox();
1593 template <
class ResultNumber = gr
id_number_t<
typename Po
intType_::NumberType>>
1594 requires(detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
1599 template <std::
floating_po
int ResultNumber =
double>
1621 template <Po
intConcept OtherPo
int>
1622 [[nodiscard]]
constexpr bool contains(
const OtherPoint& point)
const;
1629 template <Po
intConcept OtherPo
int>
1640 template <Po
intConcept OtherPo
int>
1648 template <Po
intConcept OtherPo
int>
1649 [[nodiscard]]
constexpr bool intersects(
const OtherPoint& point)
const {
1659 template <Po
intConcept OtherPo
int>
1682 template <SegmentConcept OtherSegment>
1683 [[nodiscard]]
constexpr bool contains(
const OtherSegment& other)
const;
1686 template <OrientedSegmentConcept OtherOrientedSegment>
1687 [[nodiscard]]
constexpr bool contains(
const OtherOrientedSegment& other)
const;
1696 template <SegmentConcept OtherSegment>
1708 template <SegmentConcept OtherSegment>
1712 template <OrientedSegmentConcept OtherOrientedSegment>
1722 template <SegmentConcept OtherSegment>
1726 template <OrientedSegmentConcept OtherOrientedSegment>
1734 template <SegmentConcept OtherSegment>
1735 [[nodiscard]]
constexpr bool intersects(
const OtherSegment& other)
const;
1738 template <OrientedSegmentConcept OtherOrientedSegment>
1739 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedSegment& other)
const;
1751 template <SegmentConcept OtherSegment>
1755 template <OrientedSegmentConcept OtherOrientedSegment>
1777 template <LineConcept OtherLine>
1778 [[nodiscard]]
constexpr bool contains(
const OtherLine& other)
const;
1781 template <OrientedLineConcept OtherOrientedLine>
1782 [[nodiscard]]
constexpr bool contains(
const OtherOrientedLine& other)
const;
1785 template <RayConcept OtherRay>
1786 [[nodiscard]]
constexpr bool contains(
const OtherRay& other)
const;
1789 template <HalfplaneConcept OtherHalfplane>
1790 [[nodiscard]]
constexpr bool contains(
const OtherHalfplane& other)
const;
1797 template <LineConcept OtherLine>
1801 template <OrientedLineConcept OtherOrientedLine>
1805 template <RayConcept OtherRay>
1809 template <HalfplaneConcept OtherHalfplane>
1817 template <LineConcept OtherLine>
1821 template <OrientedLineConcept OtherOrientedLine>
1825 template <RayConcept OtherRay>
1829 template <HalfplaneConcept OtherHalfplane>
1837 template <LineConcept OtherLine>
1838 [[nodiscard]]
constexpr bool intersects(
const OtherLine& other)
const;
1841 template <OrientedLineConcept OtherOrientedLine>
1842 [[nodiscard]]
constexpr bool intersects(
const OtherOrientedLine& other)
const;
1845 template <RayConcept OtherRay>
1846 [[nodiscard]]
constexpr bool intersects(
const OtherRay& other)
const;
1849 template <HalfplaneConcept OtherHalfplane>
1850 [[nodiscard]]
constexpr bool intersects(
const OtherHalfplane& other)
const;
1862 template <LineConcept OtherLine>
1866 template <OrientedLineConcept OtherOrientedLine>
1870 template <RayConcept OtherRay>
1885 template <HalfplaneConcept OtherHalfplane>
1918 template <RectangleConcept OtherRectangle>
1919 [[nodiscard]]
constexpr bool contains(
const OtherRectangle& other)
const;
1922 template <TriangleConcept OtherTriangle>
1923 [[nodiscard]]
constexpr bool contains(
const OtherTriangle& other)
const;
1926 template <ConvexConcept OtherConvex>
1927 [[nodiscard]]
constexpr bool contains(
const OtherConvex& other)
const;
1930 template <PolygonConcept OtherPolygon>
1931 [[nodiscard]]
constexpr bool contains(
const OtherPolygon& other)
const;
1934 template <PolygonWithHolesConcept OtherRegion>
1935 [[nodiscard]]
constexpr bool contains(
const OtherRegion& other)
const;
1945 template <RectangleConcept OtherRectangle>
1949 template <TriangleConcept OtherTriangle>
1953 template <ConvexConcept OtherConvex>
1957 template <PolygonConcept OtherPolygon>
1961 template <PolygonWithHolesConcept OtherRegion>
1971 template <RectangleConcept OtherRectangle>
1975 template <TriangleConcept OtherTriangle>
1979 template <ConvexConcept OtherConvex>
1983 template <PolygonConcept OtherPolygon>
1987 template <PolygonWithHolesConcept OtherRegion>
1995 template <RectangleConcept OtherRectangle>
1996 [[nodiscard]]
constexpr bool intersects(
const OtherRectangle& other)
const;
1999 template <TriangleConcept OtherTriangle>
2000 [[nodiscard]]
constexpr bool intersects(
const OtherTriangle& other)
const;
2003 template <ConvexConcept OtherConvex>
2004 [[nodiscard]]
constexpr bool intersects(
const OtherConvex& other)
const;
2007 template <PolygonConcept OtherPolygon>
2008 [[nodiscard]]
constexpr bool intersects(
const OtherPolygon& other)
const;
2011 template <PolygonWithHolesConcept OtherRegion>
2012 [[nodiscard]]
constexpr bool intersects(
const OtherRegion& other)
const;
2029 template <RectangleConcept OtherRectangle>
2033 template <TriangleConcept OtherTriangle>
2037 template <ConvexConcept OtherConvex>
2041 template <PolygonConcept OtherPolygon>
2045 template <PolygonWithHolesConcept OtherRegion>
2066 template <MonotoneChainConcept OtherChain>
2067 [[nodiscard]]
constexpr bool contains(
const OtherChain& other)
const;
2070 template <PolylineConcept OtherPolyline>
2071 [[nodiscard]]
constexpr bool contains(
const OtherPolyline& other)
const;
2074 template <MonotoneChainConcept OtherChain>
2078 template <PolylineConcept OtherPolyline>
2082 template <MonotoneChainConcept OtherChain>
2086 template <PolylineConcept OtherPolyline>
2090 template <MonotoneChainConcept OtherChain>
2091 [[nodiscard]]
constexpr bool intersects(
const OtherChain& other)
const;
2094 template <PolylineConcept OtherPolyline>
2095 [[nodiscard]]
constexpr bool intersects(
const OtherPolyline& other)
const;
2107 template <MonotoneChainConcept OtherChain>
2111 template <PolylineConcept OtherPolyline>
2140 template <DiskConcept OtherDisk>
2141 [[nodiscard]]
constexpr bool contains(
const OtherDisk& other)
const;
2144 template <DiskConcept OtherDisk>
2148 template <DiskConcept OtherDisk>
2152 template <DiskConcept OtherDisk>
2153 [[nodiscard]]
constexpr bool intersects(
const OtherDisk& other)
const;
2164 template <DiskConcept OtherDisk>
2186 template <HalfplaneIntersectionConcept OtherIntersection>
2187 [[nodiscard]]
constexpr bool contains(
const OtherIntersection& other)
const;
2190 template <HalfplaneIntersectionConcept OtherIntersection>
2194 template <HalfplaneIntersectionConcept OtherIntersection>
2198 template <HalfplaneIntersectionConcept OtherIntersection>
2199 [[nodiscard]]
constexpr bool intersects(
const OtherIntersection& other)
const;
2209 template <HalfplaneIntersectionConcept OtherIntersection>
2230 template <Po
intConcept OtherPo
int>
2231 [[nodiscard]]
bool separates(
const OtherPoint& other)
const;
2234 template <SegmentConcept OtherSegment>
2235 [[nodiscard]]
bool separates(
const OtherSegment& other)
const;
2238 template <OrientedSegmentConcept OtherOrientedSegment>
2239 [[nodiscard]]
bool separates(
const OtherOrientedSegment& other)
const;
2242 template <LineConcept OtherLine>
2246 template <OrientedLineConcept OtherOrientedLine>
2247 [[nodiscard]]
bool separates(
const OtherOrientedLine& other)
const;
2250 template <RayConcept OtherRay>
2254 template <HalfplaneConcept OtherHalfplane>
2255 [[nodiscard]]
bool separates(
const OtherHalfplane& other)
const;
2258 template <RectangleConcept OtherRectangle>
2259 [[nodiscard]]
bool separates(
const OtherRectangle& other)
const;
2262 template <TriangleConcept OtherTriangle>
2263 [[nodiscard]]
bool separates(
const OtherTriangle& other)
const;
2266 template <ConvexConcept OtherConvex>
2267 [[nodiscard]]
bool separates(
const OtherConvex& other)
const;
2270 template <PolygonConcept OtherPolygon>
2271 [[nodiscard]]
bool separates(
const OtherPolygon& other)
const;
2274 template <PolygonWithHolesConcept OtherRegion>
2275 [[nodiscard]]
bool separates(
const OtherRegion& other)
const;
2278 template <MonotoneChainConcept OtherChain>
2279 [[nodiscard]]
bool separates(
const OtherChain& other)
const;
2282 template <PolylineConcept OtherPolyline>
2283 [[nodiscard]]
bool separates(
const OtherPolyline& other)
const;
2293 template <DiskConcept OtherDisk>
2297 template <HalfplaneIntersectionConcept OtherIntersection>
2298 [[nodiscard]]
bool separates(
const OtherIntersection& other)
const;
2301 template <Po
intConcept OtherPo
int>
2302 [[nodiscard]]
bool crosses(
const OtherPoint& other)
const;
2305 template <SegmentConcept OtherSegment>
2306 [[nodiscard]]
bool crosses(
const OtherSegment& other)
const;
2309 template <OrientedSegmentConcept OtherOrientedSegment>
2310 [[nodiscard]]
bool crosses(
const OtherOrientedSegment& other)
const;
2313 template <LineConcept OtherLine>
2314 [[nodiscard]]
bool crosses(
const OtherLine& other)
const;
2317 template <OrientedLineConcept OtherOrientedLine>
2318 [[nodiscard]]
bool crosses(
const OtherOrientedLine& other)
const;
2321 template <RayConcept OtherRay>
2322 [[nodiscard]]
bool crosses(
const OtherRay& other)
const;
2325 template <HalfplaneConcept OtherHalfplane>
2326 [[nodiscard]]
bool crosses(
const OtherHalfplane& other)
const;
2329 template <RectangleConcept OtherRectangle>
2330 [[nodiscard]]
bool crosses(
const OtherRectangle& other)
const;
2333 template <TriangleConcept OtherTriangle>
2334 [[nodiscard]]
bool crosses(
const OtherTriangle& other)
const;
2337 template <ConvexConcept OtherConvex>
2338 [[nodiscard]]
bool crosses(
const OtherConvex& other)
const;
2341 template <PolygonConcept OtherPolygon>
2342 [[nodiscard]]
bool crosses(
const OtherPolygon& other)
const;
2345 template <PolygonWithHolesConcept OtherRegion>
2346 [[nodiscard]]
bool crosses(
const OtherRegion& other)
const;
2349 template <MonotoneChainConcept OtherChain>
2350 [[nodiscard]]
bool crosses(
const OtherChain& other)
const;
2353 template <PolylineConcept OtherPolyline>
2354 [[nodiscard]]
bool crosses(
const OtherPolyline& other)
const;
2357 template <DiskConcept OtherDisk>
2358 [[nodiscard]]
bool crosses(
const OtherDisk& other)
const;
2361 template <HalfplaneIntersectionConcept OtherIntersection>
2362 [[nodiscard]]
bool crosses(
const OtherIntersection& other)
const;
2386 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2390 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2394 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2398 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
2402 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
2406 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
2410 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
2414 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2418 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2422 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2426 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
2430 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
2434 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
2438 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
2442 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
2452 template <
class ResultNumber =
double, DiskConcept OtherDisk>
2453 [[nodiscard]] detail::floating_result_t<ResultNumber>
squaredDistance(
const OtherDisk& other)
const;
2467 template <
class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
2468 requires detail::ClosestPairConcept<PolygonWithHoles<PointType_, TLabel>, OtherShape>
2487 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
2488 requires detail::ClosestPointsPairConcept<PolygonWithHoles<PointType_, TLabel>, OtherShape>
2492 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2493 [[nodiscard]]
constexpr auto distanceL1(
const OtherPoint& point)
const;
2496 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2497 [[nodiscard]]
constexpr auto distanceL1(
const OtherSegment& other)
const;
2500 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2501 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedSegment& other)
const;
2504 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
2505 [[nodiscard]]
constexpr auto distanceL1(
const OtherLine& other)
const;
2508 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
2509 [[nodiscard]]
constexpr auto distanceL1(
const OtherOrientedLine& other)
const;
2512 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
2513 [[nodiscard]]
constexpr auto distanceL1(
const OtherRay& other)
const;
2516 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
2517 [[nodiscard]]
constexpr auto distanceL1(
const OtherHalfplane& other)
const;
2520 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2521 [[nodiscard]]
constexpr auto distanceL1(
const OtherRectangle& other)
const;
2524 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2525 [[nodiscard]]
constexpr auto distanceL1(
const OtherTriangle& other)
const;
2528 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2529 [[nodiscard]]
constexpr auto distanceL1(
const OtherConvex& other)
const;
2532 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
2533 [[nodiscard]]
constexpr auto distanceL1(
const OtherPolygon& other)
const;
2536 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
2537 [[nodiscard]]
constexpr auto distanceL1(
const OtherRegion& other)
const;
2540 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
2541 [[nodiscard]]
constexpr auto distanceL1(
const OtherChain& other)
const;
2544 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
2545 [[nodiscard]]
constexpr auto distanceL1(
const OtherPolyline& other)
const;
2548 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
2549 [[nodiscard]]
constexpr auto distanceL1(
const OtherIntersection& other)
const;
2552 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2556 template <
class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
2557 [[nodiscard]]
constexpr auto distanceLInf(
const OtherSegment& other)
const;
2560 template <
class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
2561 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedSegment& other)
const;
2564 template <
class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
2568 template <
class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
2569 [[nodiscard]]
constexpr auto distanceLInf(
const OtherOrientedLine& other)
const;
2572 template <
class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
2576 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
2577 [[nodiscard]]
constexpr auto distanceLInf(
const OtherHalfplane& other)
const;
2580 template <
class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
2581 [[nodiscard]]
constexpr auto distanceLInf(
const OtherRectangle& other)
const;
2584 template <
class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
2585 [[nodiscard]]
constexpr auto distanceLInf(
const OtherTriangle& other)
const;
2588 template <
class ResultNumber = division_result_t<NumberType>, ConvexConcept OtherConvex>
2592 template <
class ResultNumber = division_result_t<NumberType>, PolygonConcept OtherPolygon>
2593 [[nodiscard]]
constexpr auto distanceLInf(
const OtherPolygon& other)
const;
2596 template <
class ResultNumber = division_result_t<NumberType>, PolygonWithHolesConcept OtherRegion>
2600 template <
class ResultNumber = division_result_t<NumberType>, MonotoneChainConcept OtherChain>
2604 template <
class ResultNumber = division_result_t<NumberType>, PolylineConcept OtherPolyline>
2605 [[nodiscard]]
constexpr auto distanceLInf(
const OtherPolyline& other)
const;
2608 template <
class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
2609 [[nodiscard]]
constexpr auto distanceLInf(
const OtherIntersection& other)
const;
2620 template <PolygonSetConcept OtherSet>
2621 [[nodiscard]]
constexpr bool contains(
const OtherSet& other)
const {
2622 for (
const auto& component : other) {
2631 template <PolygonSetConcept OtherSet>
2633 for (
const auto& component : other) {
2642 template <PolygonSetConcept OtherSet>
2644 for (
const auto& component : other) {
2660 template <PolygonSetConcept OtherSet>
2669 template <
class OtherShape>
2671 detail::shapeRank<OtherShape> > detail::shapeRank<PolygonWithHoles>)
2672 [[nodiscard]]
constexpr bool intersects(
const OtherShape& other)
const {
2673 return other.intersects(*
this);
2682 template <
class OtherShape>
2684 detail::shapeRank<OtherShape> > detail::shapeRank<PolygonWithHoles>)
2686 return other.interiorsIntersect(*
this);
2690 template <
class OtherShape>
2692 detail::shapeRank<OtherShape> > detail::shapeRank<PolygonWithHoles>)
2693 [[nodiscard]]
constexpr bool crosses(
const OtherShape& other)
const {
2694 return other.crosses(*
this);
2698 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
2700 (detail::shapeRank<OtherShape> > detail::shapeRank<PolygonWithHoles>) &&
2709 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
2711 (detail::shapeRank<OtherShape> > detail::shapeRank<PolygonWithHoles>) &&
2720 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
2721 requires((detail::shapeRank<OtherShape> > detail::shapeRank<PolygonWithHoles>) &&
2730 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
2731 requires((detail::shapeRank<OtherShape> > detail::shapeRank<PolygonWithHoles>) &&
2735 [[nodiscard]]
constexpr auto distanceL1(
const OtherShape& other)
const {
2740 template <
class ResultNumber = division_result_t<NumberType>,
class OtherShape>
2741 requires((detail::shapeRank<OtherShape> > detail::shapeRank<PolygonWithHoles>) &&
2754 template <
class EmptyPo
int>
2760 template <
class EmptyPo
int>
2766 template <
class EmptyPo
int>
2772 template <
class EmptyPo
int>
2778 template <
class EmptyPo
int>
2784 template <
class EmptyPo
int>
2790 template <
class EmptyPo
int>
2800 template <Po
intConcept OtherPo
int>
2804 template <Po
intConcept OtherPo
int>
2808 template <Po
intConcept OtherPo
int>
2812 template <Po
intConcept OtherPo
int>
2816 template <Po
intConcept OtherPo
int>
2820 template <Po
intConcept OtherPo
int>
2824 template <Po
intConcept OtherPo
int>
2842 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2848 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2865 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2884 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2901 template <
class ResultNumber = division_result_t<NumberType>, Po
intConcept OtherPo
int>
2910 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
2919 template <
class ResultNumber =
double, Po
intConcept OtherPo
int>
2928 template <
class TranslationNumber,
class TranslationLabel>
2930 outer_ += translation;
2931 for (
auto&
hole : holes_) {
2932 hole += translation;
2939 template <
class TranslationNumber,
class TranslationLabel>
2941 return *
this += (-translation);
2950 template <
class Scalar>
2954 for (
auto&
hole : holes_) {
2962 template <
class Scalar>
2966 for (
auto&
hole : holes_) {
2977 result.holes_.reserve(holes_.size());
2978 for (
const auto&
hole : holes_) {
2979 result.holes_.push_back(
hole.rotated90(k));
2987 auto saved = label_;
2989 label_ = std::move(saved);
3000 template <
class OtherNumber>
3006 template <
class OtherNumber>
3008 auto saved = label_;
3010 label_ = std::move(saved);
3014 template <
class OtherNumber>
3020 template <
class OtherNumber>
3022 auto saved = label_;
3024 label_ = std::move(saved);
3028 template <
class OtherNumber>
3034 template <
class OtherNumber>
3036 auto saved = label_;
3038 label_ = std::move(saved);
3042 template <
class OtherNumber>
3048 template <
class OtherNumber>
3050 auto saved = label_;
3052 label_ = std::move(saved);
3074 assert(region !=
nullptr);
3075 return currentRing()[index];
3096 : region(region_arg), ring(ring_arg) {
3100 constexpr const PolygonType& currentRing()
const {
3101 return ring == 0 ? region->outer_ : region->holes_[ring - 1];
3109 constexpr void skipExhausted() {
3110 const std::size_t rings = region ==
nullptr ? 0 : 1 + region->holes_.size();
3111 while (ring < rings && index == currentRing().size()) {
3118 std::size_t ring = 0;
3119 std::size_t index = 0;
3130 template <
class RingTransform>
3133 result.outer_ = transform(outer_);
3134 result.holes_.reserve(holes_.size());
3135 for (
const auto&
hole : holes_) {
3136 result.holes_.push_back(transform(
hole));
3149 template <
class EdgePredicate>
3150 constexpr bool anyBoundaryEdge(EdgePredicate&& predicate)
const {
3151 for (
const auto&
edge : outer_.edgesView()) {
3152 if (predicate(
edge)) {
3156 for (
const auto&
hole : holes_) {
3157 for (
const auto&
edge :
hole.edgesView()) {
3158 if (predicate(
edge)) {
3182 template <
class OtherLinear,
class ContactNumber>
3183 constexpr bool linearInteriorsIntersect(
const OtherLinear& other,
3218 template <
class OtherArea>
3219 constexpr bool outerInteriorContains(
const OtherArea& other)
const;
3230 template <
class OtherArea>
3231 constexpr bool areaContains(
const OtherArea& other)
const;
3234 template <
class OtherArea>
3235 constexpr bool areaInteriorContains(
const OtherArea& other)
const;
3238 template <
class OtherArea>
3239 constexpr bool areaBoundaryContains(
const OtherArea& other)
const;
3242 template <
class OtherArea>
3243 constexpr bool areaIntersects(
const OtherArea& other)
const;
3246 template <
class OtherArea>
3247 bool areaInteriorsIntersect(
const OtherArea& other)
const;
3258 template <
class OtherChain,
class EdgeRelation>
3259 constexpr bool chainRelation(
const OtherChain& other,
bool all, EdgeRelation&& relation)
const;
3268 template <
class OtherIntersection>
3269 static constexpr auto asConvexOperand(
const OtherIntersection& other);
3279 template <
class OtherIntersection,
class Relation>
3280 constexpr bool degenerateIntersectionRelation(
const OtherIntersection& other,
3281 Relation&& relation)
const;
3290 template <
class ResultNumber,
class OtherShape>
3291 constexpr ResultNumber edgeMinSquaredDistance(
const OtherShape& other)
const;
3294 template <
class ResultNumber,
class OtherShape>
3295 constexpr ResultNumber edgeMinDistanceL1(
const OtherShape& other)
const;
3298 template <
class ResultNumber,
class OtherShape>
3299 constexpr ResultNumber edgeMinDistanceLInf(
const OtherShape& other)
const;
3302 std::vector<PolygonType> holes_{};
3303 [[no_unique_address]]
mutable LabelType label_{};
3309 static constexpr std::size_t hashUnset_ = pgl::detail::numeric_limits<std::size_t>::max();
3310 mutable std::size_t hash_ = hashUnset_;
3313 template <
class OtherPo
intType,
class OtherLabelType>
3316 constexpr void resetCache()
const {
3327 constexpr void normalize() {
3329 std::sort(holes_.begin(), holes_.end());
3340template <
class Po
intType,
class LabelType,
class TranslationNumber,
class TranslationLabel>
3343 return region + (-translation);
3346template <
class Po
intType,
class LabelType,
class Scalar>
3347 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
3352 if constexpr (detail::has_label_v<LabelType>) {
3353 result.
label() = LabelType{};
3358template <
class Scalar,
class Po
intType,
class LabelType>
3359 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
3361 return region * scalar;
3364template <
class Po
intType,
class LabelType,
class Scalar>
3365 requires(!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
3370 if constexpr (detail::has_label_v<LabelType>) {
3371 result.
label() = LabelType{};
3376template <
class Po
intType,
class LabelType>
Undirected simple graph stored as adjacency sets.
Definition graph.hpp:38
constexpr bool operator==(const VertexIterator &other) const =default
std::ptrdiff_t difference_type
Definition polygonwithholes.hpp:3068
constexpr VertexIterator()=default
PointType value_type
Definition polygonwithholes.hpp:3067
friend struct PolygonWithHoles
Definition polygonwithholes.hpp:3093
value_type reference
Definition polygonwithholes.hpp:3069
constexpr VertexIterator & operator++()
Definition polygonwithholes.hpp:3078
constexpr value_type operator*() const
Definition polygonwithholes.hpp:3073
std::forward_iterator_tag iterator_concept
Definition polygonwithholes.hpp:3066
constexpr VertexIterator operator++(int)
Definition polygonwithholes.hpp:3084
std::forward_iterator_tag iterator_category
Definition polygonwithholes.hpp:3065
Bounded polygonal primitives, convex or not.
Definition forward.hpp:373
Shape pairs whose Minkowski sum Pangolin can represent.
Definition forward.hpp:476
Definition forward.hpp:306
Public declaration of pgl::HalfplaneIntersection.
Definition arrangement.hpp:67
@ edge
Definition bitmatrix.hpp:37
@ vertex
Definition bitmatrix.hpp:37
constexpr auto operator-(const Point< LeftNumber, LeftLabel > &left, const Point< RightNumber, RightLabel > &right)
Translates a point by the opposite of another point.
Definition transformations.hpp:130
Shape(const std::variant< T, Ts... > &) -> Shape< detail::shape_point_type_t< T > >
PolygonWithHoles() -> PolygonWithHoles< Point<>, NoLabel >
Definition polygonwithholes.hpp:3093
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 Convex< PointType > convexHull() const
Returns the convex hull of the polygon's vertices.
Definition convex.hpp:521
The empty set of points in the plane.
Definition emptyshape.hpp:33
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
constexpr auto intersection(const OtherPolyline &other) const
Returns the intersection with an open polyline (A ∩ B), a sequence of points and segments sorted by l...
Definition intersection.hpp:3109
constexpr bool boundaryContains(const OtherSet &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polygonwithholes.hpp:2632
constexpr bool interiorsIntersect(const OtherSegment &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2419
constexpr auto squaredDistance(const OtherPolyline &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1977
constexpr const Rectangle< PointType > & bbox() const
Computes the bounding box of the region.
Definition polygonwithholes.hpp:1571
bool separates(const OtherDisk &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5600
bool separates(const OtherSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5473
constexpr bool intersects(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition intersects.hpp:2155
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherPolygon &other) const
Returns the regularized union of the two shapes (A ∪ B).
constexpr ResultNumber twiceArea() const
Computes twice the area of the region.
Definition polygonwithholes.hpp:577
constexpr auto distanceLInf(const OtherLine &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1500
constexpr auto distanceLInf(const OtherChain &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1581
constexpr bool contains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition polygonwithholes.hpp:2755
constexpr bool interiorContains(const OtherLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2287
constexpr PolygonSet< PointType > asPolygonSet() const
Returns the region as a one-component set of regions.
Definition polygonwithholes.hpp:386
constexpr bool contains(const OtherConvex &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3094
constexpr bool interiorsIntersect(const OtherPoint &) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition polygonwithholes.hpp:1660
constexpr bool interiorContainsInterior(const OtherSegment &other) const
Tests whether this shape's interior contains the segment's interior.
Definition interiorcontains.hpp:2258
constexpr bool contains(const OtherRay &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3004
constexpr auto distanceLInf(const OtherHalfplane &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1527
constexpr bool interiorContains(const OtherOrientedSegment &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2280
bool crosses(const OtherPolyline &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1250
constexpr auto distanceL1(const OtherChain &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1592
constexpr bool interiorContains(const OtherIntersection &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition interiorcontains.hpp:2420
bool separates(const OtherPolyline &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5591
Segment< PointType > EdgeType
Definition polygonwithholes.hpp:94
bool interiorsIntersect(const OtherConvex &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2655
constexpr auto squaredDistance(const OtherIntersection &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1989
bool crosses(const OtherConvex &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1226
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherTriangle &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr PolygonWithHoles rotated90(int k) const
Returns the region rotated by 90k degrees around the origin.
Definition polygonwithholes.hpp:2974
constexpr std::vector< 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.
constexpr bool isDegenerate() const
Tests whether the region has zero area.
Definition polygonwithholes.hpp:441
bool interiorsIntersect(const OtherRegion &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2667
constexpr PolygonWithHoles & operator-=(const Point< TranslationNumber, TranslationLabel > &translation)
Translates the region in place by the opposite vector.
Definition polygonwithholes.hpp:2940
constexpr bool boundaryContains(const OtherConvex &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1896
constexpr auto minkowskiSum(const OtherShape &other) const
Returns the Minkowski sum of this shape and another (A ⊕ B).
Definition minkowski.hpp:806
bool crosses(const OtherRay &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1198
constexpr void eraseHole(std::size_t index)
Erases the hole at the given index.
Definition polygonwithholes.hpp:246
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 polygonwithholes.hpp:2866
constexpr bool interiorContains(const OtherHalfplane &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2305
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherSet &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
detail::floating_result_t< ResultNumber > squaredDistance(const OtherDisk &other) const
Computes the squared Euclidean distance to a disk.
Definition distance.hpp:2002
constexpr bool interiorContains(const OtherSet &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition polygonwithholes.hpp:2643
bool crosses(const OtherChain &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1244
constexpr bool intersects(const OtherPolygon &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2135
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherRegion &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr auto squaredDistance(const OtherOrientedSegment &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1875
TLabel LabelType
Definition polygonwithholes.hpp:92
constexpr PolygonWithHoles(const PolygonWithHoles< OtherPointType, OtherLabelType > &other)
Converts a region with compatible vertex type.
Definition polygonwithholes.hpp:152
constexpr bool interiorsIntersect(const OtherShape &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition polygonwithholes.hpp:2685
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherSegment &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr const PolygonType & hole(std::size_t index) const
Definition polygonwithholes.hpp:196
bool isRegular() const
Tests whether the region is the closure of its own interior (A = closure(A°)).
Definition intersections.hpp:1230
constexpr auto distanceL1(const OtherRay &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1529
constexpr PolygonWithHoles & operator+=(const Point< TranslationNumber, TranslationLabel > &translation)
Translates the region in place.
Definition polygonwithholes.hpp:2929
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherRectangle &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
bool interiorsIntersect(const OtherDisk &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2701
constexpr void scaleUpY(const OtherNumber scalar)
Scales the region's y-coordinates up in place.
Definition polygonwithholes.hpp:3021
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedIntersection(const OtherPolygon &other) const
Returns the regularized intersection of the two shapes (A ∩ B).
constexpr bool boundaryContains(const OtherOrientedLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1843
constexpr std::vector< PointType > vertices() const
Returns the vertices of every ring, outer boundary first.
Definition polygonwithholes.hpp:306
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherPolygon &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr auto distanceLInf(const OtherTriangle &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1545
constexpr VertexIterator verticesBegin() const
Returns an iterator to the first vertex of the outer boundary.
Definition polygonwithholes.hpp:333
constexpr auto distanceLInf(const OtherConvex &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1554
constexpr auto regularizedIntersection(const OtherShape &other) const
Forwards a regularized intersection to the higher-ranked shape.
Definition polygonwithholes.hpp:2715
constexpr PolygonWithHoles scaledUpX(const OtherNumber scalar) const
Returns the region with its x-coordinates multiplied by scalar.
Definition polygonwithholes.hpp:3001
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherConvex &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr PolygonWithHoles scaledUpY(const OtherNumber scalar) const
Returns the region with its x-coordinates multiplied by scalar.
Definition polygonwithholes.hpp:3015
auto asBitMatrix() const
Rasterizes this region into a BitMatrix, one bit per covered cell.
Definition bitmatrix.hpp:2705
constexpr bool boundaryContains(const OtherSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1816
constexpr bool intersects(const OtherRectangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2113
constexpr auto distanceLInf(const OtherPoint &point) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1473
constexpr void scaleUpX(const OtherNumber scalar)
Scales the region's x-coordinates up in place.
Definition polygonwithholes.hpp:3007
constexpr auto area() const
Computes the area of the region.
Definition polygonwithholes.hpp:590
constexpr std::vector< 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.
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherPolyline &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr auto squaredDistance(const OtherLine &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1884
constexpr bool intersects(const OtherTriangle &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2123
std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Polyline< Point< ResultNumber, typename PointType::LabelType > >, PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherTriangle &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
typename PointType::NumberType NumberType
Definition polygonwithholes.hpp:91
friend struct PolygonWithHoles
Definition polygonwithholes.hpp:3314
auto symmetricDifference(const OtherSet &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
Definition polygonwithholes.hpp:1342
constexpr bool contains(const OtherLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2992
constexpr bool intersects(const OtherOrientedSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2049
bool crosses(const OtherRectangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1210
bool separates(const OtherRectangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5533
bool separates(const OtherTriangle &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5543
constexpr bool interiorContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition polygonwithholes.hpp:2761
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherRectangle &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr bool boundaryContains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition boundarycontains.hpp:1932
constexpr A & label() const
Returns the region label.
Definition polygonwithholes.hpp:170
constexpr auto distanceL1(const Shape< OtherPoint > &other) const
Returns the Manhattan (L1) distance to the given shape, using symmetry to re-dispatch through the wra...
Definition polygonwithholes.hpp:2911
constexpr auto verticesView() const
Returns a lazy view over the vertices of every ring, outer boundary first, without allocating a vecto...
Definition polygonwithholes.hpp:328
constexpr Point< ResultNumber > verticesCentroid() const
Computes the centroid of the vertex set over all rings.
Definition measures.hpp:1109
constexpr bool eraseHole(const PolygonType &hole)
Erases the hole equal to the given polygon, if the region has one.
Definition polygonwithholes.hpp:262
auto regularizedIntersection(const Shape< OtherPoint > &other) const
Re-dispatches a regularized intersection through a runtime shape.
Definition polygonwithholes.hpp:2849
bool crosses(const OtherIntersection &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1262
constexpr bool interiorsIntersect(const Shape< OtherPoint > &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2747
constexpr std::vector< OrientedSegment< PointType > > orientedEdges() const
Returns the boundary edges directed so the region lies to the left.
Definition polygonwithholes.hpp:364
constexpr bool intersects(const OtherShape &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition polygonwithholes.hpp:2672
std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Polyline< Point< ResultNumber, typename PointType::LabelType > >, PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherHalfplane &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Polyline< Point< ResultNumber, typename PointType::LabelType > >, PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherIntersection &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
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.
constexpr auto minkowskiErosion(const OtherShape &other) const
Returns the Minkowski erosion of this shape by another (A ⊖ B).
Definition minkowskierosion.hpp:639
constexpr auto squaredDistance(const OtherConvex &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1938
constexpr auto distanceL1(const OtherPolyline &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1601
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherRegion &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Polyline< Point< ResultNumber, typename PointType::LabelType > >, PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherRectangle &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
constexpr bool boundaryContains(const OtherTriangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1890
std::vector< PointType > clearlyVisibleVertices(const PointType &query) const
The region's vertices clearly visible from query.
Definition visibilitygraph.hpp:945
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularized() const
Returns the region without its slits (closure(A°)), as a set of regions.
std::vector< Point< ResultNumber, typename PointType::LabelType > > latticePoints() const
Returns the integer points the region contains.
Definition lattice.hpp:687
Point< ResultNumber > pointInside() const
Returns a point strictly inside the region.
Definition triangulation.hpp:6989
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 OtherConvex &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1565
constexpr bool interiorsIntersect(const OtherLine &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2439
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherRectangle &other) const
Returns the regularized Minkowski sum 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:2239
bool crosses(const OtherOrientedSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1180
bool crosses(const OtherRegion &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1238
constexpr std::vector< 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.
constexpr EmptyShape< EmptyPoint > intersection(const EmptyShape< EmptyPoint > &) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
Definition polygonwithholes.hpp:1291
std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Polyline< Point< ResultNumber, typename PointType::LabelType > >, PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherConvex &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
constexpr bool intersects(const OtherPoint &point) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition polygonwithholes.hpp:1649
constexpr bool interiorsIntersect(const EmptyShape< EmptyPoint > &) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition polygonwithholes.hpp:2779
constexpr bool interiorContains(const OtherRay &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2299
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherTriangle &other) const
Returns the regularized union of the two shapes (A ∪ B).
constexpr auto distanceL1(const OtherSegment &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1493
constexpr void scaleDownX(const OtherNumber scalar)
Scales the region's x-coordinates down in place.
Definition polygonwithholes.hpp:3035
constexpr bool isSegment() const
Tests whether the region covers exactly one segment of positive length.
Definition polygonwithholes.hpp:457
constexpr bool intersects(const OtherRay &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2075
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherRegion &other) const
Returns the regularized union of the two shapes (A ∪ B).
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherPolygon &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
constexpr auto squaredDistance(const OtherRectangle &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1920
constexpr Convex< PointType > convexHull() const
Returns the convex hull of the region's vertices.
Definition polygonwithholes.hpp:1561
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherConvex &other) const
Returns the regularized union of the two shapes (A ∪ B).
constexpr bool intersects(const EmptyShape< EmptyPoint > &) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition polygonwithholes.hpp:2773
constexpr bool contains(const OtherSet &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition polygonwithholes.hpp:2621
constexpr bool interiorContains(const OtherPoint &point) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2223
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherPolygon &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr PolygonWithHoles scaledDownX(const OtherNumber scalar) const
Returns the region with its x-coordinates multiplied by scalar.
Definition polygonwithholes.hpp:3029
constexpr bool contains(const OtherIntersection &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3197
constexpr auto cbegin() const
Returns a constant iterator to the first hole.
Definition polygonwithholes.hpp:210
constexpr void addHole(PolygonType hole)
Adds a hole, keeping the canonical order.
Definition polygonwithholes.hpp:227
Graph< PointType > reducedVisibilityGraph() const
Returns the reduced visibility graph of the region's vertices.
Definition visibilitygraph.hpp:932
bool crosses(const OtherPolygon &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1232
constexpr bool boundaryContains(const OtherOrientedSegment &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1829
constexpr auto operator<=>(const PolygonWithHoles &other) const
Compares two regions by outer boundary, then by canonical hole list.
Definition polygonwithholes.hpp:394
constexpr bool crosses(const Shape< OtherPoint > &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1272
bool crosses(const OtherDisk &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1256
constexpr bool boundaryContains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition boundarycontains.hpp:1923
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedIntersection(const OtherRegion &other) const
Returns the regularized intersection of the two shapes (A ∩ B).
constexpr bool intersects(const OtherConvex &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2129
constexpr auto end() const
Returns a constant iterator past the last hole.
Definition polygonwithholes.hpp:213
constexpr auto distanceLInf(const OtherRegion &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1572
Graph< PointType > visibilityGraph() const
Returns the visibility graph of the region's vertices.
Definition visibilitygraph.hpp:919
constexpr bool contains(const OtherSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2961
constexpr bool boundaryContains(const OtherPoint &point) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1802
constexpr auto squaredDistance(const OtherPolygon &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1947
constexpr bool intersects(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition intersects.hpp:2149
constexpr bool boundaryContains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition boundarycontains.hpp:1916
constexpr bool contains(const OtherHalfplane &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3010
constexpr auto begin() const
Returns a constant iterator to the first hole.
Definition polygonwithholes.hpp:207
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedIntersection(const OtherRectangle &other) const
Returns the regularized intersection of the two shapes (A ∩ B).
constexpr auto distanceL1(const OtherOrientedLine &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1520
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherTriangle &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
std::vector< PointType > visibleVertices(const PointType &query) const
The region's vertices visible from query.
Definition visibilitygraph.hpp:938
bool separates(const OtherOrientedSegment &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5485
constexpr Point< ResultNumber > centroid() const
Computes the area-weighted centroid of the region.
Definition measures.hpp:1131
constexpr bool boundaryContains(const OtherPolygon &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1902
constexpr PolygonWithHoles()=default
Creates the empty region (a vertexless outer polygon, no holes).
constexpr bool crosses(const EmptyShape< EmptyPoint > &) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition polygonwithholes.hpp:2791
constexpr bool interiorContains(const Shape< OtherPoint > &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2563
constexpr std::vector< 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.
constexpr bool boundaryContains(const OtherRay &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1849
constexpr const PolygonType & outer() const
Definition polygonwithholes.hpp:178
constexpr bool contains(const OtherOrientedLine &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2998
constexpr bool contains(const OtherPoint &point) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2945
constexpr bool boundaryContains(const OtherLine &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1837
constexpr bool interiorsIntersect(const OtherHalfplane &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2478
constexpr auto distanceL1(const OtherRegion &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1583
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherIntersection &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr VertexIterator verticesEnd() const
Returns an iterator past the last vertex of the last hole.
Definition polygonwithholes.hpp:338
constexpr bool intersects(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition intersects.hpp:2165
constexpr bool operator==(const PolygonWithHoles &other) const
Checks equality of two regions.
Definition polygonwithholes.hpp:410
constexpr auto squaredDistance(const OtherRegion &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1959
constexpr std::size_t holeCount() const
Returns the number of holes.
Definition polygonwithholes.hpp:183
constexpr bool interiorContains(const OtherPolygon &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2372
constexpr auto squaredDistance(const OtherRay &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1902
constexpr bool interiorsIntersect(const OtherPolyline &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2685
constexpr bool samePointSet(const OtherShape &other) const
Tests whether another shape defines exactly the same point set.
Definition samepointset.hpp:2031
constexpr bool contains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3161
constexpr auto distanceLInf(const OtherShape &other) const
Computes the squared Euclidean distance to the other shape.
Definition polygonwithholes.hpp:2745
constexpr auto cend() const
Returns a constant iterator past the last hole.
Definition polygonwithholes.hpp:216
constexpr bool contains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3146
constexpr bool intersects(const OtherLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2060
constexpr bool interiorsIntersect(const OtherRay &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2463
constexpr bool contains(const OtherRectangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3077
auto intersection(const OtherShape &other) const
Forwards an intersection to the higher-ranked shape.
Definition polygonwithholes.hpp:2704
bool pointInsideInteriorContainedIn(const OtherShape &shape) const
Tests whether some point in this shape's relative interior lies in the strict interior of shape.
Definition triangulation.hpp:7024
constexpr bool intersects(const OtherOrientedLine &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2069
bool separates(const OtherIntersection &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5612
constexpr auto distanceL1(const OtherTriangle &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1556
std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Polyline< Point< ResultNumber, typename PointType::LabelType > >, PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherRegion &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherChain &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
bool separates(const OtherSet &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5990
constexpr auto closestPoints(const OtherShape &other) const
Returns the pair of points realizing the distance, nothing when the shapes meet.
Definition closest.hpp:433
bool interiorsIntersect(const OtherTriangle &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2649
constexpr bool crosses(const OtherShape &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition polygonwithholes.hpp:2693
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedIntersection(const OtherTriangle &other) const
Returns the regularized intersection of the two shapes (A ∩ B).
constexpr bool interiorContains(const OtherOrientedLine &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2293
bool isValid() const
Tests the structural contract: every ring simple, every hole inside the outer boundary,...
Definition intersections.hpp:1189
constexpr bool contains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3140
constexpr auto distanceL1(const OtherOrientedSegment &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1502
constexpr bool separates(const EmptyShape< EmptyPoint > &) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition polygonwithholes.hpp:2785
constexpr bool interiorContains(const OtherRectangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2349
constexpr Segment< PointType > diameter() const
Returns a segment realizing the diameter (the farthest vertex pair).
Definition polygonwithholes.hpp:1551
auto difference(const Shape< OtherPoint > &other) const
Returns the regularized set difference of the two shapes (A ∖ B), re-dispatching through the wrapper'...
Definition polygonwithholes.hpp:2885
constexpr bool boundaryContains(const OtherHalfplane &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1855
constexpr auto distanceL1(const OtherPoint &point) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1484
bool crosses(const OtherHalfplane &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1204
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedIntersection(const OtherHalfplane &other) const
Returns the regularized intersection of the two shapes (A ∩ B).
bool separates(const OtherRay &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5509
bool crosses(const OtherOrientedLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1192
constexpr auto squaredDistance(const OtherSegment &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1866
bool separates(const OtherLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5491
constexpr bool interiorContains(const OtherPolyline &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition interiorcontains.hpp:2393
constexpr auto squaredDistance(const OtherTriangle &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1929
constexpr bool interiorContains(const OtherDisk &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition interiorcontains.hpp:2403
constexpr auto distanceLInf(const Shape< OtherPoint > &other) const
Returns the Chebyshev (L∞) distance to the given shape, using symmetry to re-dispatch through the wra...
Definition polygonwithholes.hpp:2920
constexpr bool boundaryContains(const OtherRegion &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1908
constexpr auto squaredDistance(const OtherPoint &point) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1857
constexpr auto distanceLInf(const OtherPolyline &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1590
bool separates(const OtherChain &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5582
constexpr bool separates(const Shape< OtherPoint > &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5789
constexpr bool contains(const OtherTriangle &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3088
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedIntersection(const OtherIntersection &other) const
Returns the regularized intersection of the two shapes (A ∩ B).
Polygon< PointType > PolygonType
Definition polygonwithholes.hpp:93
constexpr bool interiorContains(const OtherConvex &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2366
constexpr bool interiorsIntersect(const OtherChain &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2679
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedIntersection(const OtherConvex &other) const
Returns the regularized intersection of the two shapes (A ∩ B).
std::vector< std::variant< Point< ResultNumber, typename PointType::LabelType >, Polyline< Point< ResultNumber, typename PointType::LabelType > >, PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > > > intersection(const OtherPolygon &other) const
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
constexpr bool intersects(const OtherHalfplane &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2084
constexpr bool intersects(const OtherRegion &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2141
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion(const OtherRectangle &other) const
Returns the regularized union of the two shapes (A ∪ B).
bool interiorsIntersect(const OtherPolygon &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2661
constexpr auto distanceLInf(const OtherPolygon &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1563
bool separates(const OtherHalfplane &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5521
constexpr auto distanceL1(const OtherIntersection &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1610
constexpr bool empty() const
Tests whether the region has no outer boundary at all.
Definition polygonwithholes.hpp:430
constexpr auto distanceLInf(const OtherRectangle &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1536
auto regularizedUnion(const OtherSet &other) const
Returns the regularized union of the two shapes (A ∪ B).
Definition polygonwithholes.hpp:971
bool crosses(const OtherLine &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1186
Graph< PointType > clearVisibilityGraph() const
Returns the clear visibility graph of the region's vertices.
Definition visibilitygraph.hpp:926
constexpr bool isUndefined() const
Tests whether the region is degenerate without covering a point or a segment (which includes the empt...
Definition polygonwithholes.hpp:465
constexpr auto distanceLInf(const OtherIntersection &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1599
PointType PointType
Definition polygonwithholes.hpp:90
bool crosses(const OtherPoint &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1168
constexpr auto distanceLInf(const OtherOrientedLine &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1509
constexpr PolygonWithHoles scaledDownY(const OtherNumber scalar) const
Returns the region with its x-coordinates multiplied by scalar.
Definition polygonwithholes.hpp:3043
constexpr bool boundaryContains(const Shape< OtherPoint > &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:2083
constexpr auto distanceL1(const OtherLine &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1511
constexpr auto distanceLInf(const OtherRay &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1518
constexpr auto squaredDistance(const OtherOrientedLine &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1893
constexpr bool contains(const OtherPolygon &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3100
bool separates(const OtherPolygon &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5555
bool separates(const OtherRegion &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5567
constexpr auto distanceLInf(const OtherSegment &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1482
constexpr bool interiorContains(const OtherTriangle &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2360
bool isSimple() const
Tests whether every ring is simple.
Definition polygonwithholes.hpp:478
constexpr std::vector< 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.
constexpr auto distanceL1(const OtherPolygon &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1574
constexpr auto distanceL1(const OtherHalfplane &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1538
constexpr bool intersects(const OtherIntersection &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition intersects.hpp:2188
auto triangulation(const SegmentRange &segments) const
Builds the constrained Delaunay triangulation of this region with the given interior constraint segme...
Definition triangulation.hpp:6946
constexpr std::size_t chainCount() const
Total number of maximal lexicographically monotone chains over all rings; see Polygon::chainCount.
Definition polygonwithholes.hpp:297
constexpr bool intersects(const Shape< OtherPoint > &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2217
std::vector< Convex< PointType > > convexPartition() const
Cuts this region into convex pieces with disjoint interiors.
Definition triangulation.hpp:6935
bool interiorsIntersect(const OtherIntersection &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2724
bool interiorsIntersect(const OtherRectangle &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2639
std::vector< Convex< PointType > > convexCovering() const
Covers this region with a greedily selected set of convex polygons.
Definition triangulation.hpp:6940
bool crosses(const OtherTriangle &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1220
constexpr void rotate90(int k)
Rotates the region by 90k degrees around the origin in place.
Definition polygonwithholes.hpp:2986
constexpr bool boundaryContains(const EmptyShape< EmptyPoint > &) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition polygonwithholes.hpp:2767
constexpr auto distanceLInf(const OtherOrientedSegment &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancelinf.hpp:1491
constexpr auto closestSegments(const OtherShape &other) const
Returns the pair of elements realizing the distance, nothing when the shapes meet.
Definition closest.hpp:426
constexpr auto squaredDistance(const OtherHalfplane &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1911
constexpr void scaleDownY(const OtherNumber scalar)
Scales the region's y-coordinates down in place.
Definition polygonwithholes.hpp:3049
constexpr bool interiorContains(const OtherRegion &other) const
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Definition interiorcontains.hpp:2378
constexpr const std::vector< PolygonType > & holes() const
Definition polygonwithholes.hpp:202
constexpr std::vector< EdgeType > edges() const
Returns the boundary edges of every ring, outer boundary first.
Definition polygonwithholes.hpp:343
constexpr auto squaredDistance(const OtherChain &other) const
Computes the squared Euclidean distance to the other shape.
Definition distance.hpp:1968
constexpr bool isPoint() const
Tests whether the region covers exactly one point.
Definition polygonwithholes.hpp:452
constexpr bool interiorContains(const OtherChain &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition interiorcontains.hpp:2386
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > minkowskiErosion(const OtherShape &other) const
Returns the regularized Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B),...
Definition minkowskierosion.hpp:722
auto symmetricDifference(const Shape< OtherPoint > &other) const
Returns the regularized symmetric difference of the two shapes (A △ B), re-dispatching through the wr...
Definition polygonwithholes.hpp:2902
constexpr auto distanceL1(const OtherShape &other) const
Computes the squared Euclidean distance to the other shape.
Definition polygonwithholes.hpp:2735
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherTriangle &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
constexpr PolygonWithHoles(PolygonType outer)
Creates a hole-free region from its outer boundary.
Definition polygonwithholes.hpp:109
constexpr Rectangle< Point< ResultNumber > > fbox() const
Computes the floating-point bounding box of the region.
Definition polygonwithholes.hpp:1600
constexpr PolygonWithHoles(PolygonType outer, HoleRange &&holes, bool trusted=false)
Creates a region from an outer boundary and a range of holes.
Definition polygonwithholes.hpp:129
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference(const OtherConvex &other) const
Returns the regularized set difference of the two shapes (A ∖ B).
constexpr auto intersection(const OtherChain &other) const
Returns the intersection with a monotone chain (A ∩ B), a sequence of points and segments sorted by l...
Definition intersection.hpp:3115
constexpr bool contains(const Shape< OtherPoint > &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3350
constexpr bool boundaryContains(const OtherRectangle &other) const
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
Definition boundarycontains.hpp:1879
constexpr bool interiorsIntersect(const OtherOrientedLine &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2457
constexpr bool intersects(const OtherSegment &other) const
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
Definition intersects.hpp:2028
constexpr auto squaredDistance(const OtherShape &other) const
Computes the squared Euclidean distance to the other shape.
Definition polygonwithholes.hpp:2725
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 polygonwithholes.hpp:2843
constexpr bool hasHoles() const
Tests whether the region has at least one hole.
Definition polygonwithholes.hpp:188
auto triangulation() const
Builds the constrained Delaunay triangulation of this region.
Definition triangulation.hpp:6930
constexpr auto distanceL1(const OtherRectangle &other) const
Computes the squared Euclidean distance to the other shape.
Definition distancel1.hpp:1547
constexpr bool contains(const OtherRegion &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:3106
bool separates(const OtherPoint &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5467
constexpr bool interiorsIntersect(const OtherOrientedSegment &other) const
Tests whether the interiors of the shapes intersect (A° ∩ B° ≠ ∅).
Definition interiorsintersect.hpp:2433
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference(const OtherRegion &other) const
Returns the regularized symmetric difference of the two shapes (A △ B).
bool separates(const OtherOrientedLine &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5503
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherSet &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B), as a set of regions.
constexpr bool boundaryContains(const OtherIntersection &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition boundarycontains.hpp:1941
bool separates(const OtherConvex &other) const
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
Definition separates.hpp:5549
Polygon< Point< ResultNumber > > regularizedVisiblePolygon(const PointType &query) const
The part of the region visible from query, regularized.
Definition visibilitygraph.hpp:954
constexpr bool contains(const OtherOrientedSegment &other) const
Tests whether this shape contains the other shape (A ⊇ B).
Definition contains.hpp:2984
constexpr std::size_t vertexCount() const
Returns the total number of vertices over all rings.
Definition polygonwithholes.hpp:279
PolygonWithHoles< Point< ResultNumber, typename PointType::LabelType > > minkowskiSum(const OtherConvex &other) const
Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
bool crosses(const OtherSegment &other) const
Tests whether the two shapes mutually separate each other (each disconnects the other).
Definition crosses.hpp:1174
Closed simple polygon stored by its vertices.
Definition polygon.hpp:59
constexpr Polygon scaledUpY(const OtherNumber scalar) const
Returns the polygon with its y-coordinates multiplied by a factor.
constexpr Polygon scaledDownY(const OtherNumber scalar) const
Returns the polygon with its y-coordinates divided by a divisor.
constexpr Polygon scaledUpX(const OtherNumber scalar) const
Returns the polygon with its x-coordinates multiplied by a factor.
constexpr Polygon rotated90(int k=1) const
Returns the polygon rotated by 90k degrees around the origin.
Definition transformations.hpp:1714
constexpr Polygon scaledDownX(const OtherNumber scalar) const
Returns the polygon with its x-coordinates divided by a divisor.
constexpr bool isDegenerate() const
Checks if the polygon is degenerate (has zero area).
Definition polygon.hpp:319
Open polygonal chain stored in traversal order; may self-intersect.
Definition polyline.hpp:69
Axis-aligned rectangle stored by minimum and maximum corners.
Definition rectangle.hpp:75
constexpr Rectangle bbox() const
Returns the bounding box of the rectangle.
Definition bounding.hpp:140
Unoriented closed segment between two endpoints plus optional segment label.
Definition segment.hpp:58
constexpr Segment diameter() const
Returns a segment defining the diameter.
Definition measures.hpp:73
Runtime variant wrapper over the supported primitive shapes.
Definition shape.hpp:160