# bezier-curve **Repository Path**: mirrors_deckar01/bezier-curve ## Basic Information - **Project Name**: bezier-curve - **Description**: A recursive implementation of bezier curves for OpenSCAD. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-09-24 - **Last Updated**: 2026-04-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OpenSCAD Bezier Curves A recursive implementation of bezier curves for OpenSCAD. ![preview](./examples/example.png) ## Usage ### bezier::bezier_curve(control_points, fn) A function that produces a set of points lying on the bezier curve defined by a set of control points. - **Arguments** - **control_points** `Array>` - The set of coordinates representing control points for the bezier curve. Providing 2 points results in a line, 3 points in a curve, and the more points the more complex the curve becomes. - **fn** `Integer` - The number of line fragments to use when approximating the curve. This is similar to OpenSCAD's special `$fn` variable. - **Returns** - `Array>` - A set of points lying on the bezier curve. ### bezier::bezier_uniform(curve, control_points) A function that resamples the points on a bezier curve to produce points that are more uniformly distributed. - **Arguments** - **points** `Array>` - The points of the curve. - **control_points** `Array>` - See [`bezier::bezier_curve`][0]. - **Returns** - `Array>` - An evenly spaced set of points lying on the bezier curve. ### bezier::bezier_point(control_points, t) A function that samples a single point lying on the bezier curve defined by a set of control points. - **Arguments** - **control_points** `Array>` - See [`bezier::bezier_curve`][0]. - **t** `Float` - A "time" value in the unit interval `[0, 1]`. This value controls how far along the curve the sampled point lays, although the points are not guaranteed to be sampled uniformly. - **Returns** - `Vector` - A point lying on the bezier curve. ### preview::preview_curve(curve, control_points) A module that renders a preview of a set of control points and the set of points lying on the bezier curve defined by those control points. Points are rendered as spheres and the lines between neighboring points are rendered as cylinders. - **Arguments** - **points** `Array>` - The points of the curve. - **control_points** `Array>` - See [`bezier::bezier_curve`][0]. ## Development ### Testing Run `./test.sh`. Test cases are in `tests/`. ### Benchmarks Run `./benchmark.sh`. The test is in `benchmark/`. ### TODO - Provide modules for constructing `polyhedron` meshes. - Investigate integrating a curve primitive into OpenSCAD. [0]: #bezierbezier_curvecontrol_points-fn