Pangolin
Header-only C++20 plane computational geometry library
Loading...
Searching...
No Matches
pgl.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#if defined(_MSVC_LANG)
9# define PGL_CPLUSPLUS _MSVC_LANG
10#else
11# define PGL_CPLUSPLUS __cplusplus
12#endif
13
14#if PGL_CPLUSPLUS < 202002L
15# error "PGL requires C++20 or newer. Compile with -std=c++20 (or later)."
16#endif
17
18#undef PGL_CPLUSPLUS
19
20// This umbrella simply includes every header in dependency order. Each header is
21// self-contained: it includes its immediate predecessor in that order, which
22// transitively pulls in everything it depends on. As a result a user may include
23// any single header directly and get the same result as including pgl.hpp, while
24// each header still parses cleanly on its own (no recursion through the umbrella).
25#include "core/forward.hpp"
26#include "core/handle.hpp"
27#include "core/numeric.hpp"
28#include "core/bigint.hpp"
29#include "core/rational.hpp"
31#include "shape/point.hpp"
32#include "shape/emptyshape.hpp"
34#include "shape/segment.hpp"
36#include "shape/halfplane.hpp"
37#include "shape/line.hpp"
39#include "shape/ray.hpp"
40#include "shape/rectangle.hpp"
41#include "shape/triangle.hpp"
42#include "shape/disk.hpp"
43#include "shape/convex.hpp"
45#include "shape/polyline.hpp"
46#include "shape/polygon.hpp"
49#include "shape/polygonset.hpp"
50#include "shape/shape.hpp"
51#include "implementation/io.hpp"
66#include "core/hash.hpp"
68#include "algorithm/graph.hpp"
72#include "algorithm/mindisk.hpp"
76#include "algorithm/xysweep.hpp"
86
87// -----------------------------------------------------------------------------
88// Exact convenience aliases
89//
90// "E"-prefixed shorthands for the exact, overflow-free configuration: rationals
91// backed by arbitrary-precision integers (Rational<BigInt>) over labelless
92// shapes. Reach for these when coordinates may grow without bound (repeated
93// intersections, constructions, duality) and correctness matters more than the
94// speed of fixed-width arithmetic.
95namespace pgl {
96
117
118} // namespace pgl
Planar subdivision induced by a set of one-dimensional shapes.
Coordinate-evaluation helpers for linear primitives.
Arbitrary precision signed integers, optimized for small values.
One bit per cell over a fixed rectangular window of the integer grid.
Regularized boolean operations on closed polygonal regions.
Bounding-box and rectangle-boundary operations.
Lightweight SVG canvas for drawing Pangolin shapes.
Witnesses for squaredDistance: which elements realize it, and where.
Closest pair of points by divide and conquer.
Convex hull algorithms built from Pangolin point predicates.
Declaration of pgl::Disk.
Distance and Hausdorff-style measurements between shapes.
Manhattan (L1) distance between shapes.
Chebyshev (LInf) distance between shapes.
Projective duality and polar-transform helpers.
Public declaration of pgl::EmptyShape.
Forward declarations for core numeric and geometry types.
Simple undirected graph with hashable vertices.
Public declaration of pgl::Halfplane.
Public declaration of pgl::HalfplaneIntersection.
Strongly typed index handles shared by the topological data structures.
Hash support for Pangolin value types.
Implementations of the 'intersection' predicate.
Segment intersection and crossing algorithms.
Mutable one-dimensional interval tree over projected bounded shapes.
Stream output helpers for Pangolin value types.
Enumeration of the integer grid points a shape contains.
Public declaration of pgl::Line.
Geometric measurements and canonical representative-point helpers.
Smallest enclosing disk algorithms.
Minkowski sums of two shapes, and the operator+ that spells them.
Minkowski erosions: the set of translations of one shape that keep it inside another.
Minkowski sums whose result is not a single convex shape: one region when the substantive case is con...
Definition arrangement.hpp:67
Triangle< EPoint > ETriangle
Definition pgl.hpp:107
Halfplane< EPoint > EHalfplane
Definition pgl.hpp:105
PolygonSet< EPoint > EPolygonSet
Definition pgl.hpp:115
Point< ERational > EPoint
Definition pgl.hpp:98
HalfplaneIntersection< EPoint > EHalfplaneIntersection
Definition pgl.hpp:113
PolygonWithHoles< EPoint > EPolygonWithHoles
Definition pgl.hpp:114
EmptyShape< EPoint > EEmptyShape
Definition pgl.hpp:99
Segment< EPoint > ESegment
Definition pgl.hpp:100
Line< EPoint > ELine
Definition pgl.hpp:102
Polygon< EPoint > EPolygon
Definition pgl.hpp:110
Convex< EPoint > EConvex
Definition pgl.hpp:109
OrientedLine< EPoint > EOrientedLine
Definition pgl.hpp:103
Transformation< ERational > ETransformation
Definition pgl.hpp:97
Disk< EPoint > EDisk
Definition pgl.hpp:108
Polyline< EPoint > EPolyline
Definition pgl.hpp:112
OrientedSegment< EPoint > EOrientedSegment
Definition pgl.hpp:101
Ray< EPoint > ERay
Definition pgl.hpp:104
MonotoneChain< EPoint > EMonotoneChain
Definition pgl.hpp:111
Rectangle< EPoint > ERectangle
Definition pgl.hpp:106
Shape< EPoint > EShape
Definition pgl.hpp:116
Numeric concepts and helpers shared by exact geometry operations.
Exact low-level orientation and incircle predicates.
Public declaration of pgl::OrientedLine.
Public declaration of pgl::OrientedSegment.
Public declaration of pgl::Point and point-label helpers.
Enumeration of polyominoes as Pangolin polygons.
Method definitions for the shapes.
Exact rational number type used when geometric results need fractions.
Public declaration of pgl::Ray.
Public declaration of pgl::Rectangle.
Bichromatic (red-blue) boundary contact by one combined plane sweep.
Exact equality of the point sets represented by arbitrary shapes.
Public declaration of pgl::Segment.
Runtime variant wrapper over the currently implemented shape types.
Static 2D shape tree over any bounded shape (one exposing bbox()).
Angular sorting of points around a center.
Closed convex polygon stored by its vertices.
Definition convex.hpp:170
Closed Euclidean disk stored by boundary points plus optional disk label.
Definition disk.hpp:66
The empty set of points in the plane.
Definition emptyshape.hpp:33
Intersection of closed half-planes; convex but possibly unbounded or empty.
Definition halfplaneintersection.hpp:244
Closed half-plane defined by an oriented boundary line.
Definition halfplane.hpp:51
Unoriented infinite line.
Definition line.hpp:52
Weakly x-monotone polyline stored by lexicographically sorted vertices.
Definition monotonechain.hpp:146
Directed infinite line with left/right side semantics plus optional line label.
Definition orientedline.hpp:53
Directed segment preserving source-to-target order plus optional segment label.
Definition orientedsegment.hpp:44
Two-dimensional point with optional label payload.
Definition point.hpp:129
Set of closed regions with pairwise disjoint interiors.
Definition polygonset.hpp:165
Closed region bounded by one outer simple polygon minus disjoint polygonal holes.
Definition polygonwithholes.hpp:89
Closed simple polygon stored by its vertices.
Definition polygon.hpp:59
Open polygonal chain stored in traversal order; may self-intersect.
Definition polyline.hpp:69
Half-infinite line starting from one source point plus optional ray label.
Definition ray.hpp:51
Axis-aligned rectangle stored by minimum and maximum corners.
Definition rectangle.hpp:75
Unoriented closed segment between two endpoints plus optional segment label.
Definition segment.hpp:58
Runtime variant wrapper over the supported primitive shapes.
Definition shape.hpp:160
Affine transformation stored as a 2x3 matrix.
Definition transformation.hpp:32
Closed triangle stored by three vertices.
Definition triangle.hpp:53
Public declaration of pgl::Transformation, an affine transformation.
Arithmetic transformations and explicit conversions between primitives.
Public declaration of pgl::Triangle.
Mutable triangulation of a point set or simple polygon.
Visibility graphs by triangular expansion.
Bounding-box sweep over pairs of segments.