Commit graph

1578 commits

Author SHA1 Message Date
Norbert Nemec
40d0afd036 drop redundant impl_scalar_ops_default 2019-09-01 21:04:04 +02:00
Norbert Nemec
1c7c889921 drop redundancy of impl_operator_default and impl_assignment_operator_default 2019-09-01 21:04:04 +02:00
Norbert Nemec
fde164293b default_fn! macro 2019-09-01 21:04:04 +02:00
Norbert Nemec
bfaec62c87 .gitignore .vs/ 2019-09-01 20:59:00 +02:00
Norbert Nemec
baa50d8b86 fix warning 2019-09-01 20:59:00 +02:00
Norbert Nemec
935f389983 replace deprecated try! macro by ? operator 2019-09-01 15:16:03 +02:00
Dzmitry Malyshau
ec5261d15b
Merge pull request #488 from spearman/bump-rand
bump rand -> 0.7, fix unused macro warnings in tests
2019-08-12 16:17:53 -04:00
Shane Pearman
2387544e08 bump rand -> 0.7, fix unused macro warnings in tests 2019-08-11 16:59:47 -07:00
bors[bot]
fcf59c8082 Merge #486
486: Implement zip for VectorN and PointN r=kvark a=mickvangelderen

Implements #485. 

It is possible but messy to put `map` and `zip` in the Array trait. Rust doesn't support higher kinded types which would help because we want to abstract over any container, holding a fixed number of some item type. The implementation would basically need to reproduce the work in the generic-array crate which is silly.

Co-authored-by: Mick van Gelderen <mickvangelderen@gmail.com>
2019-06-12 15:10:35 +00:00
Mick van Gelderen
a63843c30a Implement zip for VectorN and PointN
Impelements #485
2019-06-10 10:51:30 +02:00
bors[bot]
627d1c589f Merge #483
483: Make `rand` dependency optional (but enabled by default) r=kvark a=LukasKalbertodt

Closes #481 

This PR leaves the feature enabled by default so that this can be released as a minor version soon. (I would suggest to disable it by default in future versions, but that's another discussion.)

The changes are pretty straight forward with one catch: I changed some `use` statements to nested imports (otherwise, there would be even more `#[cfg(feature = "rand")]` lines). Nested imports were stabilized in 1.25 (see [the edition guide on this feature](https://doc.rust-lang.org/edition-guide/rust-2018/module-system/nested-imports-with-use.html)). I'm not sure how cgmaths policy on minimum compiler version is. Maybe cgmath already requires a >= 1.25 compiler for other reasons. If my change is a problem, just tell me and I will change the imports back.

Co-authored-by: Lukas Kalbertodt <lukas.kalbertodt@gmail.com>
2019-05-03 14:47:52 +00:00
Lukas Kalbertodt
31cb9eb574
Remove rand from default features 2019-05-03 16:31:14 +02:00
Lukas Kalbertodt
9e650fd8ad
Adjust Travis-CI config to build with and without rand 2019-05-02 18:09:16 +02:00
Dzmitry Malyshau
9e67e6cdc4
Merge pull request #482 from Plotnus/patch-1
fixed dropped 's' in trait.
2019-05-02 10:42:27 -04:00
Lukas Kalbertodt
4bd8ebb38d
Make rand dependency optional (but enabled by default)
Most users probably don't use the rand impls, so the `rand` crate pulls
a large number of dependencies into the dependency tree which is just
wasted compilation time.
2019-05-02 11:24:50 +02:00
Jonathan Plotner
107f90c2e5
fixed dropped 's' in trait.
Grammatical change from singular to plural.
2019-04-25 12:47:35 -07:00
bors[bot]
93786bfc9a Merge #480
480: Add documentation for `<Quaternion as Rotation<Point3<S>>>::rotate_vector` r=kvark a=tangmi

Clarifies that a quaternion should be normalized to be used as a rotation. Does not enforce or assert that the quaternion is normalized because valid rotations can be slightly off of the unit quaternion due to floating point error.

Fixes #479.

Co-authored-by: Michael Tang <tangmi@uw.edu>
2019-03-23 14:40:10 +00:00
Michael Tang
c1f808d928 Add documentation for <Quaternion as Rotation<Point3<S>>>::rotate_vector. Fixes #479. 2019-03-22 22:01:47 -07:00
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
bors[bot]
0e75148fc5 Merge #478
478: Readme links update, let travis fail on nightly r=kvark a=kvark

This is unfortunate, but it appears that we need to move to the new SIMD API in order to unblock it.

Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
2019-02-25 16:25:49 +00:00
Dzmitry Malyshau
605fb26819 Readme links update, let travis fail on nightly 2019-02-25 11:13:45 -05:00
Dzmitry Malyshau
7e390571bf
Update CHANGELOG.md 2019-01-17 13:14:36 -05:00
Dzmitry Malyshau
2f2988c4cf
Update CHANGELOG.md 2019-01-17 13:10:41 -05:00
bors[bot]
8bc3af42ef Merge #438
438: Angle: add the normalize_zero method r=kvark a=mathstuf

This method is like `normalize` except that it normalizes to have an
absolute value of no more than `turn_div_2`.

---
This is useful for making sure that an angle is no more than some offset from a target angle (e.g., implementing maximum turn rates in games).

Co-authored-by: Ben Boeckel <mathstuf@gmail.com>
2019-01-16 22:30:23 +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
bors[bot]
a570349a0d Merge #472
472: [breaking] Move lerp() from InnerSpace to VectorSpace r=Rhuagh a=Vlad-Shcherbina

Because it does not require dot product.
Along the way, fix the comment.

Fixes #471.

Co-authored-by: Vlad Shcherbina <vlad.shcherbina@gmail.com>
2019-01-14 17:10:16 +00:00
bors[bot]
649fef941b Merge #475
475: Declare vector constructors to be const r=kvark a=nstoddard

This makes it easier to create vectors in constants.

Co-authored-by: Nathan Stoddard <nstoddard@users.noreply.github.com>
2019-01-14 16:48:32 +00:00
Nathan Stoddard
c438536dac Declare the rest of the constructors to be const
This requires removing trait bounds from the constructors, and for Euler, removing the trait bound from the struct.
2019-01-13 22:42:16 -08:00
Nathan Stoddard
19f75b88e6 Declare point constructors to be const
Also add const to a vector constructor that I missed before.

Constructors for other types can't yet be const, because the compiler gives an error: "trait bounds other than `Sized` on const fn parameters are unstable".
2019-01-12 19:59:44 -08:00
Nathan Stoddard
9a20f1031c Declare vector constructors to be const
This makes it easier to create vectors in constants.
2019-01-12 14:53:20 -08:00
bors[bot]
5e758d13bd Merge #473
473: Update some dependencies r=kvark a=Eijebong



Co-authored-by: Bastien Orivel <eijebong@bananium.fr>
2018-12-28 20:25:39 +00:00
Bastien Orivel
036604ed49 Update some dependencies and bump version 2018-12-28 21:01:18 +01:00
Vlad Shcherbina
5512b6a0f7 [breaking] Move lerp() from InnerSpace to VectorSpace
Because it does not require dot product.
Along the way, fix the comment.

Fixes #471.
2018-11-22 17:43:21 +03:00
Osspial
858d3ae8c8
Merge pull request #463 from LukasKalbertodt/fix-doc-links
Fix links to OpenGL API in docs
2018-08-14 21:51:44 -04:00
Lukas Kalbertodt
e58bd7b878
Fix links to OpenGL API in docs
Those links were broken before, since the [] and () part were split
into two different lines. This also caused warnings on nightly, which
are now fixed.
2018-07-11 10:56:06 +02:00
Brendan Zabarauskas
aba0d0415e
Merge pull request #459 from VictorKoenders/rand
Bumped rand to 0.5
2018-06-11 23:08:49 +10:00
Victor Koenders
bd88d9e93f Fixed a compiler issue with the 'simd' feature 2018-06-08 14:35:12 +02:00
Victor Koenders
df4f27e40e Fixed warnings 2018-06-08 14:01:26 +02:00
Victor Koenders
cdb0e8c8a1 Bumped rand and fixed compiler issues 2018-06-08 13:39:02 +02:00
Brendan Zabarauskas
1c5fb672a4
Merge pull request #457 from alexheretic/approx-0.2
Update approx -> 0.2
2018-05-24 12:25:59 +10:00
Alex Butler
a3965d414d
Update approx -> 0.2 2018-05-23 12:43:52 +01:00
Brendan Zabarauskas
e7c31cbe5e
Merge pull request #456 from spearman/bump-num-traits
Bump num-traits version -> 0.2
2018-04-30 19:24:37 +10:00
Brendan Zabarauskas
f052bf0c9c
Merge pull request #455 from derekdreery/is_finite
Add is_finite method to vectors and matrices.
2018-04-30 19:12:06 +10:00
Richard Dodd
2a7e2ebda3 Fix simd 2018-04-29 17:04:49 +01:00
Richard Dodd
f8e92ed327 Add is_finite to array and quaternion 2018-04-29 14:21:42 +01:00
Shane Pearman
d686c404f9 Bump num-traits version -> 0.2 2018-04-28 21:00:36 -07:00
Richard Dodd
f82e421e2c Fix for simd 2018-04-28 15:09:45 +01:00
Richard Dodd
4fede94df5 Add is_finite method to vectors and matrices.
This method is useful in debug to error early when some kind of
singularity is encountered.
2018-04-28 11:34:45 +01:00