Skip to content

v0.4.0 Arc Length, Bounds, and API Hardening

Choose a tag to compare

@dorianprill dorianprill released this 17 Oct 20:13
184e5d0

Breaking changes

  • Renamed PointN and point_generic to ArrayPoint and array_point for easier distinction between implementation and trait; the Point trait is unchanged.
  • Removed specialized Bézier dd() methods; use derivative_at(t)[axis]. Generic Bézier derivative() now requires at least two control points; constant curves retain zero-valued derivative_at().
  • B-spline basis queries reject spans that do not own the parameter with InvalidSpan; non-finite results return NonFiniteComputation.
  • Coincidence predicates measure distance from the first control point; non-finite coincidence/linearity tolerances return false.
  • Added root-search input/arithmetic error variants and defined root accuracy as an absolute coordinate residual tolerance; tiny parameter steps no longer establish success.
  • Changed Bézier control_points() to borrowed iteration; into_control_points() returns the owned array. Removed mutable generic Bézier iteration in favor of checked control-point replacement/mapping.
  • Added Point::is_finite; custom point implementations must report whether all coordinates are finite.
  • Made line and Bezier new constructors fallible so they reject non-finite control points; generic Bezier construction also rejects an empty control-point array.
  • Replaced arclen(nsteps) with arclen(accuracy) -> Result<_, ArcLengthError> across curves, segments, and paths; the old sampling calculation is now arclen_polyline(segments).
  • Length-to-parameter and length-to-point methods now require an accuracy target and return Result; paths additionally retain Option for empty lookups. Removed the old _approx inverse-length methods.
  • Bounding-box methods now return BoundingBox<Scalar, DIM> instead of raw axis arrays; use into_axes() for the previous representation.
  • B-spline construction rejects empty active knot domains and knot multiplicities greater than degree + 1. Partly clamped splines use the standard [knots[D], knots[C]] active domain.

Added

  • Array conversions and borrowed iteration for ArrayPoint, lossless specialized/generic Bézier conversions, and conditional debugging/comparison traits for generic curves and cloning/debugging for paths.
  • Validated control-point mapping and atomic replacement, clamped-uniform B-spline construction, and direct derivative_at/speed helpers, including path chain-rule scaling.
  • Checked Bézier subcurve extraction and distance-based splitting; fixed-capacity path reuse helpers and a segment-preserving try_push API.
  • Bounding-box coordinate, center, extent, overlap, and intersection helpers, including touching and zero-width boxes.
  • 3D motion, spatial-query, and time-domain animation examples, and external-consumer smoke coverage with/without nalgebra.
  • Adaptive Gauss-Legendre arc length, consistent partial-length APIs, and bracketed inverse-length lookup, shared across all curve types and paths.
  • Allocation-free B-spline bezier_spans() extraction using the polar de Boor algorithm.
  • Tight generic Bézier, B-spline, and path boxes; explicit control_box() methods and a BoundingBox type with union and containment helpers.
  • Stable PointNorm::norm() accumulation for very small and very large representable magnitudes.

Changed

  • Specialized Bézier eval() and eval_casteljau() share endpoint-preserving de Casteljau interpolation. Array-backed point arithmetic uses array mapping/iteration.
  • Condensed README usage guidance and documented the time/parameter units in motion and animation examples.
  • Added a project Clippy policy, Cargo lint aliases, and a pre-commit hook; CI checks both feature configurations with warnings treated as errors.
  • Replaced the Plotters example with a Kuva SVG figure showing two generic Bezier curves and clamped/unclamped generic B-splines, their bounding boxes, labeled control points, knot-vector legends, and marked interior knots and unclamped endpoints.
  • Removed Plotters and the CI fontconfig installation; the plotting example uses Kuva without optional features.
  • Configured CI to use the compatible nightly trait solver for generic_const_exprs.
  • Cleaned up existing curve-code Clippy findings and added strict Clippy checks to CI.

Fixed

  • Prevent empty generic derivative curves. Scaled differences and shared geometry helpers stabilize tangents, normals, and curvature across coordinate scales, including overflowing derivative magnitudes.
  • Reuse robust interpolation for specialized evaluation and splitting; avoid NaNs from finite extreme controls.
  • Compare geometric distances without squaring in coincidence/linearity predicates, preserving exact zero-tolerance distinctions and avoiding overflow/underflow.
  • Validate B-spline span ownership without index overflow and carry separate exponents through basis/derivative recurrences to preserve wide and tiny knot intervals.
  • Validate Newton inputs and report success only for a finite satisfactory residual at the returned domain-clamped parameter. Share the solver across curve types and support direct derivative evaluation for constant pieces.
  • Preserve every better coarse/refinement distance candidate, including exact endpoint and interior-sample hits, while retaining the heuristic search contract. Use stable Euclidean norms and overflow-safe B-spline sampling parameters.
  • Scale and center line projections to avoid squared-length overflow/underflow and loss of small central offsets on huge segments; retain midpoint rounding tails and distinguish zero-length segments structurally.
  • Verify release packages, warning-free all-feature docs, and library portability with/without nalgebra on WASM and bare-metal ARM in CI.
  • Export public root-finding errors and common segment/B-spline error types at the crate root; all public errors implement core::error::Error.
  • Correct the signal interpolation example using actual clamped basis functions and report singular/non-finite solver failures instead of skipping pivots.
  • Align the README nalgebra dependency with the adapter's 0.34 dependency.
  • Evaluate unclamped B-splines at the final domain parameter using de Boor's algorithm instead of incorrectly returning the last control point.
  • Reject non-finite B-spline knots and control points, reporting the first invalid control-point index.
  • Treat B-spline knot multiplicity and zero-width spans structurally, while using scale-aware tolerances only for algebraic cancellation.
  • Preserve discontinuities when measuring paths and B-splines: gaps no longer acquire implicit connecting-line lengths.
  • Replace derivative sign sampling and coordinate-scale-dependent root tolerances in bounds with Bernstein subdivision.
  • Normalize analytic quadratic-root coefficients to avoid discriminant overflow/underflow, and use the cancellation-resistant quadratic formula.
  • Default B-splines now have a valid clamped knot domain instead of an all-zero knot vector.
  • Preserve the selected path segment at discontinuities using shared representable parameter boundaries and direct segment-local point lookup.
  • Refine generic bounds in local coordinates, avoiding origin-dependent tolerances while preserving the original curve endpoints.
  • Compute partial line lengths from scaled coordinate displacements, including representable portions of lines whose full length overflows. Linear Bézier and B-spline spans share this exact line formula.
  • Preserve exact interpolation endpoints and avoid subtracting opposite finite extremes when their difference overflows.