The `Unit` wrapper type ensures that elements of the underlying type has a unit norm.
For example, `Unit<Vector3>` designates an element of S².
In particular `UnitQuaternion<N>` is now a type alias for `Unit<Quaternion<N>>`.
Those are named DMat1 to DMat6 and have the same relation with DMat as DVec1 to DVec6 are related
to DVec.
As a side effect, the method `to_vec` of DMat was renamed `into_vec` to be more in line with the std lib.
Addresses the second point of #100.
Use `::angle_between` or `.angle_to` to compute the rotation angle between two vectors/rotation
matrices/unit quaternions.
Use `::rotation_between` or `.rotation_to` to compute the rotation matrix/unit quaternion to
transform a vector/rotation matrix/uniq quaternion to another.
Fix#130.
Use associated types for the `Outer` trait.
Add a `Repeat` trait for constructing a multidimensional value by repeating an element.
Split the `Diag` trait into `Diag` and `DiagMut`.
Implement `RustEncodable` for `Identity`.
The LMul, RMul and Scalar* traits were only necessary due to language
limitations regarding trait bounds that are now gone. The Mat trait is now
expressed in terms of regular operator traits.
However, due to the removal of these traits this constitutes a breaking change.
Resolves this error, which is fallout from
https://github.com/rust-lang/rust/pull/23673:
src/structs/dmat.rs:501:43: 501:74 error: type annotations required: cannot resolve `<f64 as core::ops::Div<_>>::Output == f64` [E0284]
src/structs/dmat.rs:501 let normalizer: N = Cast::from(1.0f64 / Cast::from(self.nrows));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Fixes#52.
This renames pairs of methods like `normalize_cpy`, `normalize` to `normalize`
and `normalize_mut`. Note that the previous in-place operations had the same
name that now belongs to the copy operations. Therefore this is a breaking
change.
On a similar note, the `Quat::conjugate` method was also renamed to
`conjugate_mut` and a new copying method has taken its place. This appears to
be a similar issue (apart from the lack of the copy operation) and thus was
dealt with here, too.
Rot4 and Iso4 had to be left out, since Rot4 apparently lacks a working
constructor.
Thereby (almost) all types in nalgebra can now be used for quickcheck-style
testing.
"arbitrary" is now a conditionally compiled feature that contains these impls
adding a dependency on quickcheck.
Wherever sensible the geometric traits now take `&self` arguments, so that
implementations can be invoked as instance methods instead of static methods.
This makes some idioms easier to express and generally allows for greater
flexibility as the restructured methods can still be invoked like static
methods.
Fixes#39.
These macros yield readable error messages as test assertions for ApproxEq
types. They can be invoked as:
assert_approx_eq!(a, b);
assert_approx_eq_eps!(a, b, eps);
Fixes#40.
This is just a quick-fix so that nalgebra compiles.
This does not fix the deprecation warnings!
Version of rustc: 0.13.0-nightly (d91a015ab 2014-11-14 23:37:27 +0000).
This adds the Pnt{1,2,3,4,5,6} structures.
This adds the traits:
− AnyPnt
− FloatPnt
− PntExt
− FloatPntExt
− Orig (to return the zero point)
− PntAsVec
− VecAsPnt
This adds operator overloading:
− Pnt + Vec
− Pnt - Vec
− Pnt * Scalar
− Pnt / Scalar
− Pnt + Scalar
− Pnt - Scalar
− Iso * Pnt
− Rot * Pnt
− Pnt * Iso
− Pnt * Rot
This changes some behavior:
− Iso multiplication with a Vec does not translate the vector any more.
− ToHomogeneous adds a 0.0 at the end of a Vec and a 1.0 at the end of a Pnt.
− FromHomogeneous performs w-normalization on a Pnt, but not on a Vec.
− The Translate<Vec> trait is never implemented (i-e. a Vec is not to be translated).
cc #25
Version of rustc: 0.11.0-pre-nightly (faa7ba7 2014-05-31 01:06:40 -0700).
Main changes:
* `cmp::Ord` -> `cmp::PartialOrd`
* `cmp::Eq` -> `cmp::PartialEq`
Note that `na::PartialOrd` is not the same as `cmp::PartialOrd`
(which lacks a lot of partial ordering operators).
Version of rustc: 0.10-pre (b0ce960 2014-02-17 22:16:51 -0800)
This replaces uses of the `Orderable` trait by a `PartialOrd` trait: the `min` and `max` methods
are replaced by `inf` and `sup` methods.
Vectors do not implement the `Ord` trait any more.
Fix#4
Now that the documentation of public export of private modules is inlined on the exporter's
documentation, there is non need to export anything but the `na` module.
This is to make people prefer the functional style.
Things like `a.dot(b)` dont make sense per se (there is no reason for `a` to have a different
status than `b`). Using static methods avoid this.
In-place methods are left unchanged.
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.
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.
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.
Traits like `AbsoluteRotate` and `RotationWithTranslation` have been moved to a `comp` folder
containing any trait providing operations which are combination of several traits.
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.