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

Examples for creating bezier curves from points and control points? #19

Open
markusstephanides opened this issue Aug 29, 2022 · 1 comment

Comments

@markusstephanides
Copy link

markusstephanides commented Aug 29, 2022

Hi!

The library looks really promising but I'm having issues getting started. I'm using the Bevy game engine and I'm trying to create bezier curves so I implemented the Coordinate trait for Bevys Vec3 using the newtype pattern. However I'm not able to progress any further from there, even after looking at the source code.

Could you give me some directions or examples given that I have a list of 3D coordinates and with each of these coordinates two 3D Coordinates that represent the handles, how to create a bezier curve from that?

Thank you very much!

@Logicalshift
Copy link
Owner

This could probably do with being moved to the main documentation, but the README file has instructions for this:

use flo_curves::*;
use flo_curves::bezier;

let curve = bezier::Curve::from_points(Coord2(1.0, 2.0), (Coord2(2.0, 0.0), Coord2(3.0, 5.0)), Coord2(4.0, 2.0));

Documentation here: https://docs.rs/flo_curves/latest/flo_curves/bezier/trait.BezierCurveFactory.html#tymethod.from_points (you can also implement the bezier curve traits yourself to use functionality from flo_curves with other libraries)

This will work with any type that implements the Coordinate trait, not just the built-in Coord2 type. Note there's a lot of extra functionality for things that also implement Coordinate2D

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

No branches or pull requests

2 participants