Commit graph

101 commits

Author SHA1 Message Date
bors[bot]
9402a01a5b Merge #476
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>
2019-02-25 16:34:53 +00:00
Ben Boeckel
1b57dc93a5 tests: add tests for Angle::normalize 2019-01-16 16:02:37 -05:00
Ben Boeckel
2d2c501074 Angle: add the normalize_signed method
This method is like `normalize` except that it normalizes to have an
absolute value of no more than `turn_div_2`.
2019-01-16 16:01:46 -05:00
Nathan Stoddard
2cf020351e Add short constructors for points, to match the ones for vectors 2019-01-14 15:53:28 -08:00
Brendan Zabarauskas
574dd3b972 Run rustfmt on most files 2018-01-03 13:16:40 +11:00
Brendan Zabarauskas
ccc81b4760 Merge pull request #432 from elrnv/swizzle
Swizzle Operators
2017-10-02 09:13:07 +11:00
Egor Larionov
ae7a85305c Guard the swizzle test by the "swizzle" feature flag.
Also rename the swizzle tests with a "swizzle" postfix to easier see these in
the test log.
2017-10-01 13:36:01 -07:00
Egor Larionov
b700a8db59 Added sanity checks for the new swizzle operators 2017-09-30 15:18:31 -07:00
Simon Rönnberg
8343e40b48 Adding inverse transformation of a vector. 2017-09-28 22:32:23 +02:00
Brendan Zabarauskas
3543ac0274 Merge pull request #427 from Osspial/cast_option
Modify cast functions to return Option
2017-08-22 19:32:57 +10:00
Brendan Zabarauskas
bba6285f4d Merge pull request #420 from DataAnalysisCosby/master
Added project_on to InnerSpace
2017-08-22 19:31:07 +10:00
Matthew Plant
bc9c5b7f79 Added project_on to InnerSpace 2017-08-21 13:47:15 -07:00
Osspial
a6abd5bf02 Modify cast() functions to return Option 2017-08-16 16:21:51 -04:00
Owen Sanchez
51b3d2d477 Add cast method to Quaternion 2017-07-13 12:24:30 -07:00
Dzmitry Malyshau
7a21125c55 Refined serde dependencies 2017-06-06 16:48:55 -04:00
Dzmitry Malyshau
087336d0c0 Refinded simd feature 2017-06-06 16:44:13 -04:00
Brendan Zabarauskas
b6199ca702 Remove PartialOrd
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`.
2017-05-06 17:12:52 +10:00
Brendan Zabarauskas
ff2d15e0ff Implement Sum for Angle 2017-04-26 21:56:02 +10: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
andystanton
cd9e873739 Fix between_vectors for opposite vectors 2017-04-14 00:23:02 +01:00
Luxko
09c8727c7c Add newline at end of file 2017-03-12 15:59:06 +08:00
Luxko
64924b954d [WIP]Add basic SIMD support
- 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.
2017-02-25 07:26:11 +08: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
Dzmitry Malyshau
55c212bde1 Styling fixes to the quaternion arc code 2016-07-05 21:30:13 -04:00
Dzmitry Malyshau
f555074a44 Quaternion closest arc 2016-07-03 00:23:46 -04:00
Brendan Zabarauskas
7147180936 Merge pull request #359 from jminer/rotation-fixes
Rotation fixes
2016-05-18 00:19:43 +10:00
Romain Vaillant
bb5eed1af6 Add serde serialization test 2016-05-16 15:25:28 +02: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
Jordan Miner
b56119a42f Test converting axis angles to quaternions 2016-05-12 01:28:15 -05:00
Jordan Miner
467e87f3d3 Fix Euler angles to quaternion conversion and vise versa
Add tests that rotate a vector in all three axes, and tests to check
the axis rotation sequence.
2016-05-12 01:28:15 -05:00
Brendan Zabarauskas
a1d8eaed10 Make Rotation trait depend on One 2016-05-12 08:36:34 +10:00
Brendan Zabarauskas
65e744c8cd Remove self inversion methods 2016-05-10 21:55:11 +10:00
Mark Hintz
074cb2c36f Change the name of methods on the Transform trait to avoid clashes
Transform::invert becomes Transform::inverse_transform, and Transform::invert_self becomes Transform::to_inverse. Tests passing for me now
2016-05-01 14:59:38 +02:00
Brendan Zabarauskas
0259acb87f Switch to an Euler angle type for defining rotations 2016-04-23 16:56:07 +10:00
Brendan Zabarauskas
2cd6f402df Move the dot method onto EuclideanVector
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.
2016-04-04 20:45:37 +10:00
Brendan Zabarauskas
40232ec063 Remove Angle::equiv
Thus relied on the == operator, which doesn't make sense for floats. It seems better to leave this up to clients to decide if they want to normalize.
2016-04-03 13:32:55 +10:00
Brendan Zabarauskas
0de8942748 Merge pull request #311 from bjz/rename-vector-length
Rename Vector::length to Vector::magnitude
2016-03-28 13:47:50 +11:00
Brendan Zabarauskas
f7bc6dcc54 Rename Vector::length to Vector::magnitude 2016-03-27 16:17:11 +11:00
Brendan Zabarauskas
8d10f1dc6d Remove extraneous operator overloads on vectors, and add Elementwise trait 2016-03-26 13:28:49 +11: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
Cameron Hart
9096e409d1 Added scalar arithmetic operators for Quaternions 2016-01-02 11:13:27 +11:00
Cameron Hart
3febc46d5a Added scalar arithmetic operators for Point types 2016-01-02 10:14:47 +11:00
Cameron Hart
1e6f615f9e Split arithmetic operator tests into per op tests 2016-01-02 09:12:13 +11:00
Cameron Hart
62b6c961a4 Test by-ref arithmetic operators against by-val results 2016-01-02 08:57:16 +11:00
Cameron Hart
043a63c45a Expand vector aritmetic operator tests
Add test for vector on vector operators and different permutations
of vector references.
2016-01-02 00:18:48 +11:00