Examples#
This gallery walks through every public feature of mathematicskit.geometry:
convex hull, Delaunay triangulation/Voronoi diagrams, segment
intersection/point-in-polygon, polygon area/centroid, and the
Frenet-Serret frame.
Each script in this gallery is self-contained and can be run directly with
python examples/geometry/<section>/<script>.py.
Sections#
convex_hull – Graham’s scan, checked against scipy’s Qhull.
triangulation – Voronoi diagrams and Delaunay triangulation.
intersections – ray-casting point-in-polygon and the Jordan curve theorem.
polygon – Euclid’s equal areas, Heron’s formula, and Pick’s theorem.
curves – curvature, arc length, and the Frenet-Serret frame.
Bézier curves#
Curves built from control points by repeated linear interpolation.
Convex hull#
Graham’s angular-sweep convex hull, checked against scipy’s Qhull.
Graham’s scan: the convex hull by an angular sweep
Curves and the Frenet-Serret frame#
Curvature, arc length, and the moving frame along a parametric curve.
Distances between shapes#
The Hausdorff distance between point sets.
Enclosing circles#
The smallest circle containing a set of points.
Sylvester’s problem: the smallest enclosing circle
Point-in-polygon#
Ray casting and the Jordan curve theorem, with crossings found by segment intersection.
The Jordan curve theorem and ray casting: inside or outside?
Polygon area#
Euclid’s equal areas, Heron’s formula, and Pick’s theorem, all checked against the shoelace formula.
Euclid’s Elements, Book I: equal areas between parallels
Polyhedra#
Vertex, edge, and face counts of convex polyhedra, and Euler’s formula.
Proximity#
The closest pair of points by divide and conquer.
Line simplification#
Reducing the number of vertices of a polyline within a tolerance.
Surfaces#
Gaussian and mean curvature of parametric surfaces.
Gauss’s Theorema Egregium: curvature you can measure from inside
Voronoi diagrams and Delaunay triangulation#
Nearest-site partitions and empty-circumcircle triangulations, both via scipy’s Qhull wrapper.
Voronoi diagrams: every location goes to its nearest site
Delaunay triangulation: empty circumcircles and fat triangles