Commit graph

97 commits

Author SHA1 Message Date
Norbert Nemec 935f389983 replace deprecated try! macro by ? operator 2019-09-01 15:16:03 +02:00
Mick van Gelderen a63843c30a Implement zip for VectorN and PointN
Impelements #485
2019-06-10 10:51:30 +02:00
Nathan Stoddard 2cf020351e Add short constructors for points, to match the ones for vectors 2019-01-14 15:53:28 -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
Alex Butler a3965d414d
Update approx -> 0.2 2018-05-23 12:43:52 +01:00
Richard Dodd f8e92ed327 Add is_finite to array and quaternion 2018-04-29 14:21:42 +01:00
Osspial def53ca371 Fix some documentation 2018-03-16 16:32:46 -04:00
Osspial 34da833e39 Add map functions to points and vectors 2018-01-20 23:54:59 -05:00
Osspial d1cd15a45b Implement ElementWise for PointN 2018-01-05 15:09:12 -05:00
Brendan Zabarauskas 574dd3b972 Run rustfmt on most files 2018-01-03 13:16:40 +11:00
Martin Lindhe 2acb4a968a fix some typos 2017-11-19 13:30:15 +01:00
Brendan Zabarauskas 43a6b2be8c Merge pull request #426 from Osspial/point_ops
Add vector subtraction for all points
2017-10-23 23:11:41 +11:00
Osspial 0a9c51da82 Fix incorrect operator in sub_assign impl 2017-10-06 00:20:38 -04:00
Egor Larionov 76f00b7941 Extend swizzles to increase the dimension of a vector.
For example this is now valid:
```
let p2 = Point2::new(1.0, 2.0);
let p3 = p2.xyx(); // producing Point3 { x:1.0, y:2.0, z:1.0 }
```
2017-09-30 15:09:03 -07:00
Egor Larionov cc7047555d Complete the list of generated swizzle operators. 2017-09-30 14:41:17 -07:00
Osspial a6abd5bf02 Modify cast() functions to return Option 2017-08-16 16:21:51 -04:00
Osspial 4580cb3aca Add Sub and SubAssign <Vector> for all Points 2017-08-09 14:12:51 -04:00
Osspial 1e98ef4dd4 Add Bounded impl for Vectors and Points 2017-08-08 19:11:14 -04:00
harrison 9b84d804ae added len function to Array 2017-07-31 16:13:15 -04:00
Dzmitry Malyshau d72fc08826 Mint flavour 2017-06-06 18:07:38 -04:00
Dzmitry Malyshau 7a21125c55 Refined serde dependencies 2017-06-06 16:48:55 -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 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
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 0f8a96d9b8 Changed over to the approx crate. Currently breaks rotation's doc tests. 2016-08-22 09:21:22 -06: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
Brendan Zabarauskas 54adacc2a8 Re-export Zero and One via structure module 2016-04-25 11:43:28 +10:00
Brendan Zabarauskas 4c2f301561 Add Vector1 and Point1 structs 2016-04-25 08:59:33 +10:00
Brendan Zabarauskas 8795b179d7 Add MetricSpace trait for calculating distances 2016-04-23 19:58:34 +10:00
Brendan Zabarauskas 86c13ca14f Switch to using num_traits crate from num
Fixes #336
2016-04-23 14:03:35 +10:00
Brendan Zabarauskas 8dd2874b59 Move traits into common module 2016-04-19 20:51:40 +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 3b55ad5f70 Move Vector::from_value function to Array trait 2016-04-04 20:45:37 +10: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 15b14c1e87 Rename vector identifier to point 2016-01-02 16:10:35 +11:00
Cameron Hart 3febc46d5a Added scalar arithmetic operators for Point types 2016-01-02 10:14:47 +11:00
Brendan Zabarauskas 429d2659fe Improve fmt::Debug impls 2015-12-29 21:50:43 +11:00
Brendan Zabarauskas 59d5e6f53a Implement most assignment operators 2015-12-22 22:34:34 +11:00
Brendan Zabarauskas 8c05db962a Implement by-ref negations for matrices 2015-12-22 00:43:15 +11:00
Brendan Zabarauskas d468d76e0a Remove operator methods from Point trait 2015-12-13 12:00:34 +11:00
Brendan Zabarauskas 577eafa654 Standardise macro use for code generation
This moves lots of the common code generation patterns into a macros module. In doing so, the code can be greatly reduced in size.
2015-12-12 22:17:03 +11:00
Brendan Zabarauskas 70dbef1eb1 Rename Array1 to Array 2015-11-14 22:02:17 +11:00
Brendan Zabarauskas 25ca567060 Move element-wise operations into Array1 trait 2015-11-14 12:17:03 +11:00
Brendan Zabarauskas 178272da3d Make lots of methods take vectors and points by value 2015-11-09 20:18:02 +11:00