โ† All examples

mesh algorithms

Cubic Bezier evaluation, arc length and resampling

Evaluate and split cubic Bezier curves by de Casteljau, measure arc length by Gauss-Legendre quadrature and resample paths at even arc-length spacing. Use it for camera paths, motion along curves and even spacing of instances.

Recorded render of Cubic Bezier evaluation, arc length and resampling

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • bezier_curve_arc_length.py
  • component.json
  • example.gltf
  • meshkit.py
  • preview.png
  • test_package.py
  • verification/native.json

How it works

Entry points
bezier_point, bezier_derivative, split_bezier, arc_length, length_table, parameter_at_length, resample_by_length, demo_path and 2 more
Parameters
path, spacing, tube_radius
Complexity
O(pieces) per length query; O(points * log pieces) for resampling
Axes
+Y up, metres

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • generator_runs_system_python
  • generator_runs_verifier_python
  • gltf_strict_structure
  • interpreters_agree
  • example_matches_generator
  • godot_headless_gltf_load
  • godot_compatibility_render

Limits to consider

Cubic segments only (the evaluation works for any degree, the length and split functions take four control points). Arc length is numerical (five-point Gauss-Legendre on 16 or 32 pieces), accurate to about 1e-10 for smooth segments but slower to converge near cusps. The display tube is for viewing, not a production sweep.