Commit Graph

169 Commits

Author SHA1 Message Date
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
72395f3546 Add an unsafe at_fast method for unchecked read access to DVec and DMat. 2013-09-13 11:32:30 +02:00
Sébastien Crozet
3b814b462f Add unsafe methods to initialize a DVec or DMat without initialization. 2013-09-13 11:11:04 +02:00
Sébastien Crozet
05470bba90 Add a new_random method to build a DMat or DVec filled with random numbers. 2013-09-13 10:56:25 +02:00
Sébastien Crozet
1cf3506e06 Remove some useless #[test] tags. 2013-09-13 10:34:49 +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
00f26f8951 Replace std::iterator by std::iter. 2013-09-09 11:19:54 +02:00
Sébastien Crozet
ea98ef15b7 Implement Norm and Dot for DVec. 2013-09-08 18:29:51 +02:00
Sébastien Crozet
bdf82748dc Add a Dot and a Norm trait for vectors having a dot product and a norm.
Those methods are not part of the `Vec` and `AlgebraicVec` traits any more.
2013-09-08 18:20:06 +02:00
Sébastien Crozet
37f0b123e0 Make the dot-product and normalization related methods public for DVec.
This will change soon with two traits: Dot and Norm.
2013-09-08 18:00:28 +02:00
Sébastien Crozet
992adb99f0 Add a Container implementation for every vector. 2013-09-08 17:26:31 +02:00
Sébastien Crozet
57b89b38df Add nrow(), ncols() methods for DMat, and Container impl. for DVec. 2013-09-08 17:19:50 +02:00
Sébastien Crozet
3ab06faef6 Implement UnitSphereSample for Vec1. 2013-09-08 16:03:03 +02:00
Sébastien Crozet
6147d5424e Implement 3d rotation matrix -> axis angle conversion.
Cornercases are not handled correctly yet.
2013-09-08 15:45:32 +02:00
Sébastien Crozet
4e33b96aec Update to the last rust. 2013-09-07 17:26:05 +02:00
Sébastien Crozet
8db01c6409 Add more functions to initialize DMat and DVec. 2013-09-07 08:43:17 +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
0be1132452 Swap the type parameters of Transform. 2013-09-06 15:22:14 +02:00
Sébastien Crozet
2ccd62d558 Add methods to set the translation/rotation/transformation directly. 2013-09-06 08:48:08 +02:00
Sébastien Crozet
a0b232be0a Rename Mat4::projection to mat4::new_perspective. 2013-09-05 13:45:11 +02:00
Sébastien Crozet
628066cdc8 Make DMat able to represent rectangular matrices.
The code is largely untested.
2013-09-05 00:01:52 +02:00
Sébastien Crozet
8973e0d67c Add function to create a projection matrix. 2013-09-04 23:29:58 +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
70cee0ea3d Rename the main module lib.rs.
This is a first step toward the use of rustpkg.
2013-08-31 18:33:20 +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
a5a616e05e Make the traits module private.
Use `vec::Whatever` or `mat::Whatever` instead of `traits::whatever::Whatever`.
2013-08-31 12:16:53 +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
eb4e4a6aeb Add a PVec3 type, for Padded Vector 3d.
This is the same as Vec3 but with an extra field for padding. This is useful for applications
needing a power-of-two number of arguments (typically mixed CPU/GPU applications).

The corresponding matrix is not yet implemented.
2013-08-31 11:13:17 +02:00
Sébastien Crozet
346a803b7f Improve how the dummy parameter are passed to the Dim::dim function. 2013-08-30 09:53:17 +02:00
Sébastien Crozet
82ddda154f Update to work with the last compiler.
Because of the unfortunate changes on type parameters resolution:
        - the Dim trait now needs an useless parameter to infer the Self type.
        - ApproxEps::epsilon() is broken.
2013-08-28 14:22:12 +02:00
Sébastien Crozet
f465928085 Fix Transform adaptor ToHomogeneous implementation. 2013-08-26 17:39:25 +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
6999444575 Merge the Rotatable, Translatable, Transformable traits with their corresponding Rotation, Translation, Transformation. 2013-08-22 17:47:37 +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
344d761be5 Add the ability to stop the basis internal itertors. 2013-08-17 10:48:45 +02:00
Sébastien Crozet
d8db04cce5 Changed the UniformSphereSample trait to return a borrowed vector. 2013-08-16 18:08:51 +02:00
Sébastien Crozet
61e985634b Fix FromIterator impl. 2013-08-16 10:14:01 +02:00
Sébastien Crozet
5187a1a73f Add Round impl for vectors. 2013-08-15 10:41:47 +02:00
Sébastien Crozet
a69f43bccd Remove some unneded visibility modifiers. 2013-08-14 09:43:02 +02:00
Sébastien Crozet
24e1862a9e Fix to work with the last Rust deriving. 2013-08-13 10:57:19 +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
ef718028e8 Add distcheck rule to the makefile. 2013-08-11 13:24:38 +02:00