bjz/cgmath-rs — pull request #93 by atheriel (2014-06-28 18:19:37+00:00)
Title: Implement float-like operations for vectors.

I was wondering if there was interest in adding this feature. In GLSL code, you can call `floor`, `max`, and so on with vector arguments, and the function is automatically vectorized over the components. This commit allows for similar functionality, i.e.

```rust
assert_eq!(Vector3::new(4.56, 5.78, -0.91).floor(), Vector3::new(4.0, 5.0, -1.0));
```

The commit adds a new trait to the `num` module similar to the built-in FloatMath and Float, and then implements it for vectors in the `vector` module. I've also included complete test coverage for all of the functions, and full documentation for the trait. It compiles and runs on my machine without issue.

Caveats:

* There are no trigonometric functions (yet), because I think that an implementation ought to respect the `Angle` type in some way.
* I didn't add top-level functions (i.e. `pub fn floor(s: S) -> S { t.floor() }`), because I'm not sure what module they would belong in; and
* The implementation is only for vectors right now. If there's interest I don't see why it can't be done for matrices as well.

I'm very new to Rust, so any feedback on the code itself would be welcome.