Commit Graph

908 Commits

Author SHA1 Message Date
Sébastien Crozet
4f3de703b7 Add static methods to build canonical axis.
For exemple use: Vec3::x() to create the vector Vec3::new(1.0, 0.0, 0.0).
The same aplies for y, z, w, etc.
2013-07-24 23:54:54 +02:00
Sébastien Crozet
e75fe80966 Add documentation. 2013-07-24 16:50:40 +02:00
Sébastien Crozet
6cf8db0926 Replaced all remaining ocurences of from_homogeneous by from 2013-07-23 23:28:02 +02:00
Sébastien Crozet
321574a827 from_homogeneous -> from 2013-07-23 23:26:47 +02:00
Sébastien Crozet
93597f0ef9 Add look_at_z.
Having a look_at which aligns the z-axis with the look_at direction is useful for cameras. It
will exist only in 3d.
2013-07-23 18:41:57 +02:00
Sébastien Crozet
8634b9037d Changed the semantic of the look_at method.
Before, the `look_at` method aligned the `z` axis with the look_at direction.
This will be problematic in the future if we want to generalize that on n-dimension (the z axis
could not axis at all when n < 3).
Now, the `look_at` method aligns the `x` axis with the look_at direction. Thus we have a chance for
it to be generalizable on n-dimension, `n >= 1`.
2013-07-23 12:12:03 +02:00
Sébastien Crozet
4ea1dd92e6 Fixed transposition. 2013-07-23 11:15:20 +02:00
Sébastien Crozet
cd2aeb4861 Fix look_at. 2013-07-23 01:06:20 +02:00
Sébastien Crozet
e2f34023ed Add traits MatCast and VecCast.
VecCast casts a Vec<N1> to a Vec<N2> with N1 and N2 bounded by NumCast.
MatCast casts a Mat<N1> to a Mat<N2> with N1 and N2 bounded by NumCast.
2013-07-22 23:42:35 +02:00
Sébastien Crozet
81389a911a Add utility methods.
Added look_at for 3d rotation matrix and 3d transform.
Rotation matrices constructors are now the static methods Rotmat::from_angle,
Rotmat::from_axis_angle.
2013-07-22 23:20:03 +02:00
Sébastien Crozet
0577f3e364 Add type aliases. 2013-07-22 13:44:08 +02:00
Sébastien Crozet
f92b28f53f Add sphere sampling implementation for Vec3<f64>. 2013-07-22 12:32:42 +02:00
Sébastien Crozet
3a64e05c62 Merged the {vec, mat} and {vec, mat}_impl modules. 2013-07-22 11:35:36 +02:00
Sébastien Crozet
ff24f70332 Flattened the traits submodules. 2013-07-22 10:26:20 +02:00
Sébastien Crozet
e548e1fa5e Add tests for vec0. 2013-07-20 17:02:54 +02:00
Sébastien Crozet
ae74a05fdd Add implementation of Vec0. 2013-07-20 16:32:39 +02:00
Sébastien Crozet
d74a5905c6 Fix sub_dot implementations. 2013-07-20 15:18:44 +02:00
Sébastien Crozet
cf216f9b90 Removed occurences of copy/Copy + improved api.
Now, access to vector components are x, y, z, w, a, b, ... instead of at[i].
The method at(i) has the same (read only) effect as the old at[i].

Now, access to matrix components are m11, m12, ... instead of mij[offset(i, j)]...
The method at((i, j)) has the same effect as the old mij[offset(i, j)].

Automatic implementation of all traits the compiler supports has been added on the #[deriving]
clause for both matrices and vectors.
2013-07-20 15:07:49 +02:00
Sébastien Crozet
8918cb5d7e invert -> inplace_inverse to avoid name clash with iterators. 2013-07-13 13:34:41 +00:00
Sébastien Crozet
7f05cc5977 abs needs the Signed trait. 2013-07-10 17:43:45 +00:00
Sébastien Crozet
c37d58f3fb Add Vec0. 2013-07-07 22:34:18 +02:00
Sébastien Crozet
831f561441 Use Clone instead of Copy. 2013-07-05 22:54:42 +00:00
Sébastien Crozet
6f081b70b8 Add sphere sempling trait + Copy becomes Clone 2013-07-04 14:23:08 +00:00
Sébastien Crozet
51fd2bc744 map -> iter().transform 2013-07-02 10:00:55 +00:00
Sébastien Crozet
68d601a642 Basis trait now uses internal iterators to avoid allocations. 2013-07-01 16:33:22 +00:00
Sébastien Crozet
6fd9696253 Fix bug when trying to create a rotation matrix with a zero angle. 2013-06-30 21:19:36 +00:00
Sébastien Crozet
02e22717a4 More rotation sugar. 2013-06-29 19:02:51 +00:00
Sébastien Crozet
f8515f4683 Add rotation wrt center of a matrix. 2013-06-29 18:59:04 +00:00
Sébastien Crozet
50293ca417 Add read-only access to a Rotmat subcomponents. 2013-06-29 18:37:01 +00:00
Sébastien Crozet
364c16ca19 Add read-only accesse to a Transform subcomponents. 2013-06-29 18:35:01 +00:00
Sébastien Crozet
50d424a901 Changed the representation of rotations for 3D matrix. 2013-06-29 15:32:56 +00:00
Sébastien Crozet
429bcbf9c3 Fix Column implementation generating an ICE. 2013-06-29 15:19:21 +00:00
Sébastien Crozet
d3bed841f8 Add Column implementations. 2013-06-29 15:04:38 +00:00
Sébastien Crozet
8e8a87b667 Fixes to work with the new compiler. 2013-06-29 12:06:39 +00:00
Sébastien Crozet
3bb470ac95 Add Column + Homogeneous + Indexable traits.
Column: to access a matrix column.
Homogeneous: to convert a matrix/vector from/to homogenous coordinates.
Indexable: to access a matrix/vector element using indices.
2013-06-29 11:40:31 +00:00
Sébastien Crozet
c58e1ed40d Reorganized files. 2013-06-29 00:34:45 +00:00
Sébastien Crozet
c54eb562ec Refactor code for matrices. 2013-06-28 22:55:09 +00:00
Sébastien Crozet
cd355dfb30 Refactor vec{1, 2, 3} implemenation + add some useful traits. 2013-06-28 21:03:40 +00:00
Sébastien Crozet
8abcdeeedc #[inline(always)] -> #[inline] 2013-06-27 17:40:37 +00:00
Sébastien Crozet
6723693b49 Refined traits for rotation/translation/transformation. 2013-06-27 16:16:07 +00:00
Sébastien Crozet
ffbcf4882a Removed a lot of Copy + made Rotation and Translation more flexible. 2013-06-26 20:56:30 +00:00
Sébastien Crozet
edc5bb616d Removed some useless references. 2013-06-24 21:38:52 +00:00
Sébastien Crozet
870f4b804b Fix some infinite recursion on nvec. 2013-06-23 20:16:15 +00:00
Sébastien Crozet
0a90e6e6d8 all -> iter().all 2013-06-23 16:19:13 +00:00
Sébastien Crozet
8dc9067121 Coding style fix. 2013-06-23 16:08:50 +00:00
Sébastien Crozet
cfd7bac305 Fix to make it work with the new compiler. 2013-06-19 12:26:59 +02:00
Sébastien Crozet
854dda73bf Add implementation of Bounded. 2013-06-15 22:11:33 +00:00
Sébastien Crozet
caee7eb423 workarounds -> traits. All ICE are now compiler errors. 2013-06-15 20:16:44 +00:00
Sébastien Crozet
6e627f3378 Add Ord instances. 2013-06-15 18:06:13 +00:00
Sébastien Crozet
3ccade3d2f icomming -> master 2013-06-15 13:11:50 +00:00