Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
pgl::Triangle< PointType_, TLabel > Struct Template Reference

Closed triangle stored by three vertices. More...

#include <triangle.hpp>

Inheritance diagram for pgl::Triangle< PointType_, TLabel >:
[legend]

Classes

class  BoundaryIterator

Public Types

using PointType = PointType_
using NumberType = PointType::NumberType
using LabelType = TLabel
using value_type = PointType
using size_type = std::size_t
using difference_type = std::ptrdiff_t
using reference = const PointType&
using const_reference = const PointType&
using iterator = typename std::array<PointType, 3>::const_iterator
using const_iterator = iterator
template<bool Oriented>
using BoundaryType = std::conditional_t<Oriented, OrientedSegment<PointType>, Segment<PointType>>
using EdgeIterator = BoundaryIterator<false>
using OrientedEdgeIterator = BoundaryIterator<true>

Public Member Functions

constexpr Triangle ()=default
 Creates the degenerate triangle (0,0),(0,0),(0,0).
constexpr Triangle (PointType first, PointType second, PointType third)
 Creates a triangle from three vertices.
constexpr Triangle (NumberType x1, NumberType y1, NumberType x2, NumberType y2, NumberType x3, NumberType y3)
 Creates a triangle from six coordinates.
template<class A>
requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
constexpr Triangle (PointType first, PointType second, PointType third, A &&label)
 Creates a triangle from three vertices and stores a label.
template<class A>
requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
constexpr Triangle (NumberType x1, NumberType y1, NumberType x2, NumberType y2, NumberType x3, NumberType y3, A &&label)
 Same as the six-coordinate constructor, and stores a label.
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
constexpr Triangle (const Triangle< OtherPointType, OtherLabelType > &other)
 Converts a triangle with compatible vertex type.
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
constexpr Triangleoperator= (const Triangle< OtherPointType, OtherLabelType > &other)
 Assigns from a triangle with compatible vertex type.
constexpr const PointTypeoperator[] (std::size_t index) const
 Returns vertex 0, 1, or 2.
constexpr const PointTypeget (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 vertex equals point.
constexpr const PointTypea () const
 Returns the first vertex.
constexpr const PointTypeb () const
 Returns the second vertex.
constexpr const PointTypec () const
 Returns the third vertex.
constexpr auto begin () const
 Returns an iterator to the first vertex.
constexpr auto cbegin () const
 Returns an iterator to the first vertex.
constexpr auto end () const
 Returns an iterator past the last vertex.
constexpr auto cend () const
 Returns an iterator past the last vertex.
constexpr bool operator== (const Triangle &other) const
 Compares triangles lexicographically by canonical vertices.
template<AnyShapeConcept OtherShape>
constexpr bool samePointSet (const OtherShape &other) const
 Tests whether another shape defines exactly the same point set.
constexpr auto operator<=> (const Triangle &other) const
 Orders triangles lexicographically by their vertices, ignoring the label.
template<class A = LabelType>
requires (detail::has_label_v<A>)
constexpr A & label () const
 Returns the triangle label.
constexpr NumberType twiceArea () const
 Returns twice the area of the triangle.
template<class ResultNumber = division_result_t<NumberType>>
constexpr ResultNumber area () const
 Returns the non-negative area of the triangle.
constexpr bool isDegenerate () const
 Tests whether the three vertices are collinear.
constexpr bool isPoint () const
 Returns whether the triangle collapses to a single point.
constexpr std::optional< PointTypegetIfPoint () const
 Returns the point the triangle collapses to, if it does.
constexpr bool isSegment () const
 Returns whether the triangle collapses to a non-degenerate segment.
constexpr std::optional< BoundaryType< false > > getIfSegment () const
 Returns the segment the triangle collapses to, if it does.
constexpr bool isUndefined () const
 Returns whether the triangle is degenerate without collapsing to a point or to a segment.
constexpr Rectangle< PointTypebbox () const
 Returns the axis-aligned bounding box of the vertices.
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 triangle contains.
template<std::floating_point ResultNumber = double>
constexpr Rectangle< Point< ResultNumber > > fbox () const
 Returns a floating-point bounding box containing the triangle.
constexpr std::array< PointType, 3 > vertices () const
 Returns the vertices in canonical order.
constexpr std::array< Segment< PointType >, 3 > edges () const
 Returns the three unoriented boundary edges.
constexpr EdgeIterator edgesBegin () const
 Returns an iterator to the first unoriented edge.
constexpr EdgeIterator edgesEnd () const
 Returns an iterator past the last unoriented edge.
constexpr std::array< OrientedSegment< PointType >, 3 > orientedEdges () const
 Returns the three oriented boundary edges.
constexpr OrientedEdgeIterator orientedEdgesBegin () const
 Returns an iterator to the first oriented edge.
constexpr OrientedEdgeIterator orientedEdgesEnd () const
 Returns an iterator past the last oriented edge.
constexpr operator Convex< PointType > () const
 Converts the triangle to a convex polygon.
constexpr Convex< PointTypeasConvex () const
 Returns the triangle as a convex polygon.
constexpr Convex< PointTypeconvexHull () const
 Returns the convex hull of the triangle's vertices.
constexpr HalfplaneIntersection< PointTypeasHalfplaneIntersection () const
 Returns the triangle as a half-plane intersection.
constexpr operator Polygon< PointType > () const
 Converts the triangle to a simple polygon.
constexpr Polygon< PointTypeasPolygon () const
 Returns the triangle as a simple polygon.
constexpr PolygonWithHoles< PointTypeasPolygonWithHoles () const
 Returns the triangle as a hole-free region.
constexpr PolygonSet< PointTypeasPolygonSet () const
 Returns the triangle as a one-component set of regions.
constexpr Triangle rotated90 (int k=1) const
 Returns the triangle rotated by 90k degrees around the origin.
constexpr void rotate90 (int k=1)
 Rotates the triangle by 90k degrees around the origin in place.
template<class OtherNumber>
constexpr Triangle scaledUpX (const OtherNumber scalar) const
 Returns the triangle with its x-coordinates multiplied by a factor.
template<class OtherNumber>
constexpr void scaleUpX (const OtherNumber scalar)
 Multiplies the triangle's x-coordinates by a factor in place.
template<class OtherNumber>
constexpr Triangle scaledUpY (const OtherNumber scalar) const
 Returns the triangle with its y-coordinates multiplied by a factor.
template<class OtherNumber>
constexpr void scaleUpY (const OtherNumber scalar)
 Multiplies the triangle's y-coordinates by a factor in place.
template<class OtherNumber>
constexpr Triangle scaledDownX (const OtherNumber scalar) const
 Returns the triangle with its x-coordinates divided by a divisor.
template<class OtherNumber>
constexpr void scaleDownX (const OtherNumber scalar)
 Divides the triangle's x-coordinates by a divisor in place.
template<class OtherNumber>
constexpr Triangle scaledDownY (const OtherNumber scalar) const
 Returns the triangle with its y-coordinates divided by a divisor.
template<class OtherNumber>
constexpr void scaleDownY (const OtherNumber scalar)
 Divides the triangle's y-coordinates by a divisor in place.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Point< ResultNumber > centroid () const
 Returns the arithmetic centroid.
constexpr Disk< PointType, NoLabelcircumcircle () const
 Returns the circumcircle of the triangle.
constexpr Segment< PointTypediameter () const
 Returns a segment defining the diameter.
template<class ResultNumber = division_result_t<NumberType>>
constexpr Point< ResultNumber > pointInside () const
 Returns a point inside the triangle.
template<class OtherShape>
constexpr bool pointInsideInteriorContainedIn (const OtherShape &shape) const
 Tests whether some point in this shape's relative interior lies in the strict interior of shape.
constexpr bool isRectangle () const
 Tests whether the triangle has a right angle.
constexpr bool isObtuse () const
 Tests whether the triangle has an obtuse angle.
constexpr bool isIsosceles () const
 Tests whether two sides have the same length.
template<PointConcept OtherPoint>
constexpr bool verticesContain (const OtherPoint &point) const
 Tests whether a point equals one of the vertices.
template<PointConcept OtherPoint>
constexpr bool boundaryContains (const OtherPoint &point) 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<RectangleConcept OtherRectangle>
constexpr bool boundaryContains (const OtherRectangle &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<PointConcept OtherPoint>
constexpr bool contains (const OtherPoint &point) const
 Tests whether this shape contains the other shape (A ⊇ B).
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<RectangleConcept OtherRectangle>
constexpr bool contains (const OtherRectangle &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<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).
constexpr bool boundaryContains (const Shape< PointType > &other) const
 Tests whether this shape's boundary 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<class EmptyPoint>
constexpr bool separates (const EmptyShape< EmptyPoint > &) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<PointConcept OtherPoint>
constexpr bool interiorContains (const OtherPoint &point) 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<RectangleConcept OtherRectangle>
constexpr bool interiorContains (const OtherRectangle &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<PointConcept OtherPoint>
constexpr bool intersects (const OtherPoint &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<SegmentConcept OtherSegment>
constexpr bool intersects (const OtherSegment &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<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 ≠ ∅).
constexpr bool intersects (const Shape< PointType > &other) const
 Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
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<PointConcept OtherPoint>
constexpr bool interiorsIntersect (const OtherPoint &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<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<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<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
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) ≠ ∅).
constexpr bool interiorsIntersect (const Shape< PointType > &other) const
 Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).
template<SegmentConcept OtherSegment>
constexpr bool separates (const OtherSegment &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<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<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<ConvexConcept OtherConvex>
constexpr bool separates (const OtherConvex &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<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).
constexpr bool separates (const Shape< PointType > &other) const
 Tests whether removing this shape disconnects the other shape (B∖A is disconnected).
template<DiskConcept OtherDisk>
constexpr bool boundaryContains (const OtherDisk &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 interiorContains (const OtherDisk &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<PolygonConcept OtherPolygon>
constexpr bool interiorContains (const OtherPolygon &other) const
 Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).
template<SegmentConcept OtherSegment>
constexpr bool crosses (const OtherSegment &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
template<PointConcept OtherPoint>
constexpr bool crosses (const OtherPoint &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<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
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).
constexpr bool crosses (const Shape< PointType > &other) const
 Tests whether the two shapes mutually separate each other (each disconnects the other).
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 = division_result_t<NumberType>, LineConcept OtherLine>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherLine &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherOrientedLine &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherSegment &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherOrientedSegment &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
constexpr std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > intersection (const OtherRay &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
constexpr auto intersection (const OtherHalfplane &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = NumberType, HalfplaneIntersectionConcept OtherRegion>
constexpr auto intersection (const OtherRegion &other) const
 Adds this triangle's three constraints to a half-plane intersection without deriving vertices.
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
constexpr auto intersection (const OtherRectangle &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
constexpr auto intersection (const OtherTriangle &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && !HalfplaneIntersectionConcept<OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self) { o.template intersection
<ResultNumber>(self); })
constexpr auto intersection (const OtherShape &other) const
 Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape&
o, const Triangle& self) { o.template regularizedIntersection<ResultNumber>(self); })
constexpr auto regularizedIntersection (const OtherShape &other) const
 Forwards a regularized intersection to the shape that owns it.
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<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto squaredDistance (const OtherPoint &point) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto squaredDistance (const OtherSegment &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto squaredDistance (const OtherOrientedSegment &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
constexpr auto squaredDistance (const OtherLine &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
constexpr auto squaredDistance (const OtherOrientedLine &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
constexpr auto squaredDistance (const OtherRay &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
constexpr auto squaredDistance (const OtherHalfplane &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
constexpr auto squaredDistance (const OtherRectangle &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
constexpr auto squaredDistance (const OtherTriangle &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template squaredDistance<ResultNumber>(self); })
constexpr auto squaredDistance (const OtherShape &other) const
 Returns the squared Euclidean distance to the given shape.
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > squaredDistance (const Disk< DiskPointType, DiskLabel > &disk) const
 Returns the squared Euclidean distance to a disk.
template<class ResultNumber = NumberType, BoundedPolygonalConcept OtherShape>
requires detail::ClosestPairConcept<Triangle<PointType_, TLabel>, OtherShape>
constexpr auto closestSegments (const OtherShape &other) const
 Returns the pair of elements realizing the distance, nothing when the shapes meet.
template<class ResultNumber = division_result_t<NumberType>, class OtherShape>
requires detail::ClosestPointsPairConcept<Triangle<PointType_, TLabel>, OtherShape>
constexpr auto closestPoints (const OtherShape &other) const
 Returns the pair of points realizing the distance, nothing when the shapes meet.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto distanceL1 (const OtherPoint &point) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto distanceL1 (const OtherSegment &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto distanceL1 (const OtherOrientedSegment &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
constexpr auto distanceL1 (const OtherLine &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
constexpr auto distanceL1 (const OtherOrientedLine &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
constexpr auto distanceL1 (const OtherRay &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
constexpr auto distanceL1 (const OtherHalfplane &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
constexpr auto distanceL1 (const OtherRectangle &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
constexpr auto distanceL1 (const OtherTriangle &other) const
 Returns the Manhattan (L1) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template distanceL1<ResultNumber>(self); })
constexpr auto distanceL1 (const OtherShape &other) const
 Returns the Manhattan (L1) distance to the given shape.
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 = division_result_t<NumberType>, PointConcept OtherPoint>
auto regularizedIntersection (const Shape< OtherPoint > &other) const
 Re-dispatches a regularized intersection through a runtime shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto regularizedUnion (const Shape< OtherPoint > &other) const
 Returns the regularized union of the two shapes (A ∪ B), re-dispatching through the wrapper's own regularizedUnion.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto difference (const Shape< OtherPoint > &other) const
 Returns the regularized set difference of the two shapes (A ∖ B), re-dispatching through the wrapper's own difference.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto symmetricDifference (const Shape< OtherPoint > &other) const
 Returns the regularized symmetric difference of the two shapes (A △ B), re-dispatching through the wrapper's own symmetricDifference.
template<class ResultNumber = double, PointConcept OtherPoint>
constexpr auto distanceL1 (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceL1.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto distanceLInf (const OtherPoint &point) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto distanceLInf (const OtherSegment &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto distanceLInf (const OtherOrientedSegment &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, LineConcept OtherLine>
constexpr auto distanceLInf (const OtherLine &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedLineConcept OtherOrientedLine>
constexpr auto distanceLInf (const OtherOrientedLine &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RayConcept OtherRay>
constexpr auto distanceLInf (const OtherRay &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
constexpr auto distanceLInf (const OtherHalfplane &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
constexpr auto distanceLInf (const OtherRectangle &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
constexpr auto distanceLInf (const OtherTriangle &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template distanceLInf<ResultNumber>(self); })
constexpr auto distanceLInf (const OtherShape &other) const
 Returns the Chebyshev (LInf) distance to the given shape.
template<class ResultNumber = double, PointConcept OtherPoint>
constexpr auto distanceLInf (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceLInf.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto hausdorffDistanceL1 (const OtherPoint &point) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto hausdorffDistanceL1 (const OtherSegment &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto hausdorffDistanceL1 (const OtherOrientedSegment &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
constexpr auto hausdorffDistanceL1 (const OtherRectangle &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
constexpr auto hausdorffDistanceL1 (const OtherTriangle &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template hausdorffDistanceL1<ResultNumber>(self); })
constexpr auto hausdorffDistanceL1 (const OtherShape &other) const
 Returns the Manhattan (L1) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto hausdorffDistanceL1 (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceL1.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto hausdorffDistanceLInf (const OtherPoint &point) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto hausdorffDistanceLInf (const OtherSegment &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto hausdorffDistanceLInf (const OtherOrientedSegment &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
constexpr auto hausdorffDistanceLInf (const OtherRectangle &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
constexpr auto hausdorffDistanceLInf (const OtherTriangle &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template hausdorffDistanceLInf<ResultNumber>(self); })
constexpr auto hausdorffDistanceLInf (const OtherShape &other) const
 Returns the Chebyshev (LInf) Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
constexpr auto hausdorffDistanceLInf (const Shape< OtherPoint > &other) const
 Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceLInf.
template<class ResultNumber = NumberType, PointConcept OtherPoint>
constexpr auto squaredHausdorffDistance (const OtherPoint &point) const
 Returns the squared Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, SegmentConcept OtherSegment>
constexpr auto squaredHausdorffDistance (const OtherSegment &other) const
 Returns the squared Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, OrientedSegmentConcept OtherOrientedSegment>
constexpr auto squaredHausdorffDistance (const OtherOrientedSegment &other) const
 Returns the squared Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
constexpr auto squaredHausdorffDistance (const OtherRectangle &other) const
 Returns the squared Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
constexpr auto squaredHausdorffDistance (const OtherTriangle &other) const
 Returns the squared Hausdorff distance to the given shape.
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template squaredHausdorffDistance<ResultNumber>(self); })
constexpr auto squaredHausdorffDistance (const OtherShape &other) const
 Returns the squared Hausdorff distance to the given shape.
template<class OtherShape>
requires MinkowskiSummableConcept<Triangle<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<Triangle<PointType_, TLabel>, OtherShape>
constexpr auto minkowskiErosion (const OtherShape &other) const
 Returns the Minkowski erosion of this shape by another (A ⊖ B).
template<class OtherShape>
requires (!MinkowskiSummableConcept<Triangle<PointType_, TLabel>, OtherShape> && BoundedPolygonalConcept<OtherShape>)
constexpr auto minkowskiErosion (const OtherShape &other) const
 Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!MinkowskiSummableConcept<Triangle<PointType_, TLabel>, OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self) { o.template minkowskiSum
<ResultNumber>(self); })
auto minkowskiSum (const OtherShape &other) const
 Returns the regularized Minkowski sum of the two shapes (A ⊕ B).
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion (const OtherTriangle &other) const
 Returns the regularized union of the two shapes (A ∪ B).
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > regularizedUnion (const OtherRectangle &other) const
 Returns the regularized union of the two shapes (A ∪ B).
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template regularizedUnion<ResultNumber>(self); })
auto regularizedUnion (const OtherShape &other) const
 Returns the regularized union of the two shapes (A ∪ B).
template<class ResultNumber = division_result_t<NumberType>, PolygonalRegionConcept OtherRegion>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference (const OtherRegion &other) const
 Returns the regularized set difference of the two shapes (A ∖ B).
template<class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference (const OtherIntersection &other) const
 Returns the regularized set difference of the two shapes (A ∖ B).
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > difference (const OtherHalfplane &other) const
 Returns the regularized set difference of the two shapes (A ∖ B).
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference (const OtherTriangle &other) const
 Returns the regularized symmetric difference of the two shapes (A △ B).
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > symmetricDifference (const OtherRectangle &other) const
 Returns the regularized symmetric difference of the two shapes (A △ B).
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template symmetricDifference<ResultNumber>(self); })
auto symmetricDifference (const OtherShape &other) const
 Returns the regularized symmetric difference of the two shapes (A △ B).
template<PointConcept OtherPoint>
constexpr Triangleoperator+= (const OtherPoint &translation)
 Translates all vertices by a point in place.
template<PointConcept OtherPoint>
constexpr Triangleoperator-= (const OtherPoint &translation)
 Translates all vertices by the opposite of a point in place.
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr Triangleoperator*= (const Scalar &scalar)
 Scales all vertices by a scalar in place.
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr Triangleoperator/= (const Scalar &scalar)
 Divides all vertices by a scalar in place.
template<class ResultNumber, PolygonalRegionConcept OtherRegion>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > difference (const OtherRegion &other) const
template<class ResultNumber, HalfplaneIntersectionConcept OtherIntersection>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > difference (const OtherIntersection &other) const
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > difference (const OtherHalfplane &other) const
template<class ResultNumber, TriangleConcept OtherTriangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > regularizedUnion (const OtherTriangle &other) const
template<class ResultNumber, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > regularizedUnion (const OtherRectangle &other) const
template<class ResultNumber, TriangleConcept OtherTriangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > symmetricDifference (const OtherTriangle &other) const
template<class ResultNumber, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > symmetricDifference (const OtherRectangle &other) const
template<PointConcept OtherPoint>
constexpr Triangle< PointType, LabelType > & operator+= (const OtherPoint &translation)
template<PointConcept OtherPoint>
constexpr Triangle< PointType, LabelType > & operator-= (const OtherPoint &translation)
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr Triangle< PointType, LabelType > & operator*= (const Scalar &scalar)
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
constexpr Triangle< PointType, LabelType > & operator/= (const Scalar &scalar)
template<class OtherNumber>
constexpr Triangle< PointType, LabelTypescaledUpX (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Triangle< PointType, LabelTypescaledUpY (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Triangle< PointType, LabelTypescaledDownX (const OtherNumber scalar) const
template<class OtherNumber>
constexpr Triangle< PointType, LabelTypescaledDownY (const OtherNumber scalar) const

Static Public Member Functions

static constexpr std::size_t size ()
 Returns the number of vertices (always 3).

Detailed Description

template<class PointType_, class TLabel>
struct pgl::Triangle< PointType_, TLabel >

Closed triangle stored by three vertices.

Closed triangle represented by three canonicalized vertices.

The first stored vertex is the lexicographically smallest one. The other two vertices are ordered so that non-degenerate triangles are stored in counterclockwise order. Degenerate triangles fall back to lexicographic ordering of all three vertices.

Template Parameters
PointType_Vertex point type.

Member Typedef Documentation

◆ BoundaryType

template<class PointType_, class TLabel>
template<bool Oriented>
using pgl::Triangle< PointType_, TLabel >::BoundaryType = std::conditional_t<Oriented, OrientedSegment<PointType>, Segment<PointType>>

◆ const_iterator

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::const_iterator = iterator

◆ const_reference

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::const_reference = const PointType&

◆ difference_type

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::difference_type = std::ptrdiff_t

◆ EdgeIterator

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::EdgeIterator = BoundaryIterator<false>

◆ iterator

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::iterator = typename std::array<PointType, 3>::const_iterator

◆ LabelType

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::LabelType = TLabel

Optional label type carried with the triangle.

◆ NumberType

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::NumberType = PointType::NumberType

Type of the vertex coordinates.

◆ OrientedEdgeIterator

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::OrientedEdgeIterator = BoundaryIterator<true>

◆ PointType

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::PointType = PointType_

Type of the triangle vertices.

◆ reference

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::reference = const PointType&

◆ size_type

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::size_type = std::size_t

◆ value_type

template<class PointType_, class TLabel>
using pgl::Triangle< PointType_, TLabel >::value_type = PointType

Standard range/container typedefs over the vertex sequence.

Constructor & Destructor Documentation

◆ Triangle() [1/6]

template<class PointType_, class TLabel>
pgl::Triangle< PointType_, TLabel >::Triangle ( )
constexprdefault

Creates the degenerate triangle (0,0),(0,0),(0,0).

◆ Triangle() [2/6]

template<class PointType_, class TLabel>
pgl::Triangle< PointType_, TLabel >::Triangle ( PointType first,
PointType second,
PointType third )
inlineconstexpr

Creates a triangle from three vertices.

The stored representation is canonicalized to match the documented Pangolin order.

Parameters
firstFirst vertex.
secondSecond vertex.
thirdThird vertex.

◆ Triangle() [3/6]

template<class PointType_, class TLabel>
pgl::Triangle< PointType_, TLabel >::Triangle ( NumberType x1,
NumberType y1,
NumberType x2,
NumberType y2,
NumberType x3,
NumberType y3 )
inlineconstexpr

Creates a triangle from six coordinates.

Parameters
x1X coordinate of the first vertex.
y1Y coordinate of the first vertex.
x2X coordinate of the second vertex.
y2Y coordinate of the second vertex.
x3X coordinate of the third vertex.
y3Y coordinate of the third vertex.

◆ Triangle() [4/6]

template<class PointType_, class TLabel>
template<class A>
requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
pgl::Triangle< PointType_, TLabel >::Triangle ( PointType first,
PointType second,
PointType third,
A && label )
inlineconstexpr

Creates a triangle from three vertices and stores a label.

The stored vertices are canonicalized as in the unlabeled constructor.

Template Parameters
AType convertible to LabelType.

◆ Triangle() [5/6]

template<class PointType_, class TLabel>
template<class A>
requires (detail::has_label_v<LabelType> && std::constructible_from<LabelType, A&&>)
pgl::Triangle< PointType_, TLabel >::Triangle ( NumberType x1,
NumberType y1,
NumberType x2,
NumberType y2,
NumberType x3,
NumberType y3,
A && label )
inlineconstexpr

Same as the six-coordinate constructor, and stores a label.

◆ Triangle() [6/6]

template<class PointType_, class TLabel>
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
pgl::Triangle< PointType_, TLabel >::Triangle ( const Triangle< OtherPointType, OtherLabelType > & other)
inlineconstexpr

Converts a triangle with compatible vertex type.

Template Parameters
OtherPointTypeSource vertex type.
Parameters
otherSource triangle.

Member Function Documentation

◆ a()

template<class PointType_, class TLabel>
const PointType & pgl::Triangle< PointType_, TLabel >::a ( ) const
inlineconstexpr

Returns the first vertex.

Returns
Reference to the first vertex.

◆ area()

template<class PointType, class LabelType>
template<class ResultNumber>
ResultNumber pgl::Triangle< PointType, LabelType >::area ( ) const
nodiscardconstexpr

Returns the non-negative area of the triangle.

Integral coordinates produce an exact rational half-area when needed.

Warning
Uses division by 2, so may not be exact for integral types.
Returns
Absolute triangle area.

◆ asConvex()

template<class PointType_, class TLabel>
Convex< PointType > pgl::Triangle< PointType_, TLabel >::asConvex ( ) const
inlinenodiscardconstexpr

Returns the triangle as a convex polygon.

Returns
Convex polygon with the same vertices.

◆ asHalfplaneIntersection()

template<class PointType_, class TLabel>
HalfplaneIntersection< PointType > pgl::Triangle< PointType_, TLabel >::asHalfplaneIntersection ( ) const
inlinenodiscardconstexpr

Returns the triangle as a half-plane intersection.

The region is the intersection of the three edge half-planes. A degenerate triangle produces the corresponding degenerate region: the segment spanning collinear vertices, or the point they all share.

Returns
Half-plane intersection whose point set is this triangle.

◆ asPolygon()

template<class PointType_, class TLabel>
Polygon< PointType > pgl::Triangle< PointType_, TLabel >::asPolygon ( ) const
inlinenodiscardconstexpr

Returns the triangle as a simple polygon.

Returns
Polygon with the same vertices.

◆ asPolygonSet()

template<class PointType_, class TLabel>
PolygonSet< PointType > pgl::Triangle< PointType_, TLabel >::asPolygonSet ( ) const
inlinenodiscardconstexpr

Returns the triangle as a one-component set of regions.

A collapsed triangle covers nothing that survives regularization, so it gives back the empty set rather than a component without area.

Returns
PolygonSet whose only component is the triangle as a region.

◆ asPolygonWithHoles()

template<class PointType_, class TLabel>
PolygonWithHoles< PointType > pgl::Triangle< PointType_, TLabel >::asPolygonWithHoles ( ) const
inlinenodiscardconstexpr

Returns the triangle as a hole-free region.

Returns
PolygonWithHoles whose outer boundary is the triangle and which has no holes.

◆ b()

template<class PointType_, class TLabel>
const PointType & pgl::Triangle< PointType_, TLabel >::b ( ) const
inlineconstexpr

Returns the second vertex.

Returns
Reference to the second vertex.

◆ bbox()

template<class PointType, class LabelType>
Rectangle< PointType > pgl::Triangle< PointType, LabelType >::bbox ( ) const
nodiscardconstexpr

Returns the axis-aligned bounding box of the vertices.

Returns
Minimum rectangle containing all three vertices.

◆ begin()

template<class PointType_, class TLabel>
auto pgl::Triangle< PointType_, TLabel >::begin ( ) const
inlineconstexpr

Returns an iterator to the first vertex.

Returns
Const iterator to the first vertex.

◆ boundaryContains() [1/19]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Triangle< PointType_, TLabel >::boundaryContains ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [2/19]

template<class PointType, class LabelType>
template<MonotoneChainConcept OtherChain>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherChain & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [3/19]

template<class PointType, class LabelType>
template<ConvexConcept OtherConvex>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherConvex & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [4/19]

template<class PointType, class LabelType>
template<DiskConcept OtherDisk>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherDisk & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [5/19]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherHalfplane & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [6/19]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherLine & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [7/19]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherOrientedLine & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [8/19]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [9/19]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherPoint & point) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

Template Parameters
OtherPointPoint type.
Parameters
pointPoint to test.
Returns
true if the point lies on any edge.

Triangle

Triangle boundary, containment, intersection, and cut predicates, including triangle-vs-rectangle and triangle-vs-triangle topological cases.

◆ boundaryContains() [10/19]

template<class PointType, class LabelType>
template<PolygonConcept OtherPolygon>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherPolygon & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [11/19]

template<class PointType, class LabelType>
template<PolylineConcept OtherPolyline>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherPolyline & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [12/19]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherRay & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [13/19]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherRectangle & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [14/19]

template<class PointType_, class TLabel>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Triangle< PointType_, TLabel >::boundaryContains ( const OtherRegion & other) const
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.

◆ boundaryContains() [15/19]

template<class PointType, class LabelType>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherRegion & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [16/19]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherSegment & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [17/19]

template<class PointType_, class TLabel>
template<PolygonSetConcept OtherSet>
bool pgl::Triangle< PointType_, TLabel >::boundaryContains ( const OtherSet & other) const
inlinenodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [18/19]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ boundaryContains() [19/19]

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::boundaryContains ( const Shape< PointType > & other) const
nodiscardconstexpr

Tests whether this shape's boundary contains the other shape (∂A ⊇ B).

◆ c()

template<class PointType_, class TLabel>
const PointType & pgl::Triangle< PointType_, TLabel >::c ( ) const
inlineconstexpr

Returns the third vertex.

Returns
Reference to the third vertex.

◆ cbegin()

template<class PointType_, class TLabel>
auto pgl::Triangle< PointType_, TLabel >::cbegin ( ) const
inlineconstexpr

Returns an iterator to the first vertex.

Returns
Const iterator to the first vertex.

◆ cend()

template<class PointType_, class TLabel>
auto pgl::Triangle< PointType_, TLabel >::cend ( ) const
inlineconstexpr

Returns an iterator past the last vertex.

Returns
Const iterator past the last vertex.

◆ centroid()

template<class PointType, class LabelType>
template<class ResultNumber>
Point< ResultNumber > pgl::Triangle< PointType, LabelType >::centroid ( ) const
nodiscardconstexpr

Returns the arithmetic centroid.

Template Parameters
ResultNumberCoordinate type of the returned point.
Returns
Point ((ax+bx+cx)/3, (ay+by+cy)/3).
Warning
Uses division by 3, so the result may be inexact even for floating-point types.

◆ circumcircle()

template<class PointType, class LabelType>
Disk< PointType, NoLabel > pgl::Triangle< PointType, LabelType >::circumcircle ( ) const
nodiscardconstexpr

Returns the circumcircle of the triangle.

The returned disk stores the three triangle vertices as boundary points.

Returns
Disk passing through the three vertices.

◆ closestPoints()

template<class PointType_, class TLabel>
requires detail::ClosestPointsPairConcept<Triangle<PointType_, TLabel>, OtherShape>
template<class ResultNumber, class OtherShape>
requires detail::ClosestPointsPairConcept<Triangle<PointType_, TLabel>, OtherShape>
auto pgl::Triangle< PointType_, TLabel >::closestPoints ( const OtherShape & other) const
nodiscardconstexpr

Returns the pair of points realizing the distance, nothing when the shapes meet.

The first point lies on this shape and the second on other. Empty exactly when squaredDistance is zero. Unlike closestSegments this also takes an unbounded convex other — a line, an oriented line, a ray, a half-plane, a half-plane intersection — which realizes the distance at a point on no edge and at no vertex: there is no element to name there, but there is still a point to give.

Template Parameters
ResultNumberCoordinate type of the returned points (default: division_result_t).
Warning
A point interior to an element comes from a division, so with an integer ResultNumber it truncates. Request a floating-point or pgl::Rational result type for an accurate value.

◆ closestSegments()

template<class PointType_, class TLabel>
requires detail::ClosestPairConcept<Triangle<PointType_, TLabel>, OtherShape>
template<class ResultNumber, BoundedPolygonalConcept OtherShape>
requires detail::ClosestPairConcept<Triangle<PointType_, TLabel>, OtherShape>
auto pgl::Triangle< PointType_, TLabel >::closestSegments ( const OtherShape & other) const
nodiscardconstexpr

Returns the pair of elements realizing the distance, nothing when the shapes meet.

The first element is this shape's, the second is other's; each is one of the shape's edges, degenerate to a vertex where the shape has none. Empty exactly when squaredDistance is zero.

Template Parameters
ResultNumberCoordinate type of the returned segments (default: NumberType).
Warning
other's coordinates and labels are re-expressed in this shape's, so a narrower ResultNumber loses them.

◆ contains() [1/19]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Triangle< PointType_, TLabel >::contains ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [2/19]

template<class PointType, class LabelType>
template<MonotoneChainConcept OtherChain>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherChain & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [3/19]

template<class PointType, class LabelType>
template<ConvexConcept OtherConvex>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherConvex & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [4/19]

template<class PointType, class LabelType>
template<DiskConcept OtherDisk>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherDisk & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [5/19]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherHalfplane & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [6/19]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherLine & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [7/19]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherOrientedLine & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [8/19]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [9/19]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherPoint & point) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

Degenerate triangles use boundary containment.

Template Parameters
OtherPointPoint type.
Parameters
pointPoint to test.
Returns
true if the point is contained.

Triangle

Triangle boundary, containment, intersection, and cut predicates, including triangle-vs-rectangle and triangle-vs-triangle topological cases.

◆ contains() [10/19]

template<class PointType, class LabelType>
template<PolygonConcept OtherPolygon>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherPolygon & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [11/19]

template<class PointType, class LabelType>
template<PolylineConcept OtherPolyline>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherPolyline & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [12/19]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherRay & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [13/19]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherRectangle & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [14/19]

template<class PointType_, class TLabel>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Triangle< PointType_, TLabel >::contains ( const OtherRegion & other) const
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.

◆ contains() [15/19]

template<class PointType, class LabelType>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherRegion & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [16/19]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherSegment & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [17/19]

template<class PointType_, class TLabel>
template<PolygonSetConcept OtherSet>
bool pgl::Triangle< PointType_, TLabel >::contains ( const OtherSet & other) const
inlinenodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [18/19]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Triangle< PointType, LabelType >::contains ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ contains() [19/19]

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::contains ( const Shape< PointType > & other) const
nodiscardconstexpr

Tests whether this shape contains the other shape (A ⊇ B).

◆ convexHull()

template<class PointType_, class TLabel>
Convex< PointType > pgl::Triangle< PointType_, TLabel >::convexHull ( ) const
inlinenodiscardconstexpr

Returns the convex hull of the triangle's vertices.

A triangle is already convex, so this is asConvex.

◆ crosses() [1/12]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Triangle< PointType_, TLabel >::crosses ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [2/12]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherHalfplane & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [3/12]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherLine & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [4/12]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherOrientedLine & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [5/12]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [6/12]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherPoint & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [7/12]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherRay & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [8/12]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherRectangle & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [9/12]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherSegment & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

Triangle

Triangle boundary, containment, intersection, and cut predicates, including triangle-vs-rectangle and triangle-vs-triangle topological cases.

◆ crosses() [10/12]

template<class PointType_, class TLabel>
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
bool pgl::Triangle< PointType_, TLabel >::crosses ( const OtherShape & other) const
inlinenodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [11/12]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Triangle< PointType, LabelType >::crosses ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ crosses() [12/12]

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::crosses ( const Shape< PointType > & other) const
nodiscardconstexpr

Tests whether the two shapes mutually separate each other (each disconnects the other).

◆ diameter()

template<class PointType, class LabelType>
Segment< PointType > pgl::Triangle< PointType, LabelType >::diameter ( ) const
nodiscardconstexpr

Returns a segment defining the diameter.

For a triangle, the diameter is its longest side.

Returns
A longest boundary edge.

◆ difference() [1/7]

template<class PointType_, class TLabel>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Triangle< PointType_, TLabel >::difference ( const OtherHalfplane & other) const

◆ difference() [2/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, HalfplaneConcept OtherHalfplane>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType_, TLabel >::difference ( const OtherHalfplane & other) const
nodiscard

Returns the regularized set difference of the two shapes (A ∖ B).

A half-plane is the one-constraint half-plane intersection, and is handled as one: see difference(const OtherIntersection&) const.

◆ difference() [3/7]

template<class PointType_, class TLabel>
template<class ResultNumber, HalfplaneIntersectionConcept OtherIntersection>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Triangle< PointType_, TLabel >::difference ( const OtherIntersection & other) const

◆ difference() [4/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, HalfplaneIntersectionConcept OtherIntersection>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType_, TLabel >::difference ( const OtherIntersection & other) const
nodiscard

Returns the regularized set difference of the two shapes (A ∖ B).

A half-plane intersection may be unbounded, which stops it being a regularizedUnion operand but not a subtrahend: A ∖ B is bounded whenever A is, however far B reaches, so a PolygonSet can hold it. See PolygonWithHoles::difference(const OtherIntersection&) const for the clip that bounds it and for the rest of the contract.

◆ difference() [5/7]

template<class PointType_, class TLabel>
template<class ResultNumber, PolygonalRegionConcept OtherRegion>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Triangle< PointType_, TLabel >::difference ( const OtherRegion & other) const

◆ difference() [6/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PolygonalRegionConcept OtherRegion>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType_, TLabel >::difference ( const OtherRegion & other) const
nodiscard

Returns the regularized set difference of the two shapes (A ∖ B).

A difference is not symmetric, so there is no higher-ranked operand to hand the pair to the way regularizedUnion does: a triangle has to state it against every region itself. It states it once, over all six of them, by going through its polygon spelling — the same conversion every other operation makes, and one that costs nothing, the three vertices already being in canonical polygon order. See Polygon::difference for the contract.

Template Parameters
ResultNumberThe number type for the result.
Parameters
otherThe shape to remove.
Returns
The pieces of the difference, in canonical order.

◆ difference() [7/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::difference ( const Shape< OtherPoint > & other) const
inlinenodiscard

Returns the regularized set difference of the two shapes (A ∖ B), re-dispatching through the wrapper's own difference.

A difference is not symmetric, so unlike regularizedUnion this cannot be handed to other as it stands. It wraps this shape instead and lets the wrapper visit both sides, which throws if the pair is unsupported — here, whenever other turns out to hold anything without area, or a Disk. An unbounded alternative is fine on this side, the result being contained in this shape either way. See Polygon::difference for the contract.

The point type is deduced from other so a plain concrete shape cannot reach this overload through an implicit conversion to Shape.

◆ distanceL1() [1/11]

template<class PointType, class LabelType>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherHalfplane & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [2/11]

template<class PointType, class LabelType>
template<class ResultNumber, LineConcept OtherLine>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherLine & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [3/11]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedLineConcept OtherOrientedLine>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherOrientedLine & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [4/11]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [5/11]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherPoint & point) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [6/11]

template<class PointType, class LabelType>
template<class ResultNumber, RayConcept OtherRay>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherRay & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [7/11]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherRectangle & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [8/11]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherSegment & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [9/11]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template distanceL1<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::distanceL1 ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs distanceL1 defined only once, on the higher-ranked shape.

◆ distanceL1() [10/11]

template<class PointType, class LabelType>
template<class ResultNumber, TriangleConcept OtherTriangle>
auto pgl::Triangle< PointType, LabelType >::distanceL1 ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the Manhattan (L1) distance to the given shape.

◆ distanceL1() [11/11]

template<class PointType_, class TLabel>
template<class ResultNumber = double, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::distanceL1 ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceL1.

Distance is symmetric, so this just calls other's own distanceL1, which visits its wrapped alternative and throws if the pair is unsupported.

◆ distanceLInf() [1/11]

template<class PointType, class LabelType>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherHalfplane & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [2/11]

template<class PointType, class LabelType>
template<class ResultNumber, LineConcept OtherLine>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherLine & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [3/11]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedLineConcept OtherOrientedLine>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherOrientedLine & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [4/11]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [5/11]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherPoint & point) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [6/11]

template<class PointType, class LabelType>
template<class ResultNumber, RayConcept OtherRay>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherRay & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [7/11]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherRectangle & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [8/11]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherSegment & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [9/11]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template distanceLInf<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::distanceLInf ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs distanceLInf defined only once, on the higher-ranked shape.

◆ distanceLInf() [10/11]

template<class PointType, class LabelType>
template<class ResultNumber, TriangleConcept OtherTriangle>
auto pgl::Triangle< PointType, LabelType >::distanceLInf ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) distance to the given shape.

◆ distanceLInf() [11/11]

template<class PointType_, class TLabel>
template<class ResultNumber = double, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::distanceLInf ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own distanceLInf.

Distance is symmetric, so this just calls other's own distanceLInf, which visits its wrapped alternative and throws if the pair is unsupported.

◆ edges()

template<class PointType, class LabelType>
std::array< Segment< PointType >, 3 > pgl::Triangle< PointType, LabelType >::edges ( ) const
nodiscardconstexpr

Returns the three unoriented boundary edges.

Returns
Edges (a,b), (b,c), and (c,a).

◆ edgesBegin()

template<class PointType_, class TLabel>
EdgeIterator pgl::Triangle< PointType_, TLabel >::edgesBegin ( ) const
inlineconstexpr

Returns an iterator to the first unoriented edge.

Returns
Iterator to edge (a,b).

◆ edgesEnd()

template<class PointType_, class TLabel>
EdgeIterator pgl::Triangle< PointType_, TLabel >::edgesEnd ( ) const
inlineconstexpr

Returns an iterator past the last unoriented edge.

Returns
Sentinel iterator for edgesBegin().

◆ end()

template<class PointType_, class TLabel>
auto pgl::Triangle< PointType_, TLabel >::end ( ) const
inlineconstexpr

Returns an iterator past the last vertex.

Returns
Const iterator past the last vertex.

◆ fbox()

template<class PointType, class LabelType>
template<std::floating_point ResultNumber>
Rectangle< Point< ResultNumber > > pgl::Triangle< PointType, LabelType >::fbox ( ) const
nodiscardconstexpr

Returns a floating-point bounding box containing the triangle.

Template Parameters
ResultNumberFloating-point coordinate type.
Returns
Floating-point rectangle containing the triangle.

◆ get()

template<class PointType_, class TLabel>
const PointType & pgl::Triangle< PointType_, TLabel >::get ( std::ptrdiff_t index) const
inlineconstexpr

Cyclic access: same as operator[] but index is taken modulo size(); negative indices wrap from the end.

◆ getIfPoint()

template<class PointType, class LabelType>
std::optional< PointType > pgl::Triangle< PointType, LabelType >::getIfPoint ( ) const
nodiscardconstexpr

Returns the point the triangle collapses to, if it does.

Complexity: O(1).

Returns
The common vertex if isPoint, std::nullopt otherwise.

◆ getIfSegment()

template<class PointType, class LabelType>
std::optional< typename Triangle< PointType, LabelType >::template BoundaryType< false > > pgl::Triangle< PointType, LabelType >::getIfSegment ( ) const
nodiscardconstexpr

Returns the segment the triangle collapses to, if it does.

Complexity: O(1).

Returns
The segment spanning the collinear vertices if isSegment, std::nullopt otherwise.

◆ hausdorffDistanceL1() [1/7]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [2/7]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherPoint & point) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [3/7]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherRectangle & other) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [4/7]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherSegment & other) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [5/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template hausdorffDistanceL1<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::hausdorffDistanceL1 ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs hausdorffDistanceL1 defined only once, on the higher-ranked shape.

◆ hausdorffDistanceL1() [6/7]

template<class PointType, class LabelType>
template<class ResultNumber, TriangleConcept OtherTriangle>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceL1 ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the Manhattan (L1) Hausdorff distance to the given shape.

◆ hausdorffDistanceL1() [7/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::hausdorffDistanceL1 ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceL1.

Distance is symmetric, so this just calls other's own hausdorffDistanceL1, which visits its wrapped alternative and throws if the pair is unsupported.

◆ hausdorffDistanceLInf() [1/7]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [2/7]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherPoint & point) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [3/7]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherRectangle & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [4/7]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherSegment & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [5/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template hausdorffDistanceLInf<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::hausdorffDistanceLInf ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs hausdorffDistanceLInf defined only once, on the higher-ranked shape.

◆ hausdorffDistanceLInf() [6/7]

template<class PointType, class LabelType>
template<class ResultNumber, TriangleConcept OtherTriangle>
auto pgl::Triangle< PointType, LabelType >::hausdorffDistanceLInf ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the Chebyshev (LInf) Hausdorff distance to the given shape.

◆ hausdorffDistanceLInf() [7/7]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::hausdorffDistanceLInf ( const Shape< OtherPoint > & other) const
inlinenodiscardconstexpr

Returns the distance to the given shape, using symmetry to re-dispatch through the wrapper's own hausdorffDistanceLInf.

Distance is symmetric, so this just calls other's own hausdorffDistanceLInf, which visits its wrapped alternative and throws if the pair is unsupported.

◆ index()

template<class PointType_, class TLabel>
std::ptrdiff_t pgl::Triangle< PointType_, TLabel >::index ( const PointType & point) const
inlineconstexpr

Returns the smallest index i with (*this)[i] == point, or -1 if no vertex equals point.

◆ interiorContains() [1/18]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Triangle< PointType_, TLabel >::interiorContains ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [2/18]

template<class PointType, class LabelType>
template<MonotoneChainConcept OtherChain>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherChain & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [3/18]

template<class PointType, class LabelType>
template<ConvexConcept OtherConvex>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherConvex & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [4/18]

template<class PointType, class LabelType>
template<DiskConcept OtherDisk>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherDisk & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [5/18]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherHalfplane & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [6/18]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherLine & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [7/18]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherOrientedLine & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [8/18]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [9/18]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherPoint & point) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

Template Parameters
OtherPointPoint type.
Parameters
pointPoint to test.
Returns
true if the point is contained and not on the boundary.

Triangle

Triangle boundary, containment, intersection, and cut predicates, including triangle-vs-rectangle and triangle-vs-triangle topological cases.

◆ interiorContains() [10/18]

template<class PointType, class LabelType>
template<PolygonConcept OtherPolygon>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherPolygon & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [11/18]

template<class PointType, class LabelType>
template<PolylineConcept OtherPolyline>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherPolyline & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [12/18]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherRay & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [13/18]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherRectangle & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [14/18]

template<class PointType_, class TLabel>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Triangle< PointType_, TLabel >::interiorContains ( const OtherRegion & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [15/18]

template<class PointType, class LabelType>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherRegion & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [16/18]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherSegment & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [17/18]

template<class PointType_, class TLabel>
template<PolygonSetConcept OtherSet>
bool pgl::Triangle< PointType_, TLabel >::interiorContains ( const OtherSet & other) const
inlinenodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorContains() [18/18]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Triangle< PointType, LabelType >::interiorContains ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Tests whether this shape's interior contains the other shape (A∖∂A ⊇ B).

◆ interiorsIntersect() [1/12]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Triangle< PointType_, TLabel >::interiorsIntersect ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [2/12]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherHalfplane & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [3/12]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherLine & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [4/12]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherOrientedLine & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [5/12]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [6/12]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherPoint & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

Triangle

Triangle boundary, containment, intersection, and cut predicates, including triangle-vs-rectangle and triangle-vs-triangle topological cases.

◆ interiorsIntersect() [7/12]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherRay & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [8/12]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherRectangle & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [9/12]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherSegment & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [10/12]

template<class PointType_, class TLabel>
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
bool pgl::Triangle< PointType_, TLabel >::interiorsIntersect ( const OtherShape & other) const
inlinenodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [11/12]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ interiorsIntersect() [12/12]

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::interiorsIntersect ( const Shape< PointType > & other) const
nodiscardconstexpr

Tests whether the interiors of the two shapes intersect ((A∖∂A) ∩ (B∖∂B) ≠ ∅).

◆ intersection() [1/13]

template<class PointType_, class TLabel>
template<class ResultNumber = NumberType, class EmptyPoint>
EmptyShape< EmptyPoint > pgl::Triangle< PointType_, TLabel >::intersection ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

◆ intersection() [2/13]

template<class PointType, class LabelType>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
auto pgl::Triangle< PointType, LabelType >::intersection ( const OtherHalfplane & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [3/13]

template<class PointType, class LabelType>
template<class ResultNumber, LineConcept OtherLine>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Triangle< PointType, LabelType >::intersection ( const OtherLine & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [4/13]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedLineConcept OtherOrientedLine>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Triangle< PointType, LabelType >::intersection ( const OtherOrientedLine & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [5/13]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Triangle< PointType, LabelType >::intersection ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [6/13]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
std::optional< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType, LabelType >::intersection ( const OtherPoint & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Template Parameters
ResultNumberCoordinate type of the returned point.
OtherPointPoint type.
Parameters
otherPoint to intersect with.
Returns
The point when contained, otherwise empty.

◆ intersection() [7/13]

template<class PointType, class LabelType>
template<class ResultNumber, RayConcept OtherRay>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Triangle< PointType, LabelType >::intersection ( const OtherRay & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [8/13]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Triangle< PointType, LabelType >::intersection ( const OtherRectangle & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [9/13]

template<class PointType_, class TLabel>
template<class ResultNumber = NumberType, HalfplaneIntersectionConcept OtherRegion>
auto pgl::Triangle< PointType_, TLabel >::intersection ( const OtherRegion & other) const
inlinenodiscardconstexpr

Adds this triangle's three constraints to a half-plane intersection without deriving vertices.

◆ intersection() [10/13]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
std::optional< std::variant< Point< ResultNumber, typename PointType::LabelType >, Segment< Point< ResultNumber, typename PointType::LabelType > > > > pgl::Triangle< PointType, LabelType >::intersection ( const OtherSegment & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [11/13]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && !HalfplaneIntersectionConcept<OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self) { o.template intersection
<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::intersection ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [12/13]

template<class PointType, class LabelType>
template<class ResultNumber, TriangleConcept OtherTriangle>
auto pgl::Triangle< PointType, LabelType >::intersection ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the intersection of the two shapes (A ∩ B), empty when they are disjoint.

Warning
Divides coordinates after casting to ResultNumber.

◆ intersection() [13/13]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::intersection ( const Shape< OtherPoint > & other) const
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.

Returns
The intersection wrapped in a Shape, rather than the tighter type the concrete pair would answer with: which alternative other holds is not known until run time, so neither is the result's.

◆ intersects() [1/12]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Triangle< PointType_, TLabel >::intersects ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [2/12]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherHalfplane & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [3/12]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherLine & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [4/12]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherOrientedLine & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [5/12]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [6/12]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherPoint & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

Template Parameters
OtherPointPoint type.
Parameters
otherPoint to test.
Returns
true if the point is contained.

Triangle

Triangle boundary, containment, intersection, and cut predicates, including triangle-vs-rectangle and triangle-vs-triangle topological cases.

◆ intersects() [7/12]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherRay & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [8/12]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherRectangle & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [9/12]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherSegment & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [10/12]

template<class PointType_, class TLabel>
template<typename OtherShape>
requires (!PointConcept<OtherShape> && detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>)
bool pgl::Triangle< PointType_, TLabel >::intersects ( const OtherShape & other) const
inlinenodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [11/12]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Triangle< PointType, LabelType >::intersects ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ intersects() [12/12]

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::intersects ( const Shape< PointType > & other) const
nodiscardconstexpr

Tests whether this shape and the other shape intersect (A ∩ B ≠ ∅).

◆ isDegenerate()

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::isDegenerate ( ) const
nodiscardconstexpr

Tests whether the three vertices are collinear.

Returns
true when twiceArea is zero.

Triangle

Triangle boundary, containment, intersection, and cut predicates, including triangle-vs-rectangle and triangle-vs-triangle topological cases.

◆ isIsosceles()

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::isIsosceles ( ) const
nodiscardconstexpr

Tests whether two sides have the same length.

Returns
true if at least one pair of side lengths is equal.

◆ isObtuse()

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::isObtuse ( ) const
nodiscardconstexpr

Tests whether the triangle has an obtuse angle.

Returns
true if one angle is strictly greater than 90 degrees.

◆ isPoint()

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::isPoint ( ) const
nodiscardconstexpr

Returns whether the triangle collapses to a single point.

Complexity: O(1).

Returns
true if all three vertices coincide.

◆ isRectangle()

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::isRectangle ( ) const
nodiscardconstexpr

Tests whether the triangle has a right angle.

Returns
true if one angle is exactly 90 degrees.

◆ isSegment()

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::isSegment ( ) const
nodiscardconstexpr

Returns whether the triangle collapses to a non-degenerate segment.

True when the vertices are collinear but not all equal, so the triangle covers exactly the segment spanning them.

Complexity: O(1).

Returns
true if the triangle is a segment of positive length.

◆ isUndefined()

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::isUndefined ( ) const
nodiscardconstexpr

Returns whether the triangle is degenerate without collapsing to a point or to a segment.

A triangle is never undefined: collinear vertices always span a point or a segment, so this always returns false. Provided for uniformity with the other shapes.

Complexity: O(1).

Returns
false.

◆ label()

template<class PointType_, class TLabel>
template<class A = LabelType>
requires (detail::has_label_v<A>)
A & pgl::Triangle< PointType_, TLabel >::label ( ) const
inlineconstexpr

Returns the triangle label.

The label is mutable even through a const triangle: it is metadata that does not participate in equality, hashing, or geometric predicates.

Returns
Reference to the stored label.

◆ latticePoints()

template<class PointType, class LabelType>
requires (detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
template<class ResultNumber>
requires (detail::extended_integral<ResultNumber> || std::same_as<ResultNumber, BigInt>)
std::vector< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType, LabelType >::latticePoints ( ) const
nodiscard

Returns the integer points the triangle contains.

The boundary included: a point on an edge is a point of the shape. The boundary answers for its own points, edge by edge as segments, and a sweep over the columns of the bounding box answers for the rest, so the cost is one pass over the edges plus one point per point reported.

Template Parameters
ResultNumberInteger 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.
Returns
The lattice points, in increasing order, carrying no label.
Exceptions
std::logic_errorIf a coordinate is not finite, or a lattice point of the shape does not fit ResultNumber.
std::length_errorIf there are more of them than a vector holds.

◆ minkowskiErosion() [1/2]

template<class PointType_, class TLabel>
template<class OtherShape>
requires (!MinkowskiSummableConcept<Triangle<PointType_, TLabel>, OtherShape> && BoundedPolygonalConcept<OtherShape>)
auto pgl::Triangle< PointType_, TLabel >::minkowskiErosion ( const OtherShape & other) const
nodiscardconstexpr

Returns the Minkowski erosion of this shape by a bounded polygonal one (A ⊖ B).

The pairs MinkowskiSummableConcept turns away, which are exactly the ones whose sum needs a region: a sum sweeps the operand's concavity into its answer, so it is the operand that decides the result type, and minkowskiSum hands the pair over to it.

An erosion reads the operand only through its support function, and a support function sees no further than the convex hull – A ⊖ B is A ⊖ hull(B) for a convex A. So this shape keeps the pair and answers it with the same convex region it erodes to by any other operand, at a cost linear in the two sizes: a Polygon, a PolygonWithHoles, a PolygonSet, a Polyline and a MonotoneChain are all as cheap here as their vertex count.

Template Parameters
OtherShapeType of the shape to erode by.
Parameters
otherShape to erode by.
Returns
The erosion, as a HalfplaneIntersection – the whole plane when other covers no point.

◆ minkowskiErosion() [2/2]

template<class PointType_, class TLabel>
requires MinkowskiSummableConcept<Triangle<PointType_, TLabel>, OtherShape>
template<class OtherShape>
requires MinkowskiSummableConcept<Triangle<PointType_, TLabel>, OtherShape>
auto pgl::Triangle< PointType_, TLabel >::minkowskiErosion ( const OtherShape & other) const
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 triangle erodes to the region its three constraints leave once each is moved in.

Eroding by a shape that covers no point is the whole plane, which a HalfplaneIntersection returns and the tighter result types cannot.

Template Parameters
OtherShapeType of the shape to erode by.
Parameters
otherShape to erode by.
Returns
The erosion, in the tightest type that represents it.

◆ minkowskiSum() [1/2]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!MinkowskiSummableConcept<Triangle<PointType_, TLabel>, OtherShape> && (detail::shapeRank<OtherShape>
> detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self) { o.template minkowskiSum
<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::minkowskiSum ( const OtherShape & other) const
inlinenodiscard

Returns the regularized Minkowski sum of the two shapes (A ⊕ B).

The pairs MinkowskiSummableConcept rejects are exactly the ones whose sum needs a region-valued result rather than one bounded convex shape; they are implemented on Polygon and PolygonWithHoles. Forwards to the other shape's implementation so that each unordered pair needs the sum defined only once, on the higher-ranked shape.

◆ minkowskiSum() [2/2]

template<class PointType, class LabelType>
requires MinkowskiSummableConcept<Triangle<PointType_, TLabel>, OtherShape>
template<class OtherShape>
requires MinkowskiSummableConcept<Triangle<PointType_, TLabel>, OtherShape>
auto pgl::Triangle< PointType, LabelType >::minkowskiSum ( const OtherShape & other) const
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.

Template Parameters
OtherShapeType of the other shape.
Parameters
otherShape to sum with.
Returns
The Minkowski sum, in the tightest type that represents it.

◆ operator Convex< PointType >()

template<class PointType_, class TLabel>
pgl::Triangle< PointType_, TLabel >::operator Convex< PointType > ( ) const
inlineexplicitnodiscardconstexpr

Converts the triangle to a convex polygon.

The three vertices already follow the canonical convex order (counterclockwise, lexicographically smallest first), and degenerate triangles collapse to their hull.

Returns
Convex polygon with the same vertices.

◆ operator Polygon< PointType >()

template<class PointType_, class TLabel>
pgl::Triangle< PointType_, TLabel >::operator Polygon< PointType > ( ) const
inlineexplicitnodiscardconstexpr

Converts the triangle to a simple polygon.

The three vertices already follow the canonical polygon order (counterclockwise, lexicographically smallest first).

Returns
Polygon with the same vertices.

◆ operator*=() [1/2]

template<class PointType_, class TLabel>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
Triangle< PointType, LabelType > & pgl::Triangle< PointType_, TLabel >::operator*= ( const Scalar & scalar)
constexpr

◆ operator*=() [2/2]

template<class PointType_, class TLabel>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
Triangle & pgl::Triangle< PointType_, TLabel >::operator*= ( const Scalar & scalar)
constexpr

Scales all vertices by a scalar in place.

◆ operator+=() [1/2]

template<class PointType_, class TLabel>
template<PointConcept OtherPoint>
Triangle< PointType, LabelType > & pgl::Triangle< PointType_, TLabel >::operator+= ( const OtherPoint & translation)
constexpr

◆ operator+=() [2/2]

template<class PointType_, class TLabel>
template<PointConcept OtherPoint>
Triangle & pgl::Triangle< PointType_, TLabel >::operator+= ( const OtherPoint & translation)
constexpr

Translates all vertices by a point in place.

◆ operator-=() [1/2]

template<class PointType_, class TLabel>
template<PointConcept OtherPoint>
Triangle< PointType, LabelType > & pgl::Triangle< PointType_, TLabel >::operator-= ( const OtherPoint & translation)
constexpr

◆ operator-=() [2/2]

template<class PointType_, class TLabel>
template<PointConcept OtherPoint>
Triangle & pgl::Triangle< PointType_, TLabel >::operator-= ( const OtherPoint & translation)
constexpr

Translates all vertices by the opposite of a point in place.

◆ operator/=() [1/2]

template<class PointType_, class TLabel>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
Triangle< PointType, LabelType > & pgl::Triangle< PointType_, TLabel >::operator/= ( const Scalar & scalar)
constexpr

◆ operator/=() [2/2]

template<class PointType_, class TLabel>
template<class Scalar>
requires (!detail::is_point_v<Scalar> && !TransformationConcept<Scalar>)
Triangle & pgl::Triangle< PointType_, TLabel >::operator/= ( const Scalar & scalar)
constexpr

Divides all vertices by a scalar in place.

◆ operator<=>()

template<class PointType_, class TLabel>
auto pgl::Triangle< PointType_, TLabel >::operator<=> ( const Triangle< PointType_, TLabel > & other) const
inlineconstexpr

Orders triangles lexicographically by their vertices, ignoring the label.

◆ operator=()

template<class PointType_, class TLabel>
template<PointConcept OtherPointType, class OtherLabelType>
requires (std::constructible_from<PointType, const OtherPointType&>)
Triangle & pgl::Triangle< PointType_, TLabel >::operator= ( const Triangle< OtherPointType, OtherLabelType > & other)
inlineconstexpr

Assigns from a triangle with compatible vertex type.

Template Parameters
OtherPointTypeSource vertex type.
Parameters
otherSource triangle.
Returns
This triangle.

◆ operator==()

template<class PointType_, class TLabel>
bool pgl::Triangle< PointType_, TLabel >::operator== ( const Triangle< PointType_, TLabel > & other) const
inlineconstexpr

Compares triangles lexicographically by canonical vertices.

Parameters
otherTriangle to compare with.
Returns
Comparison result.

◆ operator[]()

template<class PointType_, class TLabel>
const PointType & pgl::Triangle< PointType_, TLabel >::operator[] ( std::size_t index) const
inlineconstexpr

Returns vertex 0, 1, or 2.

Parameters
indexVertex index.
Returns
Reference to the selected vertex.

◆ orientedEdges()

template<class PointType, class LabelType>
std::array< OrientedSegment< PointType >, 3 > pgl::Triangle< PointType, LabelType >::orientedEdges ( ) const
nodiscardconstexpr

Returns the three oriented boundary edges.

Returns
Oriented edges a->b, b->c, and c->a.

◆ orientedEdgesBegin()

template<class PointType_, class TLabel>
OrientedEdgeIterator pgl::Triangle< PointType_, TLabel >::orientedEdgesBegin ( ) const
inlineconstexpr

Returns an iterator to the first oriented edge.

Returns
Iterator to edge a->b.

◆ orientedEdgesEnd()

template<class PointType_, class TLabel>
OrientedEdgeIterator pgl::Triangle< PointType_, TLabel >::orientedEdgesEnd ( ) const
inlineconstexpr

Returns an iterator past the last oriented edge.

Returns
Sentinel iterator for orientedEdgesBegin().

◆ pointInside()

template<class PointType, class LabelType>
template<class ResultNumber>
Point< ResultNumber > pgl::Triangle< PointType, LabelType >::pointInside ( ) const
nodiscardconstexpr

Returns a point inside the triangle.

Template Parameters
ResultNumberCoordinate type of the returned point.
Returns
A point strictly inside every non-degenerate triangle.
Warning
Divides coordinates by 4. Inexact for integer coordinates not divisible by 4.

◆ pointInsideInteriorContainedIn()

template<class PointType, class LabelType>
template<class OtherShape>
bool pgl::Triangle< PointType, LabelType >::pointInsideInteriorContainedIn ( const OtherShape & shape) const
nodiscardconstexpr

Tests whether some point in this shape's relative interior lies in the strict interior of shape.

Uses pointInside as the witness. When integer truncation rounds that witness onto or outside the boundary, this shape and shape are scaled so the witness is exact, leaving the containment relation unchanged.

◆ regularizedIntersection() [1/2]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires (!PointConcept<OtherShape> && (detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape&
o, const Triangle& self) { o.template regularizedIntersection<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::regularizedIntersection ( const OtherShape & other) const
inlinenodiscardconstexpr

Forwards a regularized intersection to the shape that owns it.

◆ regularizedIntersection() [2/2]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::regularizedIntersection ( const Shape< OtherPoint > & other) const
inlinenodiscard

Re-dispatches a regularized intersection through a runtime shape.

◆ regularizedUnion() [1/6]

template<class PointType_, class TLabel>
template<class ResultNumber, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Triangle< PointType_, TLabel >::regularizedUnion ( const OtherRectangle & other) const

◆ regularizedUnion() [2/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType_, TLabel >::regularizedUnion ( const OtherRectangle & other) const
nodiscard

Returns the regularized union of the two shapes (A ∪ B).

◆ regularizedUnion() [3/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template regularizedUnion<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::regularizedUnion ( const OtherShape & other) const
inlinenodiscard

Returns the regularized union of the two shapes (A ∪ B).

Forwards to the other shape's implementation so that each unordered pair needs regularizedUnion defined only once, on the higher-ranked shape. See Polygon::regularizedUnion for the contract.

◆ regularizedUnion() [4/6]

template<class PointType_, class TLabel>
template<class ResultNumber, TriangleConcept OtherTriangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Triangle< PointType_, TLabel >::regularizedUnion ( const OtherTriangle< PointType_, TLabel > & other) const

◆ regularizedUnion() [5/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType_, TLabel >::regularizedUnion ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscard

Returns the regularized union of the two shapes (A ∪ B).

The union of two bounded convex shapes is convex only by coincidence — two that overlap in a corner make an L, and two that are apart make two pieces — so it answers with a set of regions like every other union. A triangle owns this pair and the one with a Rectangle, being the higher-ranked of the two; the pairs with an operand above it are defined there and reached through the forwarding overload below. See Polygon::regularizedUnion for the contract.

Template Parameters
ResultNumberThe number type for the result.
Parameters
otherThe shape to unite with.
Returns
The pieces of the union, in canonical order.

◆ regularizedUnion() [6/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::regularizedUnion ( const Shape< OtherPoint > & other) const
inlinenodiscard

Returns the regularized union of the two shapes (A ∪ B), re-dispatching through the wrapper's own regularizedUnion.

A union is symmetric, so this just calls other's own regularizedUnion, which visits its wrapped alternative and throws if the pair is unsupported — here, whenever other turns out to hold anything but a bounded polygonal region. See Polygon::regularizedUnion for the contract.

The point type is deduced from other so a plain concrete shape cannot reach this overload through an implicit conversion to Shape.

◆ rotate90()

template<class PointType, class LabelType>
void pgl::Triangle< PointType, LabelType >::rotate90 ( int k = 1)
constexpr

Rotates the triangle by 90k degrees around the origin in place.

Parameters
kNumber of 90-degree CCW rotations (may be negative).

◆ rotated90()

template<class PointType, class LabelType>
Triangle< PointType, LabelType > pgl::Triangle< PointType, LabelType >::rotated90 ( int k = 1) const
nodiscardconstexpr

Returns the triangle rotated by 90k degrees around the origin.

Parameters
kNumber of 90-degree CCW rotations (may be negative).
Returns
Rotated triangle.

◆ samePointSet()

template<class PointType, class LabelType>
template<AnyShapeConcept OtherShape>
bool pgl::Triangle< PointType, LabelType >::samePointSet ( const OtherShape & other) const
nodiscardconstexpr

Tests whether another shape defines exactly the same point set.

◆ scaledDownX() [1/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Triangle< PointType, LabelType > pgl::Triangle< PointType_, TLabel >::scaledDownX ( const OtherNumber scalar) const
constexpr

◆ scaledDownX() [2/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Triangle pgl::Triangle< PointType_, TLabel >::scaledDownX ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the triangle with its x-coordinates divided by a divisor.

◆ scaledDownY() [1/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Triangle< PointType, LabelType > pgl::Triangle< PointType_, TLabel >::scaledDownY ( const OtherNumber scalar) const
constexpr

◆ scaledDownY() [2/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Triangle pgl::Triangle< PointType_, TLabel >::scaledDownY ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the triangle with its y-coordinates divided by a divisor.

◆ scaleDownX()

template<class PointType, class LabelType>
template<class OtherNumber>
void pgl::Triangle< PointType, LabelType >::scaleDownX ( const OtherNumber scalar)
constexpr

Divides the triangle's x-coordinates by a divisor in place.

◆ scaleDownY()

template<class PointType, class LabelType>
template<class OtherNumber>
void pgl::Triangle< PointType, LabelType >::scaleDownY ( const OtherNumber scalar)
constexpr

Divides the triangle's y-coordinates by a divisor in place.

◆ scaledUpX() [1/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Triangle< PointType, LabelType > pgl::Triangle< PointType_, TLabel >::scaledUpX ( const OtherNumber scalar) const
constexpr

◆ scaledUpX() [2/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Triangle pgl::Triangle< PointType_, TLabel >::scaledUpX ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the triangle with its x-coordinates multiplied by a factor.

◆ scaledUpY() [1/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Triangle< PointType, LabelType > pgl::Triangle< PointType_, TLabel >::scaledUpY ( const OtherNumber scalar) const
constexpr

◆ scaledUpY() [2/2]

template<class PointType_, class TLabel>
template<class OtherNumber>
Triangle pgl::Triangle< PointType_, TLabel >::scaledUpY ( const OtherNumber scalar) const
nodiscardconstexpr

Returns the triangle with its y-coordinates multiplied by a factor.

◆ scaleUpX()

template<class PointType, class LabelType>
template<class OtherNumber>
void pgl::Triangle< PointType, LabelType >::scaleUpX ( const OtherNumber scalar)
constexpr

Multiplies the triangle's x-coordinates by a factor in place.

◆ scaleUpY()

template<class PointType, class LabelType>
template<class OtherNumber>
void pgl::Triangle< PointType, LabelType >::scaleUpY ( const OtherNumber scalar)
constexpr

Multiplies the triangle's y-coordinates by a factor in place.

◆ separates() [1/19]

template<class PointType_, class TLabel>
template<class EmptyPoint>
bool pgl::Triangle< PointType_, TLabel >::separates ( const EmptyShape< EmptyPoint > & ) const
inlinenodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [2/19]

template<class PointType, class LabelType>
template<MonotoneChainConcept OtherChain>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherChain & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [3/19]

template<class PointType, class LabelType>
template<ConvexConcept OtherConvex>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherConvex & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [4/19]

template<class PointType, class LabelType>
template<DiskConcept OtherDisk>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherDisk & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [5/19]

template<class PointType, class LabelType>
template<HalfplaneConcept OtherHalfplane>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherHalfplane & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [6/19]

template<class PointType, class LabelType>
template<LineConcept OtherLine>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherLine & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [7/19]

template<class PointType, class LabelType>
template<OrientedLineConcept OtherOrientedLine>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherOrientedLine & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [8/19]

template<class PointType, class LabelType>
template<OrientedSegmentConcept OtherOrientedSegment>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [9/19]

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherPoint & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [10/19]

template<class PointType, class LabelType>
template<PolygonConcept OtherPolygon>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherPolygon & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [11/19]

template<class PointType, class LabelType>
template<PolylineConcept OtherPolyline>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherPolyline & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [12/19]

template<class PointType, class LabelType>
template<RayConcept OtherRay>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherRay & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [13/19]

template<class PointType, class LabelType>
template<RectangleConcept OtherRectangle>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherRectangle & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [14/19]

template<class PointType, class LabelType>
template<PolygonWithHolesConcept OtherRegion>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherRegion & other) const
nodiscard

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

The region is settled by the cell engine of implementation/separates.hpp; see the notes on pgl::PolygonWithHoles::separates for what a region admits that a simply connected target does not.

◆ separates() [15/19]

template<class PointType, class LabelType>
template<HalfplaneIntersectionConcept OtherRegion>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherRegion & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [16/19]

template<class PointType, class LabelType>
template<SegmentConcept OtherSegment>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherSegment & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

Triangle

Triangle boundary, containment, intersection, and cut predicates, including triangle-vs-rectangle and triangle-vs-triangle topological cases.

◆ separates() [17/19]

template<class PointType, class LabelType>
template<PolygonSetConcept OtherSet>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherSet & other) const
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.

◆ separates() [18/19]

template<class PointType, class LabelType>
template<TriangleConcept OtherTriangle>
bool pgl::Triangle< PointType, LabelType >::separates ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ separates() [19/19]

template<class PointType, class LabelType>
bool pgl::Triangle< PointType, LabelType >::separates ( const Shape< PointType > & other) const
nodiscardconstexpr

Tests whether removing this shape disconnects the other shape (B∖A is disconnected).

◆ size()

template<class PointType_, class TLabel>
constexpr std::size_t pgl::Triangle< PointType_, TLabel >::size ( )
inlinestaticconstexpr

Returns the number of vertices (always 3).

◆ squaredDistance() [1/11]

template<class PointType_, class TLabel>
template<class ResultNumber = double, class DiskPointType, class DiskLabel>
detail::floating_result_t< ResultNumber > pgl::Triangle< PointType_, TLabel >::squaredDistance ( const Disk< DiskPointType, DiskLabel > & disk) const
inlinenodiscard

Returns the squared Euclidean distance to a disk.

Forwards to Disk::squaredDistance. Reports in detail::floating_result_t<ResultNumber>: a distance realized on a circle is generally irrational, so a floating-point ResultNumber is honoured as asked and any other request falls back to double.

◆ squaredDistance() [2/11]

template<class PointType, class LabelType>
template<class ResultNumber, HalfplaneConcept OtherHalfplane>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherHalfplane & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredDistance() [3/11]

template<class PointType, class LabelType>
template<class ResultNumber, LineConcept OtherLine>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherLine & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredDistance() [4/11]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedLineConcept OtherOrientedLine>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherOrientedLine & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredDistance() [5/11]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredDistance() [6/11]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherPoint & point) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredDistance() [7/11]

template<class PointType, class LabelType>
template<class ResultNumber, RayConcept OtherRay>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherRay & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredDistance() [8/11]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherRectangle & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredDistance() [9/11]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherSegment & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredDistance() [10/11]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template squaredDistance<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::squaredDistance ( const OtherShape & other) const
inlinenodiscardconstexpr

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.

◆ squaredDistance() [11/11]

template<class PointType, class LabelType>
template<class ResultNumber, TriangleConcept OtherTriangle>
auto pgl::Triangle< PointType, LabelType >::squaredDistance ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the squared Euclidean distance to the given shape.

Zero when the triangle contains the point; otherwise the smallest squared distance from the point to a triangle edge.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: division_result_t).
Warning
With an integer ResultNumber the exact squared distance is generally a fraction, so the internal division truncates and the result is inexact. Request a floating-point or pgl::Rational result type, e.g. squaredDistance<double>(point), for an accurate value.

◆ squaredHausdorffDistance() [1/6]

template<class PointType, class LabelType>
template<class ResultNumber, OrientedSegmentConcept OtherOrientedSegment>
auto pgl::Triangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherOrientedSegment & other) const
nodiscardconstexpr

Returns the squared Hausdorff distance to the given shape.

The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).

◆ squaredHausdorffDistance() [2/6]

template<class PointType, class LabelType>
template<class ResultNumber, PointConcept OtherPoint>
auto pgl::Triangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherPoint & point) const
nodiscardconstexpr

Returns the squared Hausdorff distance to the given shape.

The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).

◆ squaredHausdorffDistance() [3/6]

template<class PointType, class LabelType>
template<class ResultNumber, RectangleConcept OtherRectangle>
auto pgl::Triangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherRectangle & other) const
nodiscardconstexpr

Returns the squared Hausdorff distance to the given shape.

The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).

◆ squaredHausdorffDistance() [4/6]

template<class PointType, class LabelType>
template<class ResultNumber, SegmentConcept OtherSegment>
auto pgl::Triangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherSegment & other) const
nodiscardconstexpr

Returns the squared Hausdorff distance to the given shape.

The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).

◆ squaredHausdorffDistance() [5/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template squaredHausdorffDistance<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::squaredHausdorffDistance ( const OtherShape & other) const
inlinenodiscardconstexpr

Returns the squared Hausdorff distance to the given shape.

Forwards to the other shape's implementation so that each unordered pair needs squaredHausdorffDistance defined only once, on the higher-ranked shape.

◆ squaredHausdorffDistance() [6/6]

template<class PointType, class LabelType>
template<class ResultNumber, TriangleConcept OtherTriangle>
auto pgl::Triangle< PointType, LabelType >::squaredHausdorffDistance ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscardconstexpr

Returns the squared Hausdorff distance to the given shape.

The directed Hausdorff distance in either direction is attained at a vertex of the source shape, since distance to a convex shape is convex and its supremum over any polygon is attained at a vertex.

Template Parameters
ResultNumberCoordinate type of the returned distance (default: NumberType).

◆ symmetricDifference() [1/6]

template<class PointType_, class TLabel>
template<class ResultNumber, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Triangle< PointType_, TLabel >::symmetricDifference ( const OtherRectangle & other) const

◆ symmetricDifference() [2/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, RectangleConcept OtherRectangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType_, TLabel >::symmetricDifference ( const OtherRectangle & other) const
nodiscard

Returns the regularized symmetric difference of the two shapes (A △ B).

◆ symmetricDifference() [3/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, typename OtherShape>
requires ((detail::shapeRank<OtherShape> > detail::shapeRank<Triangle>) && requires(const OtherShape& o, const Triangle& self)
{ o.template symmetricDifference<ResultNumber>(self); })
auto pgl::Triangle< PointType_, TLabel >::symmetricDifference ( const OtherShape & other) const
inlinenodiscard

Returns the regularized symmetric difference of the two shapes (A △ B).

Forwards to the other shape's implementation so that each unordered pair needs symmetricDifference defined only once, on the higher-ranked shape. See Polygon::symmetricDifference for the contract.

◆ symmetricDifference() [4/6]

template<class PointType_, class TLabel>
template<class ResultNumber, TriangleConcept OtherTriangle>
PolygonSet< Point< ResultNumber, typename PointType_::LabelType > > pgl::Triangle< PointType_, TLabel >::symmetricDifference ( const OtherTriangle< PointType_, TLabel > & other) const

◆ symmetricDifference() [5/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, TriangleConcept OtherTriangle>
PolygonSet< Point< ResultNumber, typename PointType::LabelType > > pgl::Triangle< PointType_, TLabel >::symmetricDifference ( const OtherTriangle< PointType_, TLabel > & other) const
nodiscard

Returns the regularized symmetric difference of the two shapes (A △ B).

A triangle owns this pair and the one with a Rectangle, being the higher-ranked of the two; the pairs with an operand above it are defined there and reached through the forwarding overload below. See Polygon::symmetricDifference for the contract.

Template Parameters
ResultNumberThe number type for the result.
Parameters
otherThe other shape.
Returns
The pieces of the symmetric difference, in canonical order.

◆ symmetricDifference() [6/6]

template<class PointType_, class TLabel>
template<class ResultNumber = division_result_t<NumberType>, PointConcept OtherPoint>
auto pgl::Triangle< PointType_, TLabel >::symmetricDifference ( const Shape< OtherPoint > & other) const
inlinenodiscard

Returns the regularized symmetric difference of the two shapes (A △ B), re-dispatching through the wrapper's own symmetricDifference.

A symmetric difference is symmetric, so this just calls other's own, which visits its wrapped alternative and throws if the pair is unsupported. See Polygon::symmetricDifference for the contract.

The point type is deduced from other so a plain concrete shape cannot reach this overload through an implicit conversion to Shape.

◆ twiceArea()

template<class PointType, class LabelType>
Triangle< PointType, LabelType >::NumberType pgl::Triangle< PointType, LabelType >::twiceArea ( ) const
nodiscardconstexpr

Returns twice the area of the triangle.

Returns
Twice the non-negative area.

◆ vertices()

template<class PointType, class LabelType>
std::array< PointType, 3 > pgl::Triangle< PointType, LabelType >::vertices ( ) const
nodiscardconstexpr

Returns the vertices in canonical order.

Returns
Array {a(), b(), c()}.

◆ verticesContain()

template<class PointType, class LabelType>
template<PointConcept OtherPoint>
bool pgl::Triangle< PointType, LabelType >::verticesContain ( const OtherPoint & point) const
nodiscardconstexpr

Tests whether a point equals one of the vertices.

Template Parameters
OtherPointPoint type.
Parameters
pointPoint to test.
Returns
true if the point is one of a(), b(), or c().