Commit Graph

1007 Commits

Author SHA1 Message Date
Sébastien Crozet dcd1e7719b Add methods to access a DVec<N> as a &[N]. 2013-10-14 15:38:23 +02:00
Sébastien Crozet bb5654d220 Remove free-functions alliasing structures constructors.
Those constructors are not idiomatic. Use e.g. `Vec3::new(0, 0, 0)` instead.
2013-10-14 11:22:38 +02:00
Sébastien Crozet ccbc8b4429 Api change: deal with inplace/out of place methods.
Before, it was too easy to use an out of place method instead of the inplace one since they name
were pretty mutch the same. This kind of confusion may lead to silly bugs very hard to understand.
Thus the following changes have been made when a method is available both inplace and out-of-place:

* inplace version keep a short name.
* out-of-place version are suffixed by `_cpy` (meaning `copy`), and are static methods.

Methods applying transformations (rotation, translation or general transform) are now prefixed by
`append`, and a `prepend` version is available too.

Also, free functions doing in-place modifications dont really make sense. They have been removed.

Here are the naming changes:
* `invert` -> `inv`
* `inverted` -> `Inv::inv_cpy`
* `transpose` -> `transpose`
* `transposed` -> `Transpose::transpose_cpy`
* `transform_by` -> `append_transformation`
* `transformed` -> `Transform::append_transformation_cpy`
* `rotate_by` -> `apppend_rotation`
* `rotated` -> `Rotation::append_rotation_cpy`
* `translate_by` -> `apppend_translation`
* `translate` -> `Translation::append_translation_cpy`
* `normalized` -> `Norm::normalize_cpy`
* `rotated_wrt_point` -> `RotationWithTranslation::append_rotation_wrt_point_cpy`
* `rotated_wrt_center` -> `RotationWithTranslation::append_rotation_wrt_center_cpy`

Note that using those static methods is very verbose, and using in-place methods require an
explicit import of the related trait.

This is a way to convince the user to use free functions most of the time.
2013-10-14 10:42:07 +02:00
Sébastien Crozet 86d6ff759c Replace `rust build` by `rustc`. 2013-10-12 10:41:48 +02:00
Sébastien Crozet 20bdbb6408 Dont re-export std::num::{Zero, One}.
This is useless.
2013-10-10 00:45:56 +02:00
Sébastien Crozet c352452bcb Remove unused import. 2013-10-10 00:26:07 +02:00
Sébastien Crozet 7667d8f19a Add a double-trait-dispatch-trick based cast trait
The Cast trait replaces both MatCast and VecCast.
2013-10-09 23:10:43 +02:00
Sébastien Crozet 2a4807262a Re-export the Identity type properly. 2013-10-08 21:00:45 +02:00
Sébastien Crozet 63e6474d40 Re-add look_at methods for isometries. 2013-10-08 21:00:25 +02:00
Sébastien Crozet 1c0b60c3ef Add a link to the on-line documentation. 2013-10-08 02:10:35 +02:00
Sébastien Crozet d25534610d Add a one-line description to each free-function.
This is better than nothing.
2013-10-08 01:59:15 +02:00
Sébastien Crozet edf17b5667 Update to the last Rust.
Also use free-functions on tests.
2013-10-08 01:22:56 +02:00
Sébastien Crozet 3f99bd62c6 Use `use` instead of `pub use` to import modules on the examples. 2013-10-06 19:36:59 +02:00
Sébastien Crozet ee2db8da99 Add the "nalgebra in use" part to the readme. 2013-10-06 19:32:31 +02:00
Sébastien Crozet d0267f5071 Fix the example given by the readme. 2013-10-06 19:28:52 +02:00
Sébastien Crozet 5e4285ae6f Fix typos on the readme. 2013-10-06 19:20:39 +02:00
Sébastien Crozet 84212f1449 Huge api change!
Everything changed, hopefully for the best.

* everything is accessible from the `na` module. It re-export
  everything and provides free functions (i-e: na::dot(a, b) instead of
  a.dot(b)) for most functionalities.
* matrix/vector adaptors (Rotmat, Transform) are replaced by plain
  types: Rot{2, 3, 4} for rotation matrices and Iso{2, 3, 4} for
  isometries (rotation + translation).  This old adaptors system was to
  hard to understand and to document.
* each file related to data structures moved to the `structs` folder.
  This makes the doc a lot more readable and make people prefer the
  `na` module instead of individual small modules.
* Because `na` exists now, the modules `structs::vec` and
  `structs::mat` dont re-export anything now.

As a side effect, this makes the documentation more readable.
2013-10-06 18:07:17 +02:00
Sébastien Crozet 2356723e90 Add some impls for 4d rotations.
It is not possible to create a 4d rotation yet.
2013-10-03 23:58:36 +02:00
Sébastien Crozet 820790bfa9 Add pointwise multiplication and division for vectors. 2013-10-03 18:25:57 +02:00
Sébastien Crozet b364920d9b Move the Round trait inheritance from VecExt to AlgebraicVecExt.
What it the point of rounding an integer-valued vector?
2013-10-03 00:57:43 +02:00
Sébastien Crozet d4ee651305 Move the Basis trait inheritance from VecExt to AlgebraicVecExt.
The Basis trait cannot be implemented if the vector is not algebraic anyway.
2013-10-03 00:45:50 +02:00
Sébastien Crozet ebcc294a38 Update the doc rule. 2013-10-02 18:20:53 +02:00
Sébastien Crozet 0228d70add Add the frog to the project list. 2013-10-02 12:53:38 +02:00
Sébastien Crozet a54c42229b Update to the last Rust: remove the float type. 2013-10-02 11:52:10 +02:00
Sébastien Crozet f17ed215a0 Fix formatting on the README. 2013-09-28 00:15:44 +02:00
Sébastien Crozet 828dc8451e Improve the readme. 2013-09-28 00:12:18 +02:00
Sébastien Crozet c344be7351 Minor doc improvements. 2013-09-26 17:19:42 +02:00
Sébastien Crozet b61d621090 Update to the last Rust. 2013-09-26 17:05:11 +02:00
Sébastien Crozet 410bbd1d25 Update to the last Rust api.
RngUtils is dead.
rustdoc_ng became rustdoc.
2013-09-22 21:12:50 +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 d12d23d2c7 Add the doc folder to the .gitignore. 2013-09-22 11:09:32 +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 c89a6681c1 Fix broken 2d rotation. 2013-09-15 11:51:42 +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 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