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.
The `From` and `Into` impls for `[S; 4]` and `(S, S, S, S)` have been
changed accordingly. This is consistent with other libraries like glm,
nalgebra, and glam, as well as the glTF spec.
Note that the `Quaternion::new` constructor has **not** yet been
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
* removed assertion for inverted near far
* added extra assertion
* adding checks for ratio too small or far and near plane too close to each other
* using comparing macro
* PR feedback
495: Mat3 constructors enhancement r=kvark a=AndreaCatania
The reason of this PR is because I need to transform thing in a 2d plane, and these functions are really handy.
- Added to the Mat3 the possibility to be constructed from a translation vector, similarly to the Mat4.
- Added unit tests.
Co-authored-by: Andrea Catania <info@andreacatania.com>
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>
492: Clean up specialization and simd r=kvark a=NNemec
The current SIMD implementation is based on the deprecated "simd" package and requires the unstable feature "specialization". So far, this was handled by significant code duplication and added complexity, making everything harder to understand even when "simd" was not in use at all.
In order to migrate from "simd" to "packed_simd" it appears valuable to first clean up the existing "simd" code, see what is still valuable and then see how to migrate.
This change reduces duplication, introduces a clear distinction of the "simd" feature and the "specialization" feature and moves most "simd" related code into separate source files.
The code is pure refactoring, keeping all functionality unchanged.
Testing the "simd" feature requires the 1.32 toolchain and commenting out the glium dev dependency. With that all tests run successfully.
Co-authored-by: Norbert Nemec <norbert@nemec-online.de>
486: Implement zip for VectorN and PointN r=kvark a=mickvangelderen
Implements #485.
It is possible but messy to put `map` and `zip` in the Array trait. Rust doesn't support higher kinded types which would help because we want to abstract over any container, holding a fixed number of some item type. The implementation would basically need to reproduce the work in the generic-array crate which is silly.
Co-authored-by: Mick van Gelderen <mickvangelderen@gmail.com>