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
Sébastien Crozet
50a6454ae8
Add missing #[inline] hints.
2013-08-07 20:53:51 +02:00
Sébastien Crozet
efd14f9e88
Further coding style fixes.
2013-08-05 10:15:11 +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
53a5dbb6e3
Add Orderable
implementation for vectors.
...
The `min`, `max` and `clamp` methods are component-wise.
2013-08-04 11:06:23 +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
7b2dbb244e
Fix for
loops.
2013-08-02 10:50:04 +02:00
Sébastien Crozet
3f3f59e8eb
Changed mod visibilities + add doc for types.rs
2013-08-01 18:55:42 +02:00
Sébastien Crozet
67dea17abe
for ... advance -> foreach ... in
2013-08-01 09:18:21 +02:00
Sébastien Crozet
164ff5b1b2
Add missing type bounds.
2013-07-25 14:50:55 +02:00
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