This makes the Matrix3/4 and Decomposed `look_at_*` functions consistent
with looking at a center/focus point and `look_to_*` functions consistent
with looking in a direction.
Corresponding functions have been added to Matrix4 and Decomposed
and are now consistent.
Matrix3, Matrix2, and the Rotation trait are only partially updated.
* Now there is only one one
* Rotation no longer has a parameter
* Moved some type parameters to associated types
* Relaxed some bounds and simplified a bound
* Removed unnecessary bound in
* Deduplicated multiplication code
491: Fix Matrix2::look_at, add look_at_stable r=kvark a=blargg
## Changes
1. Fixes `Matrix2::look_at`
2. Adds tests for `look_at`
3. Adds a new function, `look_at_stable`
## Notes
I added a new function for 2d look at rotation. `look_at` is a bit weird in practice for 2d. For example, if you are making a basis matrix to orient a 2d character to look at a point, `look_at` will flip the character as they rotate past `up` or `-up` vectors. This is the best match for what look_at is supposed to do, I think.
`look_at_stable` will not flip based on orientation, you just pass in which way to flip. This is a bit easier to use to rotate 2d characters.
`look_at_stable` could have a better name. I think we can also consider removing the flip param, and just let the user flip the matrix with a transform later.
Co-authored-by: blargg <tomjankauski@gmail.com>
476: Add short constructors for points, to match the ones for vectors r=kvark a=nstoddard
In my code I find that I need to create points almost as often as vectors, so having short constructors is helpful.
Co-authored-by: Nathan Stoddard <nstoddard@users.noreply.github.com>
Closes#396
This removes `PartialOrd` and makes `BaseNum` and `BaseFloat` simple trait aliases. This should allow more types to be used as parameters in the cgmath data types at the expense of removing `Array::min` and `Array::max`.
This adds `Sum` trait for the `MatrixN`, `VectorN`, `Quaternion`
structures and the `Product` trait for `MatrixN`, `BasisN` and
`Quaternion`.
It also add constraints on the `Rotation` and `SquareMatrix` to require
the `Product` trait and `VectorSpace` to require `Sum`.
- Add an opt-in SIMD support for the module. The feature requires crate
`simd` and specialization, thus can only be enabled under nightly. Under
the given benchmark certain operations were able to be up to 60% faster.
Currently the supported types as well as operations are highly limited.
- Clean up some deadly tests. Also add new tests for SIMD.
The Vector and EuclideanVector traits roughly line up with the concept of vector spaces and inner spaces respectively. It makes more sense to group `dot` with the other methods that depend on it.