Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) Hobby Splines #209

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

cuttlefisch
Copy link

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

  • Use hobby_point function to create a list in the form of [Knot, Control Control, Knot,... ] representing knots and controls for bezier curves defined using hobby's algorithm.
  • Control whether curves are open or closed using the close_loop boolean.

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

  • Add hobby_points function to splines in order to generate bezier curves following Hobby's algorithm.
  • Add new example file hobby_splines_example.py with open & closed hobby splines & their polygon projections
  • Add tests for hobby_points to test_splines.py for open hobby splines using bezier_controls in raw, Point2, and Point3 forms

Examples

Create hobby curve examples by running hobby_splines_example.py.

Testing

Test changes using test_splines.py.

@etjones-erisyon
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants