Baltor Get started

Gallery / Mesh algorithms

Cubic Bezier evaluation, arc length and resampling

In your harnessMesh algorithmMIT

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.

Render of Cubic Bezier evaluation, arc length and resampling
The render its check recorded in Godot 4.7.2, 256 by 256 pixels.

What it takes and gives

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

Limits. 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.

Details

Kind
Mesh algorithm
Engine
Python 3.10 or later
Files
10 files, 231.1 KB
Licence
MIT
Declared effects
reads files, runs commands, writes files
Checked with
Godot 4.7.2, gl_compatibility, OpenGL 3 driver, Mesa llvmpipe under Xvfb
Checks
generator runs system python, generator runs verifier python, gltf strict structure, interpreters agree, example matches generator, godot headless gltf load, godot compatibility render
Techniques
de Casteljau evaluation and subdivision, Gauss-Legendre quadrature of the speed, Arc-length inversion by table lookup and Newton iteration
Tags
bezier, curve, arc length, resampling, de casteljau, motion path
Identity
library.supply.creative_originals.52460955ea8ff38a9a214b4e.109e7811ba4dba36
Version
109e7811ba4dba36598ec5b835d9ee3951d7d298bc29a002e80d4d963ffa2daf

The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.

Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.