Tutorials¶
A guided, hands-on path through PaNTr. Each tutorial is a standalone, runnable script
in tutorials/ whose output (plots and interactive 3-D scenes) is rendered below by
executing it. Read them in order the first time – each builds on the last – or jump to
whichever topic you need.
Pair the tutorials with Core concepts (the data model and vocabulary) and the rest of the User Guide for the conceptual reference behind each step.
Running them yourself:
pip install "pantr[viz]" matplotlib # 3-D scenes need PyVista; 2-D plots use matplotlib
python tutorials/01_first_bspline.py
The 2-D plots are drawn with matplotlib and the interactive
3-D scenes with PyVista. Neither is a dependency of PaNTr
itself – they are used only by these tutorial scripts (PaNTr’s own rendering lives in
pantr.viz, which needs only PyVista).
The 3-D scenes are interactive – drag to rotate, scroll to zoom. The plotting scripts use Numba kernels; on a fresh process you may hit a Numba background-warmup threading error, in which case run with JIT disabled (the documentation build does this automatically):
NUMBA_DISABLE_JIT=1 python tutorials/05_approximation.py
The path, in order:
Your first B-spline – spaces, control points, evaluation, derivatives, an exact NURBS circle (
pantr.bspline).Visualizing geometries –
plot/Scene, control polygons, knot lines, scalar fields, VTK export (pantr.viz).Knot operations & Bézier extraction – knot insertion, degree elevation, and the element-local Bézier pieces (
pantr.bspline).Constructive CAD modeling – primitives plus extrusion / revolution / ruled, assembled (
pantr.cad).Approximation – interpolation, L2 projection, quasi-interpolation, and convergence (
pantr.bspline).Polynomial bases & change of basis – Bernstein / Lagrange / Legendre and the matrices between them (
pantr.basis,pantr.change_basis).Bézier patches & Bernstein root finding – a Bézier surface, root finding, a curve-line intersection (
pantr.bezier).THB-splines – adaptive local refinement on a hierarchical mesh (
pantr.bspline,pantr.grid).Grids & quadrature –
cell_quadratureintegration, a BVH query, grid rendering (pantr.grid,pantr.quad,pantr.geometry).Affine transformations – translation / rotation / scaling / shear and composition (
pantr.transform).
Approximation: interpolation, fitting, projection, quasi-interpolation