Commit graph

1071 commits

Author SHA1 Message Date
kennytm f524d40403
Workaround rust-lang/rust#41478.
Replace all `impl .. for Struct<<A as Angle>::Unitless>` by
`Struct<A::Unitless>`. This allows -Zsave-analysis to work on nightly, and
I think this is more readable too.
2017-05-02 01:15:46 +08: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
Eyal Kalderon 6717b4714b Update serialization to serde v1.0 2017-04-22 18:31:50 -04:00
Brendan Zabarauskas 78555ec780 Drop rustc-serialize support
According to [Rust release milestone predictions](https://internals.rust-lang.org/t/rust-release-milestone-predictions/4591?u=dtolnay), rustc-serialize is scheduled to be deprecated in next month's beta release of Rust.

Closes #395
2017-04-16 16:35:24 +10:00
Brendan Zabarauskas b73180e908 Workaround compilation error on nightly rust 2017-04-14 23:36:02 +10:00
Brendan Zabarauskas 613d2b7f23 Merge pull request #400 from andystanton/fix_between_vectors_for_opposite_vectors
Fix between_vectors for opposite vectors
2017-04-14 22:10:33 +10:00
andystanton cd9e873739 Fix between_vectors for opposite vectors 2017-04-14 00:23:02 +01:00
Magnus Bergmark 1c3d30a1e8
Bump to serde 0.9 2017-04-04 23:47:01 +02:00
Brendan Zabarauskas 920e47526d Merge pull request #389 from bitshifter/serde_derive
Use serde_derive instead of serde_macros.
2017-03-21 17:13:13 +11:00
Dimitri Sabadie 06bf49eee5 Added dots at end of some phrases. 2017-03-21 00:10:38 +01:00
Dimitri Sabadie 530895993f or or -> or a. 2017-03-21 00:03:10 +01:00
Dimitri Sabadie b9f46af1ef subeset -> subset. 2017-03-21 00:00:45 +01:00
Brendan Zabarauskas dcb83e0ab7 Merge branch 'master' into serde_derive 2017-03-17 22:38:44 +11:00
Luxko 194c4770e9 add basic SIMD support for Quaternion<f32> 2017-03-12 20:44:58 +08:00
Luxko 09c8727c7c Add newline at end of file 2017-03-12 15:59:06 +08:00
Luxko 68d1d27222 Add SIMD support for determinant and inverse
Also:
- Change the travis script: no use `cargo bench`ing in beta or stable.
- Add bench test for Matrix4's determinant().
- clean code a bit
2017-02-25 20:31:38 +08:00
Luxko d45536f1bd Clean up a bit 2017-02-25 07:42:15 +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
Cameron Hart 4f13a96ae6 Use serde_derive instead of serde_macros. 2016-12-18 13:13:48 +11:00
Marckvdv d2d35b808b Added component wise casting number for the matrix and point types. 2016-10-03 12:51:41 +02:00
Mark Hintz f475822d9b Removes #[repr(packed)] from all structs where it was specified.
This is intended as a partial fix for #375. It doesn't also remove #[repr(C)],
since it's a bit unclear whether that's necessary.
2016-08-25 15:41:39 +02:00
Andrew Dudney f43e2e13c7 Converted serde serialization to new style 2016-08-23 12:23:07 -06: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 17d98af64f Made uses of Rad<S> more generic using Into<Rad<S>> 2016-07-26 17:30:05 -07:00
Brendan Zabarauskas 3e6974baa8 Merge pull request #364 from kvark/arc
Quaternion closest arc
2016-07-06 13:34:28 +10: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
Dzmitry Malyshau ec2ad0061b Fixed Decomposed::concat 2016-07-03 00:21:02 -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 118ec262fd Adds ApproxEq for Decomposed 2016-05-16 15:22:37 +02:00
Romain Vaillant cdbb9294e0 Adds serde support 2016-05-16 14:16:59 +02:00
Romain Vaillant f3673a1d4c makes rustc-serialize optional 2016-05-15 14:48:57 +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 8518ce78e8 Remove transforma_as_point method 2016-05-12 08:31:56 +10:00
Brendan Zabarauskas 06a58e006b Remove AffineMatrix3 2016-05-11 23:09:34 +10:00
Mark Hintz ec3385ceab Remove unused imports
Fixes compile warnings
2016-05-11 13:21:56 +02:00
Brendan Zabarauskas 266f4c1d0d Fix export warning 2016-05-10 21:55:20 +10:00
Brendan Zabarauskas 65e744c8cd Remove self inversion methods 2016-05-10 21:55:11 +10:00
Brendan Zabarauskas a4763647ec Merge pull request #339 from bjz/num-traits
Re-export num-traits crate
2016-05-09 22:31:51 +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
Mark Hintz 0a78173e2b impl Transform (2 dimensional) for Matrix3 2016-04-28 16:37:36 +02:00
Mark Hintz a3539483b6 impl Transform (3 dimensional) for Matrix3 2016-04-28 16:37:36 +02:00
Mark Hintz ab1d3d8622 imple Transform (and Transform3) for Matrix4
The change in transform.rs is to disambiguate which invert function is used
2016-04-28 16:37:36 +02:00
Mark Hintz c32135a5d9 Move the From impls together 2016-04-28 16:37:36 +02:00
Mark Hintz 808a17fc22 implement from_angle{x, y, z} and from_axis_angle for Matrix4
All are duplicates of the same functions for Matrix3, with extra parameters added in to make up the full 4x4
2016-04-28 01:03:33 +02:00
Mark Hintz c8b1d4b498 Minor documentation fix - cotangent and secant were swapped 2016-04-27 17:10:57 +02:00
Brendan Zabarauskas 6b48236cb6 Inherit Zero and One for core structural traits 2016-04-25 15:26:56 +10:00
Brendan Zabarauskas 54adacc2a8 Re-export Zero and One via structure module 2016-04-25 11:43:28 +10:00
Brendan Zabarauskas e1de5e9330 Merge pull request #343 from bjz/vector1
Add Vector1 and Point1 structs
2016-04-25 09:19:31 +10:00
Brendan Zabarauskas 4c2f301561 Add Vector1 and Point1 structs 2016-04-25 08:59:33 +10:00
Brendan Zabarauskas bb4ebbdd76 Add midpoint and centroid functions 2016-04-24 13:54:29 +10:00
Brendan Zabarauskas 8795b179d7 Add MetricSpace trait for calculating distances 2016-04-23 19:58:34 +10:00
Brendan Zabarauskas dacb511b78 Add Euler::new function 2016-04-23 17:08:40 +10:00
Brendan Zabarauskas 437e2ec9f9 Document pitch/yaw/roll 2016-04-23 16:56:07 +10:00
Brendan Zabarauskas 0259acb87f Switch to an Euler angle type for defining rotations 2016-04-23 16:56:07 +10:00
Brendan Zabarauskas 5a8caa47f0 Re-export num-traits crate 2016-04-23 16:17:31 +10:00
Brendan Zabarauskas 86c13ca14f Switch to using num_traits crate from num
Fixes #336
2016-04-23 14:03:35 +10:00
Arvamer b21ad34b8b Fix assignment operators for angles 2016-04-20 12:17:42 +02:00
Brendan Zabarauskas 8dd2874b59 Move traits into common module 2016-04-19 20:51:40 +10:00
Brendan Zabarauskas e9671e6070 Move Quaternion::{slerp, to_euler} out of separate impl block 2016-04-16 14:32:28 +10:00
Brendan Zabarauskas 07301eb4d0 Stabilise assignment operators
Assignment operators were stabilised in Rust 1.8.
2016-04-16 10:09:47 +10:00
Brendan Zabarauskas 23fce928c0 Module documentation updates 2016-04-09 14:22:30 +10:00
Brendan Zabarauskas a3e6cd26b5 Document fields 2016-04-09 13:47:17 +10:00
Brendan Zabarauskas 886e2fb240 Unify trait hierarchies for vectors, quaternions and matrices 2016-04-09 13:47:04 +10:00
Brendan Zabarauskas b4063ea72a Rename Point to EuclideanSpace 2016-04-08 19:56:30 +10:00
Brendan Zabarauskas b5f8e7646b Rename Point::Vector to Point::Diff 2016-04-08 15:35:11 +10:00
Brendan Zabarauskas 2b36ea2ef9 Rename Vector trait to VectorSpace and EuclideanVector to InnerSpace 2016-04-08 08:46:35 +10:00
Brendan Zabarauskas f82c8826a2 Add doc comments for vector axes 2016-04-05 08:52:27 +10:00
Brendan Zabarauskas 90dbd29f6d Make some documentation more succinct 2016-04-04 20:45:37 +10:00
Brendan Zabarauskas f766973a74 Remove neg_self methods
These are a weird methods... they aren't associated with any traits. I think they were left-over from before we moved to operator impls.
2016-04-04 20:45:37 +10:00
Brendan Zabarauskas 019cac1f74 Add some links to wikipedia pages 2016-04-04 20:45:37 +10:00
Brendan Zabarauskas 40a3ad3185 Add a default implementation for EuclideanVector::angle 2016-04-04 20:45:37 +10:00
Brendan Zabarauskas 3b55ad5f70 Move Vector::from_value function to Array trait 2016-04-04 20:45:37 +10:00
Brendan Zabarauskas e0a5164967 Improve documentation for vector traits 2016-04-04 20:45:37 +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 1905354d26 Fix spelling 2016-04-03 13:56:26 +10:00
Brendan Zabarauskas 1d33c231e3 Improve the documentation for some angle methods 2016-04-03 13:49:58 +10:00
Brendan Zabarauskas aa6fd71ab8 Move Angle::new to be implemented directly on angle types
This is more in keeping with most Rust APIs, and the other types in this library
2016-04-03 13:36:31 +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 5f7e47371e Merge remote-tracking branch 'origin/master' into element-wise 2016-03-27 16:43:20 +11:00
Brendan Zabarauskas fb5228f14f Clean up some function calls 2016-03-27 16:25:03 +11:00
Brendan Zabarauskas f7bc6dcc54 Rename Vector::length to Vector::magnitude 2016-03-27 16:17:11 +11:00
Brendan Zabarauskas 813b4aa5c2 Add constrained conversion functions 2016-03-26 16:41:31 +11:00
Brendan Zabarauskas 8d10f1dc6d Remove extraneous operator overloads on vectors, and add Elementwise trait 2016-03-26 13:28:49 +11:00
Brendan Zabarauskas 652ec87dd8 Add prelude module 2016-03-25 15:27:57 +11:00
Brendan Zabarauskas 3d55187a7d Mark some types as #[repr(C, packed)]
Closes #296
2016-03-25 12:42:17 +11:00
Brendan Zabarauskas 667888a0c5 Improve documentation for the Point trait 2016-03-24 22:56:21 +11:00
Cameron Hart 73c34e9f05 Small doc fix for EuclideanVector trait 2016-02-17 22:43:41 +11:00
Cameron Hart 24a21d5fc6 Added scalar arithmetic operators for Matrix types 2016-01-02 16:11:16 +11:00
Cameron Hart 15b14c1e87 Rename vector identifier to point 2016-01-02 16:10:35 +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 338c494735 Make macro usage more like existing style 2016-01-02 00:09:11 +11:00