Commit graph

1577 commits

Author SHA1 Message Date
maku693 11a5346291 Add support for cast using bytemuck crate 2022-03-06 19:28:56 -08:00
aloucks 78c082e944
Merge pull request #539 from CyborgSquirrel/master
Implement IntoMint trait for Vectors, Points, Matrices, and Quaternions
2021-11-26 09:11:33 -05:00
Andrei Jardan d4d19b9122 Implement IntoMint trait for Vectors, Points, Matrices, and Quaternions
- Updated mint to 0.5.8, so that the IntoMint trait is available
- Implemented IntoMint for Vectors, Points, Matrices, and Quaternions
2021-11-25 13:45:53 +02:00
Shane Pearman af127633cc Replace use of BaseFloat/Float with BaseNum/Num where possible 2021-08-11 12:07:57 -04:00
Shane Pearman 41fb64cea0 Remove NumCast bound from BaseNum 2021-08-11 12:07:57 -04:00
Dana Jansens e57b543449
Update links in quaternions.rs (#535)
* Update link to Arcsynthesis tutorial about quaternions

The old link no longer goes to a valid page, and it appears to be malicious.

* Fix links in quaternion.rs

Don't split the line between the [text] and (url) or they don't get turned into a link in docs.rs
2021-07-06 01:43:28 -04:00
Rémi Lauzier df218547d1 Fix some clippy warnings and some typo 2021-06-16 14:09:50 -04:00
Rémi Lauzier 575c458705 cargo fmt 2021-06-15 21:34:40 -04:00
Rémi Lauzier fb205c0fc9 Fix some clippy warnings 2021-06-15 21:34:40 -04:00
aloucks 7a0ebdf1e6
Merge pull request #532 from remilauzier/master
update approx to 0.5
2021-06-14 16:49:55 -04:00
Rémi Lauzier 6c7c68f793
update approx to 0.5 2021-06-07 19:46:39 -04:00
Adam Gausmann ada4add5a7
More Into impls converted to From (#529)
* More Into impls converted to From

* Update quaternion.rs
2021-04-20 22:17:06 -04:00
Adam Gausmann 81583b2f57
Implement From instead of Into for array/tuple/mint conversions (#528) 2021-04-20 18:25:13 -04:00
Bryce Besler 3e93bac9f5
Simplify "fold_array" macro (#527) 2021-04-06 10:06:21 -04:00
Dzmitry Malyshau 637c566cc2
Release 0.18 (#520) 2021-01-02 20:01:35 -05:00
Jonathan Behrens 4b99f07bfd
Upgrade approx and rand crates (#523) 2020-12-25 01:17:01 -05:00
aloucks 8e0d5ece92
Fix deprecation warnings (#522) 2020-12-05 18:41:30 -05:00
aloucks 521371365c
Update readme build status and remove IDE config (#521) 2020-12-05 11:26:09 -05:00
aloucks 1d23011a5b
Add github workflows (#519)
* Add github workflows

* Remove .travis.yml

* Reduce benchmark builds
2020-12-05 10:41:50 -05:00
Aaron Loucks 3bd348127c Remove duplicate code in the deprecated Matrix3::look_at function 2020-12-04 19:41:27 -05:00
Aaron Loucks c0a66d2a34 Rename Matrix3::look_at_[rh|lh] to look_to_[rh|lh]
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.
2020-12-04 19:41:27 -05:00
Aaron Loucks a628d134f1 Add matrix3 look_at_[lh|rh] tests 2020-12-04 19:41:27 -05:00
Aaron Loucks 24a9191189 Add more matrix4 and transform tests 2020-12-04 19:41:27 -05:00
Aaron Loucks 213fc580a9 Add Transform::{look_at_rh, look_at_lh} and deprecate look_at
Corresponding functions have been added to Matrix4 and Decomposed
and are now consistent.

Matrix3, Matrix2, and the Rotation trait are only partially updated.
2020-12-04 19:41:27 -05:00
aloucks 164808eebc
Quaternion memory layout changed to [x, y, z, w] (#500)
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.
2020-11-23 11:22:21 -05:00
Luyu Cheng a691de8714
Fix a type parameter in benchmarks (#517) 2020-09-01 17:28:51 -04:00
josh65536 84da664455
Now there is only one one (#513)
* 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
2020-08-12 15:05:38 -04:00
josh65536 816c043223
Fixed opposite quaternion slerp bug (#515)
* Fixed opposite quaternion slerp bug

* Removed an unnecessary

* nlerp and slerp always take the shortest path now
2020-08-11 23:04:27 -04:00
Marco Giordano c96cd57efc
Allow inverted near far for inverted depth fp32 (#509)
* 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
2020-06-24 10:45:20 -04:00
Nathan Stoddard 2c7ee50ef4 Fix compilation of benchmarks
This switches to `SmallRng` since that doesn't require adding another dependency.
2020-06-04 15:15:38 -04:00
Nathan Stoddard 8d0e3f4eae Remove Float bound from MetricSpace and InnerSpace; move Float bound to individual methods
This makes it possible to call methods like `dot` on integers.
2020-06-03 16:07:04 -04:00
Egor Larionov 9dcd9fc3dd Remove unused commented out code 2020-05-23 00:50:32 -04:00
Egor Larionov 753773cfcd Further relax InnerSpace and is_finite BaseFloat bounds 2020-05-23 00:50:32 -04:00
Egor Larionov b9e82914db Relax Float bound {Metric,Inner}Space and Matrix traits
This makes the trait more flexible.
This contributes to #496.
2020-05-23 00:50:32 -04:00
bors[bot] 50a345b7c4
Merge #495
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>
2019-11-05 15:03:30 +00:00
Andrea Catania ff1cda766d Code formatted with 2019-11-05 07:16:38 +01:00
Andrea Catania 04b21718f3 Added to the Mat3 the possibility to be constructed from a translation vector. Added tests. 2019-11-05 07:15:33 +01:00
bors[bot] f69e781b8f
Merge #491
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>
2019-09-03 22:13:25 +00:00
blargg dd9f08ccee Fix Matrix2::look_at, add look_at_stable
Fix bug in look_at

Use the up vector to determine turn direction

Add look_at_stable

Matrix2::look_at calls look_at_stable
2019-09-03 17:02:11 -05:00
bors[bot] 981170fc19
Merge #492
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>
2019-09-03 17:35:33 +00:00
Norbert Nemec c7e7d4895e add README and CHANGELOG entries 2019-09-03 19:33:44 +02:00
Norbert Nemec 5c6c378128 add "simd" test with nightly-2019-01-01 toolchain and get it working 2019-09-01 22:56:26 +02:00
Norbert Nemec 153754eb38 split off code into quaternion_simd.rs 2019-09-01 21:04:05 +02:00
Norbert Nemec f21232a123 drop redundant copies from quaternion.rs 2019-09-01 21:04:05 +02:00
Norbert Nemec 7290d42c04 split off code into vector_simd.rs 2019-09-01 21:04:05 +02:00
Norbert Nemec dfb8766e38 drop redundant impl_vector_default 2019-09-01 21:04:05 +02:00
Norbert Nemec c4acb79d04 merge default_fn!() from impl_vector_default back into impl_vector 2019-09-01 21:04:05 +02:00
Norbert Nemec 64fde2002b replace default -> default_fn!() 2019-09-01 21:04:04 +02:00
Norbert Nemec caa8ee13fd merge changes from impl_vector to impl_vector_default 2019-09-01 21:04:04 +02:00
Norbert Nemec 40d0afd036 drop redundant impl_scalar_ops_default 2019-09-01 21:04:04 +02:00