-
Notifications
You must be signed in to change notification settings - Fork 2
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
Port to nalgebra, add methods to assist rendering #6
base: main
Are you sure you want to change the base?
Conversation
Hey!
I agree. It always felt like reinventing the wheel but it gave me more control while going through the many iterations of this library.
What made you choose nalgebra's over glam's ?
They are mostly a relic of the first development versions. Performance difference should indeed be negligible, especially for the lower order types (and these are usually the ones that are specialized). So yes, that'd be fine. edit: I'd like to keep them for now - as long as bounding_box() is not supported for generic curves. meanwhile people can use these specialized versions (which is quite common anyway).
This is great help actually. I have only written this lib to backup some knowledge from rather theoretical uni courses (and dabble in const-generics) but have rather little experience with the needs of graphical workloads. So having a more practical API for actual professionals makes a lot of sense and I do need help with that (convenience functions etc). I think naming conventions should align with those of established libraries (e.g. rhino/opennurbs?) where possible. A quick look over your changes shows you are replacing dependency tinyvec (100% safe rust) with smallvec (a lot of unsafe, kind of a meme in the rust community) which I had also used in the past. This is a change I think I could not compromise on for this library. Anyway, I expect to be able to again work more on this library the coming months and am happy with any collaboration! |
Honestly I swapped to smallvec because I'd used it before. I've got no issues with using tinyvec over it. The decision to use nalgebra over glam is because nalgebra let's you be generic over the dimension and value type of the vectors, glam does not have any generic typing at all. Glam is often chosen over nalgebra for exactly this reason, because the types are simpler and it compiles a bit faster. Interop between the two is very simple though, they can both be converted into each other use into. My fn naming is quite bad right now, it's very much in the experimental phase. But I think the most important API for drawing splines is easily breaking it down into line segments. I also wanted the ability to generate offset points so that I could make a mesh out of it |
I have to backpedal a bit on the first two points...
I will look into integrating your convenience functions next |
Hello!
I was looking for a crate to use to create bezier curves in 3D and I really liked your compile time guarantees. I'm opening this PR now mostly just to give you a heads up and brief list of what I've done to see if you are interested in up streaming any of it.
Biggest change upfront is completely removing your Point type in favor of nalgebra's. I think that nalgebra and glam are the two biggest math libraries at this point, and they already have implemented seamless conversions between each other. I think it's less work to just use it.
Next was getting rid of the special implementations of the lower dimensional curves. I just wanted a single type to deal with, and performance shouldn't be different with all the const generic optimizations that can be performed.
The last part I'm working on is creating iterators that break the curve down into line segments so that you can use those line segments to create a mesh, or just draw the lines. I also added the ability to create offset line segments from the curve.
If you're interested in me working on mainstreaming these changes let me know, otherwise I'll probably end up forking.