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:

  1. Your first B-spline – spaces, control points, evaluation, derivatives, an exact NURBS circle (pantr.bspline).

  2. Visualizing geometriesplot / Scene, control polygons, knot lines, scalar fields, VTK export (pantr.viz).

  3. Knot operations & Bézier extraction – knot insertion, degree elevation, and the element-local Bézier pieces (pantr.bspline).

  4. Constructive CAD modeling – primitives plus extrusion / revolution / ruled, assembled (pantr.cad).

  5. Approximation – interpolation, L2 projection, quasi-interpolation, and convergence (pantr.bspline).

  6. Polynomial bases & change of basis – Bernstein / Lagrange / Legendre and the matrices between them (pantr.basis, pantr.change_basis).

  7. Bézier patches & Bernstein root finding – a Bézier surface, root finding, a curve-line intersection (pantr.bezier).

  8. THB-splines – adaptive local refinement on a hierarchical mesh (pantr.bspline, pantr.grid).

  9. Grids & quadraturecell_quadrature integration, a BVH query, grid rendering (pantr.grid, pantr.quad, pantr.geometry).

  10. Affine transformations – translation / rotation / scaling / shear and composition (pantr.transform).

Your first B-spline

Your first B-spline

Visualizing geometries

Visualizing geometries

Knot operations and Bézier extraction

Knot operations and Bézier extraction

Constructive CAD modeling

Constructive CAD modeling

Approximation: interpolation, fitting, projection, quasi-interpolation

Approximation: interpolation, fitting, projection, quasi-interpolation

Polynomial bases and change of basis

Polynomial bases and change of basis

Bézier geometry and Bernstein root finding

Bézier geometry and Bernstein root finding

THB-splines: adaptive local refinement

THB-splines: adaptive local refinement

Grids and quadrature

Grids and quadrature

Affine transformations

Affine transformations

Gallery generated by Sphinx-Gallery