โ† All examples

mesh algorithms

Chaikin corner cutting

Round polygons and polylines by repeated corner cutting at the quarter points, converging to the quadratic B-spline. Use it for smooth outlines, organic 2D shapes and softening hand-drawn strokes.

Recorded render of Chaikin corner cutting

What this component contains

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

How it works

Entry points
chaikin, build, main
Parameters
iterations, ratio
Complexity
O(n * 2^iterations)
Axes
+Y up, metres; 2D (x, y) maps to (x, 0, -y)

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

The curve shrinks inside the control polygon (it approximates, it does not interpolate). Point counts double every round. Ratios other than 1/4 converge to curves that are not the quadratic B-spline.