Commit Graph

41 Commits

Author SHA1 Message Date
Sébastien Crozet
a54c42229b Update to the last Rust: remove the float type. 2013-10-02 11:52:10 +02:00
Sébastien Crozet
4ffe274b03 Add mean and covariance computation for DMat.
This also fixes the transposition for rectangular DMat, and add scalar
addition/subtraction/multiplication/division for DMat.
2013-09-22 15:47:53 +02:00
Sébastien Crozet
7de844b46a Moved some files + use rustdoc_ng to generate the documenatiton.
Trait failes are merged in three files:
    * operations.rs - for low-level matrix/vector operations
    * geometry.rs   - for operations with a clear, broadly known geometric meaning.
    * structure.rs  - for operations to access/alter the object inner structures.

Specialisations are moved to the `spec` folder.
2013-09-22 11:05:15 +02:00
Sébastien Crozet
9a9de20b8a Remove the redundant Column trait + Add unchecked access indexing to dynamic matrices/vectors. 2013-09-20 22:17:55 +02:00
Sébastien Crozet
6dc8139794 "Remove" the RMul and LMul trait. Use the regular Mul trait.
Those traits are not really removed since they are useful on generic code (to work around curret
limitations of rust traits system).
2013-09-15 11:18:06 +02:00
Sébastien Crozet
514bf74efe "Replaced" Scalar{Add, Sub, Mul, Div} by operator overloading.
Those traits are not really removed since rust cannot handle those multiple operator overloading
very well yet, making them sometimes unuseable on generic code.
2013-09-14 21:32:38 +02:00
Sébastien Crozet
e3a1d56e58 Set up the hack to allow better overloads of the Mul trait.
This is strongly inpired by
http://smallcultfollowing.com/babysteps/blog/2012/10/04/refining-traits-slash-impls/
2013-09-14 17:08:48 +02:00
Sébastien Crozet
06c7293e83 Specialized Mul, RMul, and LMul for Mat2 and Mat3. 2013-09-14 11:07:52 +02:00
Sébastien Crozet
1a08262f50 More unsafe indexing in inner loops and add some benchmarks. 2013-09-14 00:08:46 +02:00
Sébastien Crozet
6f81fc6d5c Add Absolute, Col, Mat, AbsoluteRotate traits.
Traits like `AbsoluteRotate` and `RotationWithTranslation` have been moved to a `comp` folder
containing any trait providing operations which are combination of several traits.
2013-09-13 10:26:19 +02:00
Sébastien Crozet
4e33b96aec Update to the last rust. 2013-09-07 17:26:05 +02:00
Sébastien Crozet
a00860df41 Reexport DMat in mat.rs and DVec in vec.rs. 2013-09-07 08:23:09 +02:00
Sébastien Crozet
539e34c2bf Move all the rotation-related free functions to a RotationWithTranslation trait.
This is not a very good name though.
2013-09-04 17:07:56 +02:00
Sébastien Crozet
a40899ef67 Add missing rotation-related functions. 2013-08-31 17:17:18 +02:00
Sébastien Crozet
9ecafc5cdf Dont use globing pub use, they are buggy. 2013-08-31 17:14:41 +02:00
Sébastien Crozet
f762891ecf Move the Outer product trait to vec.rs 2013-08-31 12:23:26 +02:00
Sébastien Crozet
1b31304a9e Rework the trait exports.
`use vec::an_operation` will import a vector-applicable operation trait.
`use mat::an_operation` will import a matrix-applicable operation trait.
2013-08-31 11:41:32 +02:00
Sébastien Crozet
7052aa88ee Add two traits: CrossMatrix and Row.
CrossMatrix is a trait for vectors having a cross product representable as a matrix.
Row is a trait for Matrixces and Vectors, to access (by index) their rows.
2013-08-25 23:01:44 +02:00
Sébastien Crozet
4635d6ebac Add Rotate, Transform, Translate impl for vectors. 2013-08-23 16:29:08 +02:00
Sébastien Crozet
833378d83f Add and Identity matrix type.
It implements most matrix traits but all its operations are no-ops.
2013-08-23 15:59:26 +02:00
Sébastien Crozet
347883caa1 Rework of the traits for Vectors.
The goal is to make traits less fine-grained for vectors, and reduce the amount of `use`.

- Scalar{Mul, Div} are removed, replaced by Mul<N, V> and Div<N, V>,
- Ring and DivisionRing are removed. Use Num instead.
- VectorSpace, Dot, and Norm are removed, replaced by the new, higher-level traits.

Add four traits:
- Vec: common operations on vectors. Replaces VectorSpace and Dot.
- AlgebraicVec: Vec + the old Norm trait.
- VecExt: Vec + every other traits vectors implement.
- AlgebraicVecExt: AlgebraicVec + VecExt.
2013-08-18 18:33:25 +02:00
Sébastien Crozet
cead4f8410 Moved DivisionRing to ring.rs. 2013-08-17 17:50:01 +02:00
Sébastien Crozet
a46b063192 Add Scalar{Mul, Div, Add, Sub} for matrices. 2013-08-12 17:04:53 +02:00
Sébastien Crozet
037cf95542 Add (pointwise) Add and Sub impl for matrices. 2013-08-12 16:50:50 +02:00
Sébastien Crozet
b08a8384ae Add outer product. 2013-08-12 16:45:31 +02:00
Sébastien Crozet
3858c63291 Update to work with the last Rust api. 2013-08-11 16:07:34 +02:00
Sébastien Crozet
c59911168e Fix curly braces. 2013-08-05 10:13:44 +02:00
Sébastien Crozet
a810bf6008 Indentation fixes. 2013-08-05 09:44:56 +02:00
Sébastien Crozet
9af1cac45d Fix Ord implementations to be a partial order.
When two elements are not comparable, all comparison operators return `false`.
2013-08-04 10:36:35 +02:00
Sébastien Crozet
50b34ca765 Fix for loops (again) + iterate becomes range. 2013-08-03 12:21:56 +02:00
Sébastien Crozet
e75fe80966 Add documentation. 2013-07-24 16:50:40 +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
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
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
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
d3bed841f8 Add Column implementations. 2013-06-29 15:04:38 +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