SolidCode / SolidPython

A python frontend for solid modelling that compiles to OpenSCAD
1.1k stars 171 forks source link

(feat) Hobby Splines #209

Open cuttlefisch opened 1 month ago

cuttlefisch commented 1 month ago

Goal

Implement Hobby Splines inspired by Jake Low's post Hobby’s algorithm for aesthetic Bézier splines that "render down" to bezier curves.

Functionality

The curve from the last knot point to the first is generated regardless of close_loop so that the tangents at the first and last knot point are those of the closed hobby spline; this helps keep the curves round and aesthetic. To generate the resulting hobby points the final segment of the curve is set to the closed loop curve is appended if the curve is closed, otherwise only the final point is appended.

Changes

Examples

Create hobby curve examples by running hobby_splines_example.py.

Testing

Test changes using test_splines.py.

etjones-erisyon commented 1 month ago

This looks really sweet, and thank you for adding examples and tests as well!

The one thing I want to ask about is SolidPython v2. The author is energetic and invested, and that's where all new SolidPython development is happening these days. I'm happy to merge this once I look around a little bit, but you'll probably find a bigger audience at the v2 repo

cuttlefisch commented 1 month ago

Interesting, I'll check out the v2 repo for more contributions!