![]() |
Pangolin
Header-only C++20 plane computational geometry library
|
Closed Euclidean disk stored by boundary points plus optional disk label. More...
#include <disk.hpp>
Classes | |
| class | PointIterator |
| Forward iterator over the three boundary points. More... | |
Public Types | |
| using | PointType = PointType_ |
| using | NumberType = PointType::NumberType |
| using | PointLabelType = PointType::LabelType |
| using | LabelType = TLabel |
Public Member Functions | |
| constexpr | Disk ()=default |
| Creates a disk with all three boundary points at the origin. | |
| constexpr | Disk (PointType first, PointType second, PointType third) |
| Creates the disk through three boundary points. | |
| template<class A> requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>) && PointConcept<PointType> | |
| constexpr | Disk (PointType first, PointType second, PointType third, A &&label) |
| Creates a disk from three boundary points and stores a label. | |
| constexpr | Disk (PointType center, NumberType radius) |
| Creates a disk from its center and radius. | |
| template<class A> requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>) && PointConcept<PointType> | |
| constexpr | Disk (PointType center, NumberType radius, A &&label) |
| Same as above, and stores a disk label. | |
| constexpr | Disk (NumberType x, NumberType y, NumberType radius) |
| Creates a disk from center coordinates and a radius. | |
| template<class A> requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>) | |
| constexpr | Disk (NumberType x, NumberType y, NumberType radius, A &&label) |
| Same as above, and stores a disk label. | |
| template<PointConcept OtherPointType, class OtherLabelType> requires (std::constructible_from<PointType, const OtherPointType&>) | |
| constexpr | Disk (const Disk< OtherPointType, OtherLabelType > &other) |
| Converts a disk with a different point and/or label type. | |
| template<PointConcept OtherPointType, class OtherLabelType> requires (std::constructible_from<PointType, const OtherPointType&>) | |
| constexpr Disk & | operator= (const Disk< OtherPointType, OtherLabelType > &other) |
| Assigns from a disk with compatible point and label types. | |
| template<class A = LabelType> requires (detail::has_label_v<A>) | |
| constexpr A & | label () const |
| Returns the disk label. | |
| constexpr const PointType & | operator[] (std::size_t index) const |
Returns boundary point index in canonical order. | |
| constexpr const PointType & | get (std::ptrdiff_t index) const |
| Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the end. | |
| constexpr std::ptrdiff_t | index (const PointType &point) const |
| Returns the smallest index i with (*this)[i] == point, or -1 if no boundary point equals point. | |
| constexpr const PointType & | a () const |
| Returns the first boundary point (lexicographically smallest). | |
| constexpr const PointType & | b () const |
| Returns the second boundary point in canonical order. | |
| constexpr const PointType & | c () const |
| Returns the third boundary point in canonical order. | |
| constexpr auto | begin () const |
| Returns an iterator to the first boundary point. | |
| constexpr auto | cbegin () const |
| Returns a const iterator to the first boundary point. | |
| constexpr auto | end () const |
| Returns an iterator past the last boundary point. | |
| constexpr auto | cend () const |
| Returns a const iterator past the last boundary point. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr Point< ResultNumber, PointLabelType > | center () const |
| Returns the center (circumcenter of the three boundary points) in an explicitly chosen coordinate type. | |
| template<class ResultNumber = double> | |
| constexpr ResultNumber | radius () const |
| Returns the radius. | |
| constexpr bool | isDegenerate () const |
| Returns whether the three boundary points are collinear. | |
| constexpr bool | isPoint () const |
| Returns whether the disk collapses to a single point. | |
| constexpr std::optional< PointType > | getIfPoint () const |
| Returns the point the disk collapses to, if it does. | |
| constexpr bool | isUndefined () const |
| Returns whether the disk is degenerate without collapsing to a point. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr ResultNumber | squaredRadius () const |
| Returns the squared radius in an explicitly chosen result type. | |
| template<std::floating_point ResultNumber = double> | |
| constexpr ResultNumber | area () const |
| Returns the area pi * R^2 of the closed disk. | |
| constexpr Rectangle< PointType > | bbox () const |
| Returns an axis-aligned bounding box in the coordinate type. | |
| template<class ResultNumber = grid_number_t<typename PointType_::NumberType>> requires (detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>) | |
| std::vector< Point< ResultNumber, typename PointType::LabelType > > | latticePoints () const |
| Returns the integer points the disk contains. | |
| template<std::floating_point ResultNumber = double> | |
| constexpr Rectangle< Point< ResultNumber > > | fbox () const |
| Returns a floating-point bounding box of the disk. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr Point< ResultNumber, PointLabelType > | pointInside () const |
| Returns the midpoint of the first two boundary points. | |
| template<class ResultNumber = division_result_t<NumberType>> | |
| constexpr Segment< Point< ResultNumber, PointLabelType > > | diameter () const |
| Returns a segment defining a diameter of the disk. | |
| template<class ResultNumber = double, PointConcept OtherPoint> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherPoint &point) const |
| Returns the squared Euclidean distance from this disk to a point. | |
| template<class ResultNumber = double, SegmentConcept OtherSegment> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherSegment &other) const |
| Returns the squared Euclidean distance from this disk to a shape. | |
| template<class ResultNumber = double, OrientedSegmentConcept OtherOrientedSegment> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherOrientedSegment &other) const |
| Returns the squared Euclidean distance from this disk to a shape. | |
| template<class ResultNumber = double, LineConcept OtherLine> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherLine &other) const |
| Returns the squared Euclidean distance from this disk to a shape. | |
| template<class ResultNumber = double, OrientedLineConcept OtherOrientedLine> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherOrientedLine &other) const |
| Returns the squared Euclidean distance from this disk to a shape. | |
| template<class ResultNumber = double, RayConcept OtherRay> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherRay &other) const |
| Returns the squared Euclidean distance from this disk to a shape. | |
| template<class ResultNumber = double, HalfplaneConcept OtherHalfplane> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherHalfplane &other) const |
| Returns the squared Euclidean distance from this disk to a shape. | |
| template<class ResultNumber = double, RectangleConcept OtherRectangle> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherRectangle &other) const |
| Returns the squared Euclidean distance from this disk to a shape. | |
| template<class ResultNumber = double, TriangleConcept OtherTriangle> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherTriangle &other) const |
| Returns the squared Euclidean distance from this disk to a shape. | |
| template<class ResultNumber = double, DiskConcept OtherDisk> | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherDisk &other) const |
| Returns the squared Euclidean distance between two disks. | |
| template<class ResultNumber = double, typename OtherShape> requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Disk> && requires(const OtherShape& o, const Disk& self) { o.squaredDistance(self); }) | |
| detail::floating_result_t< ResultNumber > | squaredDistance (const OtherShape &other) const |
| Returns the squared Euclidean distance to the given shape. | |
| template<class ResultNumber = double, PointConcept OtherPoint> | |
| detail::floating_result_t< ResultNumber > | distanceL1 (const OtherPoint &point) const |
| Returns the Manhattan (L1) distance from this disk to a point. | |
| template<class ResultNumber = double, PointConcept OtherPoint> | |
| detail::floating_result_t< ResultNumber > | distanceLInf (const OtherPoint &point) const |
| Returns the Chebyshev (LInf) distance from this disk to a point. | |
| template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint> | |
| constexpr auto | intersection (const Shape< OtherPoint > &other) const |
| Returns the intersection of the two shapes (A ∩ B), re-dispatching through the wrapper's own intersection. | |
| template<class ResultNumber = double, PointConcept OtherPoint> | |
| detail::floating_result_t< ResultNumber > | distanceL1 (const Shape< OtherPoint > &other) const |
| Returns the Manhattan (L1) distance to the given shape. | |
| template<class ResultNumber = double, PointConcept OtherPoint> | |
| detail::floating_result_t< ResultNumber > | distanceLInf (const Shape< OtherPoint > &other) const |
| Returns the Manhattan (L1) distance to the given shape. | |
| template<PointConcept OtherPoint> | |
| constexpr bool | contains (const OtherPoint &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<class ResultNumber = NumberType, PointConcept OtherPoint> | |
| 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. | |
| template<class ResultNumber = NumberType, class EmptyPoint> | |
| constexpr EmptyShape< EmptyPoint > | intersection (const EmptyShape< EmptyPoint > &) const |
| Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint. | |
| template<SegmentConcept OtherSegment> | |
| constexpr bool | contains (const OtherSegment &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<OrientedSegmentConcept OtherOrientedSegment> | |
| constexpr bool | contains (const OtherOrientedSegment &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<LineConcept OtherLine> | |
| constexpr bool | contains (const OtherLine &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | contains (const OtherOrientedLine &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<RayConcept OtherRay> | |
| constexpr bool | contains (const OtherRay &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | contains (const OtherHalfplane &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | contains (const OtherTriangle &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | contains (const OtherRectangle &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<ConvexConcept OtherConvex> | |
| constexpr bool | contains (const OtherConvex &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<PolygonConcept OtherPolygon> | |
| constexpr bool | contains (const OtherPolygon &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | contains (const OtherDisk &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| constexpr bool | contains (const Shape< PointType > &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<class EmptyPoint> | |
| constexpr bool | contains (const EmptyShape< EmptyPoint > &) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<class EmptyPoint> | |
| constexpr bool | boundaryContains (const EmptyShape< EmptyPoint > &) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<class EmptyPoint> | |
| constexpr bool | interiorContains (const EmptyShape< EmptyPoint > &) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | interiorContains (const OtherPoint &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<SegmentConcept OtherSegment> | |
| constexpr bool | interiorContains (const OtherSegment &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<OrientedSegmentConcept OtherOrientedSegment> | |
| constexpr bool | interiorContains (const OtherOrientedSegment &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<LineConcept OtherLine> | |
| constexpr bool | interiorContains (const OtherLine &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | interiorContains (const OtherOrientedLine &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<RayConcept OtherRay> | |
| constexpr bool | interiorContains (const OtherRay &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | interiorContains (const OtherHalfplane &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | interiorContains (const OtherTriangle &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | interiorContains (const OtherRectangle &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<ConvexConcept OtherConvex> | |
| constexpr bool | interiorContains (const OtherConvex &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | interiorContains (const OtherDisk &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<SegmentConcept OtherSegment> | |
| constexpr bool | intersects (const OtherSegment &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | intersects (const OtherDisk &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | boundaryContains (const OtherPoint &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<SegmentConcept OtherSegment> | |
| constexpr bool | boundaryContains (const OtherSegment &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<OrientedSegmentConcept OtherOrientedSegment> | |
| constexpr bool | boundaryContains (const OtherOrientedSegment &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<LineConcept OtherLine> | |
| constexpr bool | boundaryContains (const OtherLine &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | boundaryContains (const OtherOrientedLine &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<RayConcept OtherRay> | |
| constexpr bool | boundaryContains (const OtherRay &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | boundaryContains (const OtherHalfplane &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | boundaryContains (const OtherTriangle &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | boundaryContains (const OtherRectangle &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<ConvexConcept OtherConvex> | |
| constexpr bool | boundaryContains (const OtherConvex &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<PolygonConcept OtherPolygon> | |
| constexpr bool | boundaryContains (const OtherPolygon &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | boundaryContains (const OtherDisk &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| constexpr bool | boundaryContains (const Shape< PointType > &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<PolygonConcept OtherPolygon> | |
| constexpr bool | interiorContains (const OtherPolygon &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<PolygonConcept OtherPolygon> | |
| constexpr bool | separates (const OtherPolygon &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<MonotoneChainConcept OtherChain> | |
| constexpr bool | contains (const OtherChain &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<MonotoneChainConcept OtherChain> | |
| constexpr bool | boundaryContains (const OtherChain &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<MonotoneChainConcept OtherChain> | |
| constexpr bool | interiorContains (const OtherChain &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<MonotoneChainConcept OtherChain> | |
| constexpr bool | separates (const OtherChain &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<PolylineConcept OtherPolyline> | |
| constexpr bool | contains (const OtherPolyline &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<PolylineConcept OtherPolyline> | |
| constexpr bool | boundaryContains (const OtherPolyline &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<PolylineConcept OtherPolyline> | |
| constexpr bool | interiorContains (const OtherPolyline &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<PolylineConcept OtherPolyline> | |
| constexpr bool | separates (const OtherPolyline &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<HalfplaneIntersectionConcept OtherRegion> | |
| constexpr bool | contains (const OtherRegion &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<HalfplaneIntersectionConcept OtherRegion> | |
| constexpr bool | boundaryContains (const OtherRegion &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<HalfplaneIntersectionConcept OtherRegion> | |
| constexpr bool | interiorContains (const OtherRegion &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<HalfplaneIntersectionConcept OtherRegion> | |
| constexpr bool | separates (const OtherRegion &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<PolygonWithHolesConcept OtherRegion> | |
| constexpr bool | contains (const OtherRegion &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<PolygonWithHolesConcept OtherRegion> | |
| constexpr bool | boundaryContains (const OtherRegion &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<PolygonWithHolesConcept OtherRegion> | |
| constexpr bool | interiorContains (const OtherRegion &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<PolygonWithHolesConcept OtherRegion> | |
| bool | separates (const OtherRegion &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<PolygonSetConcept OtherSet> | |
| constexpr bool | contains (const OtherSet &other) const |
| Tests whether this shape contains the other shape (A ⊇ B). | |
| template<PolygonSetConcept OtherSet> | |
| constexpr bool | boundaryContains (const OtherSet &other) const |
| Tests whether this shape's boundary contains the other shape (∂A ⊇ B). | |
| template<PolygonSetConcept OtherSet> | |
| constexpr bool | interiorContains (const OtherSet &other) const |
| Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B). | |
| template<PolygonSetConcept OtherSet> | |
| bool | separates (const OtherSet &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | separates (const OtherPoint &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<SegmentConcept OtherSegment> | |
| constexpr bool | separates (const OtherSegment &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<OrientedSegmentConcept OtherOrientedSegment> | |
| constexpr bool | separates (const OtherOrientedSegment &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<LineConcept OtherLine> | |
| constexpr bool | separates (const OtherLine &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | separates (const OtherOrientedLine &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<ConvexConcept OtherConvex> | |
| constexpr bool | separates (const OtherConvex &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<RayConcept OtherRay> | |
| constexpr bool | separates (const OtherRay &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | separates (const OtherHalfplane &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | separates (const OtherRectangle &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | separates (const OtherTriangle &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | separates (const OtherDisk &other) const |
| Tests whether removing this shape disconnects the other shape (B∖A is disconnected). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | intersects (const OtherPoint &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<OrientedSegmentConcept OtherOrientedSegment> | |
| constexpr bool | intersects (const OtherOrientedSegment &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<LineConcept OtherLine> | |
| constexpr bool | intersects (const OtherLine &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | intersects (const OtherOrientedLine &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<RayConcept OtherRay> | |
| constexpr bool | intersects (const OtherRay &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | intersects (const OtherHalfplane &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | intersects (const OtherRectangle &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | intersects (const OtherTriangle &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | interiorsIntersect (const OtherPoint &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<SegmentConcept OtherSegment> | |
| constexpr bool | interiorsIntersect (const OtherSegment &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<OrientedSegmentConcept OtherOrientedSegment> | |
| constexpr bool | interiorsIntersect (const OtherOrientedSegment &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<LineConcept OtherLine> | |
| constexpr bool | interiorsIntersect (const OtherLine &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | interiorsIntersect (const OtherOrientedLine &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<RayConcept OtherRay> | |
| constexpr bool | interiorsIntersect (const OtherRay &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | interiorsIntersect (const OtherHalfplane &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | interiorsIntersect (const OtherRectangle &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | interiorsIntersect (const OtherTriangle &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | interiorsIntersect (const OtherDisk &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | crosses (const OtherPoint &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<SegmentConcept OtherSegment> | |
| constexpr bool | crosses (const OtherSegment &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<OrientedSegmentConcept OtherOrientedSegment> | |
| constexpr bool | crosses (const OtherOrientedSegment &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<LineConcept OtherLine> | |
| constexpr bool | crosses (const OtherLine &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<OrientedLineConcept OtherOrientedLine> | |
| constexpr bool | crosses (const OtherOrientedLine &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<RayConcept OtherRay> | |
| constexpr bool | crosses (const OtherRay &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<HalfplaneConcept OtherHalfplane> | |
| constexpr bool | crosses (const OtherHalfplane &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<RectangleConcept OtherRectangle> | |
| constexpr bool | crosses (const OtherRectangle &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<TriangleConcept OtherTriangle> | |
| constexpr bool | crosses (const OtherTriangle &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<DiskConcept OtherDisk> | |
| constexpr bool | crosses (const OtherDisk &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | intersects (const Shape< OtherPoint > &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | interiorsIntersect (const Shape< OtherPoint > &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<PointConcept OtherPoint> | |
| constexpr bool | crosses (const Shape< OtherPoint > &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<typename OtherShape> requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Disk>) | |
| constexpr bool | intersects (const OtherShape &other) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<class EmptyPoint> | |
| constexpr bool | intersects (const EmptyShape< EmptyPoint > &) const |
| Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅). | |
| template<typename OtherShape> requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Disk>) | |
| constexpr bool | interiorsIntersect (const OtherShape &other) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<class EmptyPoint> | |
| constexpr bool | interiorsIntersect (const EmptyShape< EmptyPoint > &) const |
| Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅). | |
| template<typename OtherShape> requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Disk>) | |
| constexpr bool | crosses (const OtherShape &other) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<class EmptyPoint> | |
| constexpr bool | crosses (const EmptyShape< EmptyPoint > &) const |
| Tests whether the two shapes mutually separate each other (each disconnects the other). | |
| template<class Scalar> requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>) | |
| constexpr Disk & | operator/= (const Scalar &scalar) |
Divides every boundary point by scalar in place. | |
| constexpr bool | operator== (const Disk &other) const |
| Returns whether two disks describe the same closed region. | |
| template<AnyShapeConcept OtherShape> | |
| constexpr bool | samePointSet (const OtherShape &other) const |
| Tests whether another shape defines exactly the same point set. | |
| constexpr std::partial_ordering | operator<=> (const Disk &other) const |
| Orders disks by increasing squared radius, then by center. | |
| constexpr Disk | rotated90 (int k=1) const |
| Returns the disk rotated by 90k degrees around the origin. | |
| constexpr void | rotate90 (int k=1) |
| Rotates the disk by 90k degrees around the origin in place. | |
| template<class OtherShape> requires MinkowskiSummableConcept<Disk<PointType_, TLabel>, OtherShape> | |
| constexpr auto | minkowskiSum (const OtherShape &other) const |
| Returns the Minkowski sum of this shape and another (A ⊕ B). | |
| template<class OtherShape> requires MinkowskiSummableConcept<Disk<PointType_, TLabel>, OtherShape> | |
| constexpr auto | minkowskiErosion (const OtherShape &other) const |
| Returns the Minkowski erosion of this shape by another (A ⊖ B). | |
| template<class ResultNumber = double, DiskConcept OtherDisk> | |
| std::optional< Disk< Point< ResultNumber, PointLabelType > > > | minkowskiErosion (const OtherDisk &other) const |
| Returns the Minkowski erosion of this disk by another (A ⊖ B), a disk when there is one. | |
| template<class ResultNumber = double, HalfplaneConcept OtherHalfplane> | |
| EmptyShape< Point< ResultNumber, PointLabelType > > | minkowskiErosion (const OtherHalfplane &other) const |
| Returns the Minkowski erosion of this disk by a half-plane (A ⊖ B), which is empty. | |
| template<class ResultNumber = double, DiskConcept OtherDisk> | |
| Disk< Point< ResultNumber, PointLabelType > > | minkowskiSum (const OtherDisk &other) const |
| Returns the Minkowski sum of the two disks (A ⊕ B), a disk. | |
| template<class ResultNumber = double, HalfplaneConcept OtherHalfplane> | |
| Halfplane< Point< ResultNumber, PointLabelType > > | minkowskiSum (const OtherHalfplane &other) const |
| Returns the Minkowski sum of this disk and a half-plane (A ⊕ B), a half-plane. | |
| template<PointConcept OtherPoint> | |
| constexpr Disk & | operator+= (const OtherPoint &translation) |
Translates the disk by translation in place. | |
| template<PointConcept OtherPoint> | |
| constexpr Disk & | operator-= (const OtherPoint &translation) |
| Translates the disk by -translation in place. | |
| template<class Scalar> requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>) | |
| constexpr Disk & | operator*= (const Scalar &scalar) |
Scales every boundary point by scalar in place. | |
| template<class OtherShape> | |
| constexpr bool | pointInsideInteriorContainedIn (const OtherShape &shape) const |
Tests whether some point strictly inside this disk lies in the strict interior of shape. | |
| template<class ResultNumber, DiskConcept OtherDisk> | |
| Disk< Point< ResultNumber, typename Disk< PointType_, TLabel >::PointLabelType > > | minkowskiSum (const OtherDisk &other) const |
| template<class ResultNumber, HalfplaneConcept OtherHalfplane> | |
| Halfplane< Point< ResultNumber, typename Disk< PointType_, TLabel >::PointLabelType > > | minkowskiSum (const OtherHalfplane &other) const |
| template<class ResultNumber, DiskConcept OtherDisk> | |
| std::optional< Disk< Point< ResultNumber, typename Disk< PointType_, TLabel >::PointLabelType > > > | minkowskiErosion (const OtherDisk &other) const |
| template<class ResultNumber, HalfplaneConcept OtherHalfplane> | |
| EmptyShape< Point< ResultNumber, typename Disk< PointType_, TLabel >::PointLabelType > > | minkowskiErosion (const OtherHalfplane &other) const |
Static Public Member Functions | |
| static constexpr std::size_t | size () |
| Returns the number of stored boundary points (always 3). | |
Closed Euclidean disk stored by boundary points plus optional disk label.
Closed disk represented by three canonicalized boundary points.
The three stored points are kept in a canonical form so that two disks describing the same circle compare equal regardless of how they were built: the points are sorted lexicographically and, when not collinear, reordered to counterclockwise winding (see canonicalizePoints). The center/radius constructors are conveniences; the stored representation is always three boundary points, matching Triangle.
| PointType_ | Boundary point type; must be a pgl::Point. |
| TLabel | Optional label type carried with the disk (NoLabel to omit). |
| using pgl::Disk< PointType_, TLabel >::LabelType = TLabel |
| using pgl::Disk< PointType_, TLabel >::NumberType = PointType::NumberType |
| using pgl::Disk< PointType_, TLabel >::PointLabelType = PointType::LabelType |
| using pgl::Disk< PointType_, TLabel >::PointType = PointType_ |
|
constexprdefault |
Creates a disk with all three boundary points at the origin.
|
inlineconstexpr |
Creates the disk through three boundary points.
The points are stored in canonical order, so argument order does not matter.
|
inlineconstexpr |
Creates a disk from its center and radius.
The leftmost, rightmost and topmost points of the circle are stored as the three boundary points, which is exact for any number type (no division). A negative radius is treated as its absolute value. The center's point label, if any, is copied onto the three boundary points.
|
inlineconstexpr |
Same as above, and stores a disk label.
|
inlineconstexpr |
Creates a disk from center coordinates and a radius.
|
inlineconstexpr |
Same as above, and stores a disk label.
|
inlineconstexpr |
Converts a disk with a different point and/or label type.
Each boundary point is converted to PointType and re-canonicalized (the canonical order may differ across coordinate types), and the label is copied when both sides carry one.
|
inlineconstexpr |
Returns the first boundary point (lexicographically smallest).
|
inlinenodiscardconstexpr |
Returns the area pi * R^2 of the closed disk.
| ResultNumber | Floating-point result type. |
|
inlineconstexpr |
Returns the second boundary point in canonical order.
|
inlinenodiscardconstexpr |
Returns an axis-aligned bounding box in the coordinate type.
The box is guaranteed to contain the disk. When the disk was built from a center and radius the box is tight; otherwise the box may be larger than the disk.
|
inlineconstexpr |
Returns an iterator to the first boundary point.
|
inlinenodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
A boundary has no area, so it holds only a region with no area — which is exactly the union of that region's ring edges.
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
inlinenodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's boundary contains the other shape (∂A ⊇ B).
|
inlineconstexpr |
Returns a const iterator to the first boundary point.
|
inlineconstexpr |
Returns a const iterator past the last boundary point.
|
inlinenodiscardconstexpr |
Returns the center (circumcenter of the three boundary points) in an explicitly chosen coordinate type.
| ResultNumber | Coordinate type of the result. |
|
inlinenodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
Containment is boundary-inclusive: a point exactly on the circle counts as contained. Because the disk is convex, the shape overloads below reduce to this test on a finite set of points.
| OtherPoint | Point type to test. |
other is inside or on the boundary.
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
A region is contained exactly when its outer polygon is: the region holds the whole outer ring whatever its holes do, and this shape has a connected complement. See implementation/contains.hpp.
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
inlinenodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape contains the other shape (A ⊇ B).
|
inlinenodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
inlinenodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
nodiscardconstexpr |
Tests whether the two shapes mutually separate each other (each disconnects the other).
|
inlinenodiscardconstexpr |
Returns a segment defining a diameter of the disk.
For a genuine 3-point disk the segment uses a() and its reflection across the exact center, so integral boundary points can still yield exact rational endpoints without introducing a square root.
| ResultNumber | Coordinate type of the returned endpoints. |
|
nodiscard |
Returns the Manhattan (L1) distance from this disk to a point.
Zero when the disk contains the point. Otherwise the nearest point of the disk lies on the circle, and its L1 distance to an external point is a trigonometric optimization with no closed form (unlike the Euclidean case's |point - center| - radius), so this refines a coarse angular scan with a golden-section search. The result defaults to double; an explicitly requested floating-point type is preserved.
|
inlinenodiscard |
Returns the Manhattan (L1) distance to the given shape.
Distance is symmetric, so this just calls other's own distanceL1 in the requested floating result type, which visits its wrapped alternative and throws if the pair is unsupported. Deducing OtherPoint from an actual Shape prevents a plain concrete shape from reaching this overload through an implicit conversion and recursively re-entering rank-based forwarding.
|
nodiscard |
Returns the Chebyshev (LInf) distance from this disk to a point.
Zero when the disk contains the point. Otherwise the nearest point of the disk lies on the circle, and its L1 distance to an external point is a trigonometric optimization with no closed form (unlike the Euclidean case's |point - center| - radius), so this refines a coarse angular scan with a golden-section search. The result defaults to double; an explicitly requested floating-point type is preserved.
|
inlinenodiscard |
Returns the Manhattan (L1) distance to the given shape.
Distance is symmetric, so this just calls other's own distanceL1 in the requested floating result type, which visits its wrapped alternative and throws if the pair is unsupported. Deducing OtherPoint from an actual Shape prevents a plain concrete shape from reaching this overload through an implicit conversion and recursively re-entering rank-based forwarding.
|
inlineconstexpr |
Returns an iterator past the last boundary point.
|
inlinenodiscardconstexpr |
Returns a floating-point bounding box of the disk.
The box spans [cx - r, cy - r] to [cx + r, cy + r]; it is tight up to floating-point rounding of the center and radius.
| ResultNumber | Floating-point coordinate type of the box. |
|
inlineconstexpr |
Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the end.
|
inlinenodiscardconstexpr |
Returns the point the disk collapses to, if it does.
Complexity: O(1).
|
inlineconstexpr |
Returns the smallest index i with (*this)[i] == point, or -1 if no boundary point equals point.
|
inlinenodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
Strict version of contains: a point exactly on the boundary circle is not interior-contained. Because the open disk is convex, the shape overloads below reduce to this test on a finite set of vertices.
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
inlinenodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
nodiscardconstexpr |
Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
|
inlinenodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
inlinenodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
nodiscardconstexpr |
Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
|
inlinenodiscardconstexpr |
Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
|
inlinenodiscardconstexpr |
Returns the intersection of the two shapes (A ∩ B), re-dispatching through the wrapper's own intersection.
An intersection is symmetric, so this just calls other's own intersection, which visits its wrapped alternative and throws if the pair is unsupported.
The point type is deduced from other so a plain concrete shape cannot reach this overload through an implicit conversion to Shape.
other holds is not known until run time, so neither is the result's.
|
inlinenodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
True when the distance between the centers is at most the sum of the radii (touching disks count as intersecting).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
inlinenodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
nodiscardconstexpr |
Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
|
inlineconstexpr |
Returns whether the three boundary points are collinear.
|
inlinenodiscardconstexpr |
Returns whether the disk collapses to a single point.
True when all three boundary points coincide, i.e. the disk has zero radius.
Complexity: O(1).
|
inlinenodiscardconstexpr |
Returns whether the disk is degenerate without collapsing to a point.
True when the boundary points are collinear but not all equal, so they do not determine a circle: three distinct collinear points have no circle through them, and two distinct ones (a repeated point) have infinitely many. A disk never collapses to a segment, so together with isPoint this covers every degenerate disk.
Complexity: O(1).
|
inlineconstexpr |
Returns the disk label.
The label is mutable even through a const disk: it is metadata that does not participate in equality, hashing, or geometric predicates.
|
nodiscard |
Returns the integer points the disk contains.
The boundary included: a point at distance exactly the radius is a point of the disk. Each column of the bounding box meets the disk in one run of rows, grown from the row nearest the centre by the disk's own exact containment test, so no square root is taken and nothing is rounded.
| ResultNumber | Integer coordinate type of the points: the shape's own coordinate type when that is a signed integer, the integer a pgl::Rational is built on, and int64_t for anything else. |
| std::logic_error | If a coordinate is not finite, a lattice point of the shape does not fit ResultNumber. |
| std::length_error | If there are more of them than a vector holds. |
| std::optional< Disk< Point< ResultNumber, typename Disk< PointType_, TLabel >::PointLabelType > > > pgl::Disk< PointType_, TLabel >::minkowskiErosion | ( | const OtherDisk< PointType_, TLabel > & | other | ) | const |
|
nodiscard |
Returns the Minkowski erosion of this disk by another (A ⊖ B), a disk when there is one.
The mirror of minkowskiSum(const OtherDisk&) const, and the same one curved pair the library can answer: the centres subtract and so do the radii, since a support function subtracts under the erosion exactly as it adds under the sum. The operand is the wider disk exactly when the difference of radii is negative, and then nothing fits: that is the std::nullopt, the typed spelling of an empty result for a shape with no empty state.
This one is not exact by default, and cannot be, for the reason minkowskiSum(const OtherDisk&) const gives: a disk stores three boundary points, so each radius is a square root of a stored quantity. ResultNumber therefore defaults to double, and a disk built from a centre and a radius is the common case that stays exact.
| ResultNumber | Coordinate type of the result. |
| other | The disk to erode by. |
| EmptyShape< Point< ResultNumber, typename Disk< PointType_, TLabel >::PointLabelType > > pgl::Disk< PointType_, TLabel >::minkowskiErosion | ( | const OtherHalfplane & | other | ) | const |
|
nodiscard |
Returns the Minkowski erosion of this disk by a half-plane (A ⊖ B), which is empty.
A half-plane is unbounded and a disk is not, so no translate of one fits inside one: the pair whose erosion is the empty set by its types alone, which is why it is the one erosion that answers with an EmptyShape. The sum of the same pair is the half-plane itself; see minkowskiSum(const OtherHalfplane&) const.
| ResultNumber | Coordinate type of the result. |
| other | The half-plane to erode by. |
|
nodiscardconstexpr |
Returns the Minkowski erosion of this shape by another (A ⊖ B).
The erosion is the point set {x : x ⊕ B ⊆ A}, the translations of other that keep it inside this shape – equivalently ⋂ {A - b : b ∈ B}. It is the morphological dual of minkowskiSum and is defined for the same pairs, but it is not commutative.
Eroding by a Point is the translation by its negation, so it returns this shape's own type; the other pairs come back as the convex region they are, a HalfplaneIntersection, which holds a lower-dimensional erosion and the empty one as readily as a two-dimensional one. A disk erodes to a disk, by an operand that is one.
Eroding by a shape that covers no point is the whole plane, which a HalfplaneIntersection returns and the tighter result types cannot.
| OtherShape | Type of the shape to erode by. |
| other | Shape to erode by. |
| Disk< Point< ResultNumber, typename Disk< PointType_, TLabel >::PointLabelType > > pgl::Disk< PointType_, TLabel >::minkowskiSum | ( | const OtherDisk< PointType_, TLabel > & | other | ) | const |
|
nodiscard |
Returns the Minkowski sum of the two disks (A ⊕ B), a disk.
The one pair of curved operands the library can answer: the centers add and so do the radii, since the support function of a disk is n·c + r|n| and support functions add under the sum. Nothing else a disk meets has a representable sum — a disk and a segment sweep a stadium, a disk and a polygon a rounded one, and neither is a shape here.
This one is not exact by default, and cannot be. The sum's radius is r₁ + r₂, and a disk stores three boundary points rather than a centre and a radius, so each rᵢ is a square root of a stored quantity: two integer disks generally have an irrational sum radius, which no exact coordinate type holds. That is why ResultNumber defaults to double here, as it does on radius and distance, rather than to the exact division_result_t the polygonal sums default to.
The exception is worth knowing because it is common: a disk built from a centre and a radius carries both exactly, so a sum of two such disks with an exact ResultNumber is exact, and no square root is taken. Ask for an exact type on a disk built from three boundary points and the square root reports itself the way radius does — by throwing, since std::sqrt is not available for the requested type.
| ResultNumber | Coordinate type of the result. |
| other | The disk to sum with. |
| Halfplane< Point< ResultNumber, typename Disk< PointType_, TLabel >::PointLabelType > > pgl::Disk< PointType_, TLabel >::minkowskiSum | ( | const OtherHalfplane & | other | ) | const |
|
nodiscard |
Returns the Minkowski sum of this disk and a half-plane (A ⊕ B), a half-plane.
The mirror spelling of Halfplane::minkowskiSum(const OtherDisk&) const, which carries the contract and the same square root: the boundary keeps its direction and slides out by this disk's radius along the outward unit normal. A half-plane absorbs whatever is bounded, a disk included.
|
nodiscardconstexpr |
Returns the Minkowski sum of this shape and another (A ⊕ B).
The sum is the point set {a + b : a ∈ A, b ∈ B}. Summing with a Point is a translation, so it returns this shape's own type; two bounded convex shapes sum to a Convex, or to a Rectangle when both are rectangles. See MinkowskiSummableConcept for the pairs a Minkowski sum is defined for.
| OtherShape | Type of the other shape. |
| other | Shape to sum with. |
|
inlineconstexpr |
Scales every boundary point by scalar in place.
|
inlineconstexpr |
Translates the disk by translation in place.
|
inlineconstexpr |
Translates the disk by -translation in place.
|
inlineconstexpr |
Divides every boundary point by scalar in place.
|
inlineconstexpr |
Orders disks by increasing squared radius, then by center.
The radius and the center are computed in division_result_t, not in NumberType. Both are fractions of the boundary coordinates – generally non-integral even for an integer disk – so asking for them in an integral NumberType would truncate, and two circles with different radii or centers could truncate to the same pair and compare equivalent while operator== correctly reported them unequal. All three of <, == and > were then false for such a pair, which is not an ordering at all: it breaks std::set<Disk> and anything else that sorts. Computing exactly makes equivalence here mean the same thing as operator== – same center and same radius is the same circle.
|
inlineconstexpr |
Assigns from a disk with compatible point and label types.
| OtherPointType | Source boundary point type. |
| OtherLabelType | Source label type. |
| other | Disk to copy from; its points are re-canonicalized. |
|
inlineconstexpr |
Returns whether two disks describe the same closed region.
Two circles compare equal when other's three boundary points all lie on this disk's boundary (exact in-circle test).
|
inlineconstexpr |
Returns boundary point index in canonical order.
| index | Position in [0, 3); out-of-range is undefined (asserted in debug). |
|
inlinenodiscardconstexpr |
Returns the midpoint of the first two boundary points.
Being the midpoint of a chord, it lies strictly inside the disk.
| ResultNumber | Coordinate type of the result; defaults to division_result_t. |
ResultNumber the truncated result may land on or outside the boundary.
|
inlinenodiscardconstexpr |
Tests whether some point strictly inside this disk lies in the strict interior of shape.
The witness used by the interiorsIntersect overloads for the case where the disk lies inside a convex shape (no boundary of shape crosses the open disk). pointInside is the chord midpoint — a single division by 2 — so for integral coordinates the truncated midpoint may round onto or outside the boundary. When that happens (the rounded point is not strictly inside the disk) scaling the disk and shape by 2 makes the midpoint exact, leaving the containment relation unchanged.
|
inlinenodiscardconstexpr |
Returns the radius.
| ResultNumber | Result type. |
Rotates the disk by 90k degrees around the origin in place.
| k | Number of 90-degree CCW rotations (may be negative). |
|
nodiscardconstexpr |
Returns the disk rotated by 90k degrees around the origin.
| k | Number of 90-degree CCW rotations (may be negative). |
|
nodiscardconstexpr |
Tests whether another shape defines exactly the same point set.
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscard |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
The cell engine that settles the other region pairs wants both boundaries as triangulation constraints, which a circle cannot be. What replaces it is the disk's convexity: it meets every cell of the region in one piece, so the components of A ∖ D are counted over the surviving vertices of the region's domain triangles and slits. See implementation/separates.hpp.
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
nodiscard |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
A set of regions is the one target that may already be in several pieces before anything is removed, so this neither folds over its components nor answers false for a remover that misses it. See implementation/separates.hpp.
|
nodiscardconstexpr |
Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
|
inlinestaticconstexpr |
Returns the number of stored boundary points (always 3).
|
nodiscard |
Returns the squared Euclidean distance between two disks.
Zero when the disks intersect (touching counts); otherwise the square of distance(centers) - radius - other.radius. Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double.
|
nodiscard |
Returns the squared Euclidean distance from this disk to a shape.
Zero when the disk and the shape intersect; otherwise the square of distance(center, shape) - radius, the gap between the shape and the nearest point of the circle. Because the disk is the set of points within radius of the center, this gap is the disk-to-shape distance.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double. The lower-ranked shapes forward their squaredDistance(Disk) to this overload.
|
nodiscard |
Returns the squared Euclidean distance from this disk to a shape.
Zero when the disk and the shape intersect; otherwise the square of distance(center, shape) - radius, the gap between the shape and the nearest point of the circle. Because the disk is the set of points within radius of the center, this gap is the disk-to-shape distance.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double. The lower-ranked shapes forward their squaredDistance(Disk) to this overload.
|
nodiscard |
Returns the squared Euclidean distance from this disk to a shape.
Zero when the disk and the shape intersect; otherwise the square of distance(center, shape) - radius, the gap between the shape and the nearest point of the circle. Because the disk is the set of points within radius of the center, this gap is the disk-to-shape distance.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double. The lower-ranked shapes forward their squaredDistance(Disk) to this overload.
|
nodiscard |
Returns the squared Euclidean distance from this disk to a shape.
Zero when the disk and the shape intersect; otherwise the square of distance(center, shape) - radius, the gap between the shape and the nearest point of the circle. Because the disk is the set of points within radius of the center, this gap is the disk-to-shape distance.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double. The lower-ranked shapes forward their squaredDistance(Disk) to this overload.
|
nodiscard |
Returns the squared Euclidean distance from this disk to a point.
Zero when the disk contains the point (boundary inclusive); otherwise the square of |point - center| - radius, the gap between the point and the nearest point of the circle.
Reports in detail::floating_result_t<ResultNumber>: the distance to an exterior point is generally irrational, so unlike the other shapes an exact ResultNumber cannot be honoured. A floating-point one is used as asked; anything else falls back to double.
|
nodiscard |
Returns the squared Euclidean distance from this disk to a shape.
Zero when the disk and the shape intersect; otherwise the square of distance(center, shape) - radius, the gap between the shape and the nearest point of the circle. Because the disk is the set of points within radius of the center, this gap is the disk-to-shape distance.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double. The lower-ranked shapes forward their squaredDistance(Disk) to this overload.
|
nodiscard |
Returns the squared Euclidean distance from this disk to a shape.
Zero when the disk and the shape intersect; otherwise the square of distance(center, shape) - radius, the gap between the shape and the nearest point of the circle. Because the disk is the set of points within radius of the center, this gap is the disk-to-shape distance.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double. The lower-ranked shapes forward their squaredDistance(Disk) to this overload.
|
nodiscard |
Returns the squared Euclidean distance from this disk to a shape.
Zero when the disk and the shape intersect; otherwise the square of distance(center, shape) - radius, the gap between the shape and the nearest point of the circle. Because the disk is the set of points within radius of the center, this gap is the disk-to-shape distance.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double. The lower-ranked shapes forward their squaredDistance(Disk) to this overload.
|
inlinenodiscard |
Returns the squared Euclidean distance to the given shape.
Forwards to the other shape's implementation so that each unordered pair needs squaredDistance defined only once, on the higher-ranked shape (the shapes ranked above Disk are Convex and Polygon).
|
nodiscard |
Returns the squared Euclidean distance from this disk to a shape.
Zero when the disk and the shape intersect; otherwise the square of distance(center, shape) - radius, the gap between the shape and the nearest point of the circle. Because the disk is the set of points within radius of the center, this gap is the disk-to-shape distance.
Reports in detail::floating_result_t<ResultNumber>: the gap to a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double. The lower-ranked shapes forward their squaredDistance(Disk) to this overload.
|
inlinenodiscardconstexpr |
Returns the squared radius in an explicitly chosen result type.
| ResultNumber | Result type. |