Commit graph

36 commits

Author SHA1 Message Date
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
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
Norbert Nemec baa50d8b86 fix warning 2019-09-01 20:59:00 +02:00
Shane Pearman 2387544e08 bump rand -> 0.7, fix unused macro warnings in tests 2019-08-11 16:59:47 -07:00
Osspial a6abd5bf02 Modify cast() functions to return Option 2017-08-16 16:21:51 -04:00
Brendan Zabarauskas 77260934a1 Clean up Sum and Product impls
This is for consistency with other impls
2017-04-26 21:56:02 +10:00
Ben Boeckel 240559b941 iter traits: impl iter::{Sum, Product}
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`.
2017-04-25 11:01:18 -04:00
Marckvdv c9a9cad256 Added tests for the added cast functions of matrix and point. 2016-10-03 13:20:57 +02:00
Andrew Dudney 0f8a96d9b8 Changed over to the approx crate. Currently breaks rotation's doc tests. 2016-08-22 09:21:22 -06:00
Andrew Dudney 3d3b9c96ca Moved angle types to tuple structs 2016-07-31 20:40:31 -07:00
Andrew Dudney 1b77875cc3 Fixed tests, now most use deg, and none use deg(x).into() 2016-07-26 17:53:16 -07:00
Jordan Miner c11371794f Fix Euler angle to matrix conversion
The equations were written with rows horizontally instead of vertically
and some signs were wrong.
2016-05-12 01:28:16 -05:00
Brendan Zabarauskas 65e744c8cd Remove self inversion methods 2016-05-10 21:55:11 +10:00
Brendan Zabarauskas 0259acb87f Switch to an Euler angle type for defining rotations 2016-04-23 16:56:07 +10:00
Cameron Hart e773da36d2 Removed constant only used on one place 2016-01-02 16:15:49 +11:00
Cameron Hart 24a21d5fc6 Added scalar arithmetic operators for Matrix types 2016-01-02 16:11:16 +11:00
Brendan Zabarauskas fb722e1dac Clean up matrix tests 2015-12-29 15:49:01 +11:00
derekburch 744fb78662 Fix conversion from Matrix3 to Quaternion 2015-12-22 17:53:06 -08:00
Brendan Zabarauskas 1d886f6197 Add all permutations of matrix ops, and remove operator methods
Completes #247
2015-12-21 21:02:40 +11:00
Brendan Zabarauskas 2dc0a4a43f Rename SquareMatrix::one to identity
Fixes #260
2015-12-06 19:36:38 +11:00
Brendan Zabarauskas 178272da3d Make lots of methods take vectors and points by value 2015-11-09 20:18:02 +11:00
Brendan Zabarauskas b168c03174 Rename identity to one
Zero is the additive identity, so this disambiguates it
2015-10-01 18:56:31 +10:00
Brendan Zabarauskas 902215b532 Implement binary operators for matrices
We can't yet remove the operator methods, due to rust-lang/rust#20671
2015-09-30 19:01:30 +10:00
Dzmitry Malyshau 498df01729 Fixed all the warnings, compile issues, and tests 2015-04-04 22:31:18 -04:00
Jonathan Neuschäfer 4c527f8334 s/AUTHORS file/Cargo.toml file/ 2015-03-18 17:51:03 +01:00
Colin Sherratt 662c7d7f68 cleanup some warnings around features 2015-02-08 13:36:33 -05:00
Colin Sherratt c7270a9077 Update to latest rustc 2015-01-07 15:34:42 -07:00
Jameson Ernst 12ec7318d0 Remove deprecated Float use from tests. 2014-11-24 20:24:04 -08:00
Brendan Zabarauskas 1371f75165 Update for rustc 0.13.0-nightly
There are still some deprecation errors in the doc tests left
2014-11-16 01:59:43 +11:00
Brendan Zabarauskas 379dc499ec Publicly re-export everything from the root crate
Closes #100
2014-08-16 14:53:54 +10:00
Brendan Zabarauskas 8e5500d581 Switch to cargo 2014-08-11 16:15:14 +10:00
Renamed from src/test/matrix.rs (Browse further)