Commit Graph

185 Commits

Author SHA1 Message Date
Sébastien Crozet 99b6181b1e Complete library rewrite.
See comments on #207 for details.
2016-12-04 22:47:36 +01:00
Dimitri Sabadie a90c2c23fa Fixed #198. 2016-08-26 10:09:53 +02:00
Sébastien Crozet c4728a33d4 Fix quaternion polar decomposition. 2016-08-16 12:40:39 +02:00
Sébastien Crozet 9c4bff1f85 Rename methods starting with `new_with_` to `from_`. 2016-08-16 10:48:41 +02:00
Sébastien Crozet d45c242a15 Add a `Unit` wrapper type, remove UnitQuaternion.
The `Unit` wrapper type ensures that elements of the underlying type has a unit norm.
For example, `Unit<Vector3>` designates an element of S².
In particular `UnitQuaternion<N>` is now a type alias for `Unit<Quaternion<N>>`.
2016-08-16 10:27:07 +02:00
Sébastien Crozet 88a74ca4e5 Macro groupping. 2016-08-11 23:28:08 +02:00
Sébastien Crozet 7b4a57c224 Fix some clippy warning.
The following lints were disabled:

* wrong_self_convention
* needless_range_loop
* reverse_range_loop
* len_without_is_empty
* explicit_iter_loop
* many_single_char_names
* similar_names
* too_many_arguments
* float_cmp
* new_without_default
2016-08-11 23:08:21 +02:00
Sébastien Crozet df872f407d Replace "col" by "column".
Related to #176.
2016-04-18 08:32:12 +02:00
Sébastien Crozet 0c84d18850 Substitute: diag -> diagonal. 2016-04-17 19:47:56 +02:00
Sébastien Crozet 0380661bd2 Remove some restrictions for `NumVector`.
This removes the following inheritances:
        * Mul<Self, Output = Self>
        * Div<Self, Output = Self>
        * Add<N, Output = Self>
        * Sub<N, Output = Self>
        * MulAssign<Self>
        * DivAssign<Self>
        * AddAssign<N>
        * SubAssign<N>

They silently overrided:
        * Mul<N, Output = Self>
        * Div<N, Output = Self>
        * Add<Self, Output = Self>
        * Sub<Self, Output = Self>
        * MulAssign<N>
        * DivAssign<N>
        * AddAssign<Self>
        * SubAssign<Self>
2016-04-17 19:26:18 +02:00
Sébastien Crozet e6156727f2 Use full names for everything.
Note that `sqdist` becomes `distance_squared` and `sqnorm` becomes `norm_squared`.

Fix #176.
2016-04-17 17:26:58 +02:00
Sébastien Crozet 9e739676a7 Implement `*Assign` traits for everything.
Fix #184.
2016-04-17 12:57:54 +02:00
Jeroen Bollen dea0ccc1fd Made PntAsVec use associated types. (#179)
Fix #177
2016-04-17 09:23:37 +02:00
Sébastien Crozet f8f4924e47 Add vector perametrizable by their sizes. 2016-03-24 19:03:29 +01:00
Sébastien Crozet 11b49f50c9 Implement `Mean` for `DVec`, `DVecN`, `VecN` and `MatN`.
Fix #166.
2016-01-10 14:49:48 +01:00
Sébastien Crozet ca3c4e73c5 Fix warnings generated by the last rust-nightly. 2015-08-20 21:41:40 +02:00
Sébastien Crozet ea86890647 Add the `RotationTo` trait to compute the delta rotation between two elements.
Use `::angle_between` or `.angle_to`  to compute the rotation angle between two vectors/rotation
matrices/unit quaternions.
Use `::rotation_between` or `.rotation_to` to compute the rotation matrix/unit quaternion to
transform a vector/rotation matrix/uniq quaternion to another.

Fix #130.
2015-06-01 22:39:27 +02:00
Sébastien Crozet ca87f9eb95 Rollup of minor beaking changes.
Use associated types for the `Outer` trait.
Add a `Repeat` trait for constructing a multidimensional value by repeating an element.
Split the `Diag` trait into `Diag` and `DiagMut`.
Implement `RustEncodable` for `Identity`.
2015-05-25 14:47:14 +02:00
Sébastien Crozet 5f7b480827 Merge pull request #125 from tinco/add_neg_to_base_float
Add neg trait to BaseFloat
2015-05-08 23:55:00 +02:00
Tinco Andringa 83917cb4a4 Qualify the output of FloatVec Neg 2015-05-08 21:44:03 +02:00
Tinco Andringa f0ce528903 Add neg trait to BaseFloat 2015-05-08 21:03:13 +02:00
Eduard Bopp 730dc40b01 Remove operator hacks
The LMul, RMul and Scalar* traits were only necessary due to language
limitations regarding trait bounds that are now gone. The Mat trait is now
expressed in terms of regular operator traits.

However, due to the removal of these traits this constitutes a breaking change.
2015-05-06 13:23:14 +02:00
arturo castro 24fa9c7826 fixes for latest rust 2015-04-23 20:26:16 +02:00
Sébastien Crozet 36223991c1 Remove all deprecated functions/traits. 2015-04-18 14:58:38 +02:00
Sébastien Crozet 313ca1b8ae Use the `Zero` and `One` traits from the `num` crate.
Remove our own definitions of those traits.
Also fixes test-related attributes to make them compile again.
2015-04-18 14:38:34 +02:00
Eduard Bopp e453bfed47 Use Float trait from num crate 2015-04-04 17:53:25 +02:00
Eduard Bopp 9d428be8b4 Rename frac_2_sqrtpi -> frac_2_sqrt_pi 2015-04-04 17:05:30 +02:00
Anders Kaseorg e3962e8775 FRAC_2_SQRTPI was renamed to FRAC_2_SQRT_PI
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-04-04 16:58:11 +02:00
Eduard Bopp 49abb42980 Merge pull request #114 from andersk/neg
Remove Neg from BaseNum
2015-04-04 16:44:29 +02:00
Anders Kaseorg d47cdb5594 Remove Neg from BaseNum
As per https://github.com/rust-lang/rust/pull/23945, Neg is no longer
implemented for unsigned types.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-04-03 18:59:18 -04:00
Anders Kaseorg 165e095a57 Remove use of num::cast
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-04-02 04:53:55 -04:00
Anders Kaseorg c1cbf7465d Remove use of PI_2
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2015-04-02 04:10:36 -04:00
Eduard Bopp 70b4def5cc Stop using unstable std_misc feature
It was only used for `Float::{max_value, min_value}` in non-necessary places,
so for now this helps stabilization for Rust 1.0.
2015-03-29 13:45:33 +02:00
Sébastien Crozet 0988b837dc Update to the last rust-nighly.
Version of rustc: rustc 1.0.0-nightly (123a754cb 2015-03-24).
2015-03-25 22:39:06 +01:00
Eduard Bopp 3107dd607b Rename similar in-place and copy methods
Fixes #52.

This renames pairs of methods like `normalize_cpy`, `normalize` to `normalize`
and `normalize_mut`. Note that the previous in-place operations had the same
name that now belongs to the copy operations. Therefore this is a breaking
change.

On a similar note, the `Quat::conjugate` method was also renamed to
`conjugate_mut` and a new copying method has taken its place. This appears to
be a similar issue (apart from the lack of the copy operation) and thus was
dealt with here, too.
2015-02-01 23:23:57 +01:00
Sébastien Crozet 39fd7c1ae7 Silence warnings and replace `Show` by `Debug`. 2015-02-01 16:15:55 +01:00
Eduard Bopp 5ca3e41375 Implement AssertEq for reference types
Just as the standard library's PartialEq is implemented for reference types,
the ApproxEq trait should be implemented on them as well. This is mostly an
ergonomic improvement for certain testing situations, where a method yields a
reference. For non-copy types it allows using the assert_approx_… macros, which
would otherwise not be possible.
2015-01-25 19:51:07 +01:00
Sébastien Crozet 08049e515e Coding style fixes. 2015-01-17 22:54:57 +01:00
arturo f82cb8002d impl BaseNum for integers 2015-01-16 11:46:56 +01:00
Sébastien Crozet ce0178785c Fix automatic text replacement on comments. 2015-01-09 23:01:46 +01:00
Sébastien Crozet e6e099b7c4 Replace int, and uint, by isize and usize. 2015-01-09 22:26:05 +01:00
Sébastien Crozet c708632036 Merge pull request #70 from bfops/fnmut
Change Fn to FnMut
2015-01-07 22:45:39 +01:00
Ben Foppa f1fe7315f0 Change Fn to FnMut 2015-01-07 15:16:56 -05:00
Ben Foppa bd7b4f287f rustup 2015-01-07 15:14:40 -05:00
Ben Foppa 1429cbf34e Remove obsolete closure syntax 2015-01-06 18:46:50 -05:00
Sébastien Crozet 014aabb856 Update to the last rust-nightly.
Version of rustc: 0.13.0-nightly (c6c786671 2015-01-04 00:50:59 +0000).
2015-01-04 19:03:28 +01:00
Sébastien Crozet 0e2563a88f Merge pull request #61 from mikedilger/ulps
ApproxEq trait enhanced with ULPs method of specifying closeness:
2015-01-04 10:17:54 +01:00
Sébastien Crozet 018d4a2ec0 Remove glob imports. 2015-01-04 09:39:32 +01:00
Connorcpu a18a53b82e Updated to latest rust master 2015-01-03 13:48:10 -08:00
Mike Dilger 4c1cfb03cf ApproxEq trait enhanced with ULPs method of specifying closeness:
approx_eq_ulps() allows specification of epsilon as an integer number
  of Units in the Last Place (ULPs) difference between the two floating
  point values

  default approx_ulps() is set to 8.

  approx_eq() function continues to use epsilon method, although I
  recommend further commits and a migration towards the ULPs method.
2015-01-01 10:12:27 +13:00