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 #1

Merged
merged 14 commits into from
May 10, 2024
Merged

(feat) Hobby Splines #1

merged 14 commits into from
May 10, 2024

Conversation

cuttlefisch
Copy link
Owner

@cuttlefisch cuttlefisch commented May 10, 2024

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.

@cuttlefisch cuttlefisch marked this pull request as ready for review May 10, 2024 19:09
@cuttlefisch cuttlefisch merged commit 4be9122 into master May 10, 2024
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.

1 participant