rustgd / cgmath

A linear algebra and mathematics library for computer graphics.
https://docs.rs/cgmath
Apache License 2.0
1.13k stars 155 forks source link

Implement num_traits::Bounded for Points, Vectors, and Angles #425

Closed Osspial closed 7 years ago

Osspial commented 7 years ago

Implements Bounded for all Points, Vectors, and Angles where S also implements Bounded, giving min_value and max_value functions.

Should Bounded be re-exported from the crate root? This PR currently doesn't, but other num_traits traits are exported from cgmath's root

brendanzab commented 7 years ago

Cool, thanks! Let's export Bounded as well. Out of curiosity, what was your use case?

Osspial commented 7 years ago

I was using it to set initial integer values for points in a GUI layout engine, but looking at that code now it looks like it should have been initialized to zero instead! Still, it makes sense for these traits to be implemented.