PaNTr¶
PaNTr (Polynomial And NURBS Toolkit) is a pure-Python library for geometric modeling and numerical analysis with B-splines, NURBS, Bézier patches, and truncated hierarchical B-splines. It is built on NumPy, SciPy, and Numba — typed across its public API and JIT-compiled for multi-core throughput — and targets isogeometric analysis, CAD-style modeling, and scientific computing.
import numpy as np
from pantr.bspline import Bspline, BsplineSpace, BsplineSpace1D
space = BsplineSpace([BsplineSpace1D([0, 0, 0, 1, 2, 3, 3, 3], 2)]) # quadratic curve space
curve = Bspline(space, np.array([[0, 0], [1, 2], [2, -1], [3, 1], [4, 0]], dtype=float))
points = curve.evaluate(np.linspace(0, 3, 50)) # (50, 2)
Install PaNTr (and the optional extras) and run your first example.
A guided, runnable path from your first spline to adaptive refinement.
The data model and topic-by-topic explanations behind the API.
Every module, class, and function, with full signatures.
What’s inside¶
B-spline & NURBS spaces — univariate and tensor-product
BsplineSpace, exact rational geometry, evaluation and derivatives, knot insertion/removal, degree elevation, splitting.Bézier toolkit — Bernstein/Bézier curves and patches, composition, products, degree reduction, and Bernstein-polynomial root finding (
pantr.bezier).Truncated hierarchical B-splines —
THBSplineSpacefor adaptive local refinement, mirroring the tensor-product API.Constructive geometry — lines, arcs, disks, cylinders, extrusion, revolution, sweep, ruled and Coons surfaces/volumes (
pantr.cad).Grids & quadrature — tensor-product and hierarchical grids, BVH spatial queries, cell/facet tags, and quadrature rules (
pantr.grid,pantr.quad).Dependency-gated MPI & visualization —
pantr.mpidistributes spaces across ranks (withmpi4py) andpantr.vizrenders exact higher-order geometry through PyVista / VTK (with PyVista). Both ship with PaNTr; see Getting started for how the optional backends are enabled.