nurbspy.jax.arclength module#
Knot-aware JAX arc length and reusable integration tables.
Adaptive quadrature is the general length method; an ODE alternative remains available. Both use public solver APIs and expose unsuccessful termination. Prepared Gauss tables are optional: their resolution must be checked on the intended geometry family. Dense inverse maps use a reciprocal ODE on each knot span, with no iterative quadrature in a query. See the usage guide for numerical assumptions, differentiation, tolerances and table invalidation.
- class nurbspy.jax.arclength.ArcLengthInfo(value: Array, error_estimate: Array, evaluations: Array, status: Array, intervals: Array)[source]#
Bases:
NamedTupleCommon value/work diagnostics; an unavailable estimate is NaN.
Adaptive statuses 0..8 are Quadax’s public severity enum, not bit flags. This wrapper adds 16=invalid geometry/options and 32=nonfinite sampled speed/value. ODE adds 64=unsuccessful solver termination. Fixed rules do not return this type: no tolerance or error estimator is implied by a rule.
Methods
count(value, /)Return number of occurrences of value.
index(value[, start, stop])Return first index of value.
- error_estimate: Array#
Alias for field number 1
- evaluations: Array#
Alias for field number 2
- intervals: Array#
Alias for field number 4
- status: Array#
Alias for field number 3
- value: Array#
Alias for field number 0
- class nurbspy.jax.arclength.ArcLengthMap(solutions: Solution, bounds: Array, cumulative: Array, end_values: Array)[source]#
Bases:
ModuleDense reciprocal-ODE data behind a curve’s compiled inverse callable.
Queries accept scalars or arrays, preserve shape, and support JAX AD on regular curves. Changing geometry requires rebuilding the map; keep its construction inside an AD transform for geometry sensitivities. Each knot span starts at its exact parameter and its dense endpoint is normalized to the other exact endpoint. This prevents drift across speed jumps.
- Attributes:
- total_length
Methods
__call__
evaluate
- bounds: Array#
- cumulative: Array#
- end_values: Array#
- evaluate(s)#
- solutions: Solution#
- property total_length#
- class nurbspy.jax.arclength.PreparedArcLength(basis: PreparedCurveBasis, weights: Array)[source]#
Bases:
ModuleFixed Gauss nodes and basis tables reusable with changing P and W.
Rebuild for changed knots, degree, limits, order or subdivisions. The object stores polynomial basis tables, not a snapshot of rational geometry. Fixed rules have no convergence guarantee; compare with adaptive integration on the intended design family before using them in an objective.
Methods
value(P[, W])Return a differentiable length; omitted weights mean unit weights.
- basis: PreparedCurveBasis#
- weights: Array#
- nurbspy.jax.arclength.prepare_arclength(curve, u1=0.0, u2=1.0, *, order=16, subdivisions=1)[source]#
Prepare basis tables; rebuild for new knots/limits/order.
Build inside an AD transform for knot/limit sensitivities. At a zero-width interval fixed quadrature currently does not promise endpoint AD semantics. Even GL16/GL32 agreement can miss an extreme rational endpoint layer, so validate the expected geometry family with an independent adaptive/reference calculation rather than an order comparison alone.