coord_transforms
coord_transforms copied to clipboard
Generic over f64/f32?
Hi there,
Thanks for making this crate! Would you be open to supporting f32's as well as just f64?
ie: https://docs.rs/coord_transforms/1.3.0/coord_transforms/d2/fn.cartesian2polar.html is hardcoded for f64.
Right now I'm doing a bunch of unnecessary casts because my engine uses f32's atm. I'm still learning rust, but if your knowledgeable about a good method for doing so (maybe something like rust's Into trait?) I would be happy to put together a PR, if your open to merging/discussing it.
Thanks!
Sorry, been working a lot so I don't usually have time to respond quickly to things anymore.
I thought of doing a more generic approach when I first started this a few years ago, but ended up not. There is the potential for using the num_traits crate, and using the Float trait to provide per function generic definitions for f32 and f64 since they both implement Float.
Thoughts?
That seems very reasonable. I'll see when I can find some time to work on this. Thanks for letting me know your interested in merging changes.