forked from M-Labs/nalgebra
Update to the last rust-nightly.
Version of rustc: 0.13.0-nightly (63c4f22f2 2014-11-05 22:31:44 +0000).
This commit is contained in:
parent
3834913402
commit
a2848e6e18
@ -1,6 +1,5 @@
|
||||
#![feature(macro_rules)]
|
||||
|
||||
extern crate debug;
|
||||
extern crate test;
|
||||
extern crate "nalgebra" as na;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#![feature(macro_rules)]
|
||||
|
||||
extern crate debug;
|
||||
extern crate test;
|
||||
extern crate "nalgebra" as na;
|
||||
|
||||
|
@ -652,7 +652,7 @@ macro_rules! scalar_mul_impl (
|
||||
DMat {
|
||||
nrows: left.nrows,
|
||||
ncols: left.ncols,
|
||||
mij: left.mij.iter().map(|a| a * *right).collect()
|
||||
mij: left.mij.iter().map(|a| *a * *right).collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -667,7 +667,7 @@ macro_rules! scalar_div_impl (
|
||||
DMat {
|
||||
nrows: left.nrows,
|
||||
ncols: left.ncols,
|
||||
mij: left.mij.iter().map(|a| a / *right).collect()
|
||||
mij: left.mij.iter().map(|a| *a / *right).collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -682,7 +682,7 @@ macro_rules! scalar_add_impl (
|
||||
DMat {
|
||||
nrows: left.nrows,
|
||||
ncols: left.ncols,
|
||||
mij: left.mij.iter().map(|a| a + *right).collect()
|
||||
mij: left.mij.iter().map(|a| *a + *right).collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -697,7 +697,7 @@ macro_rules! scalar_sub_impl (
|
||||
DMat {
|
||||
nrows: left.nrows,
|
||||
ncols: left.ncols,
|
||||
mij: left.mij.iter().map(|a| a - *right).collect()
|
||||
mij: left.mij.iter().map(|a| *a - *right).collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -169,10 +169,10 @@ macro_rules! dvec_impl(
|
||||
|
||||
let mut elt = basis_element.clone();
|
||||
|
||||
elt = elt - self * Dot::dot(&basis_element, self);
|
||||
elt = elt - *self * Dot::dot(&basis_element, self);
|
||||
|
||||
for v in res.iter() {
|
||||
elt = elt - v * Dot::dot(&elt, v)
|
||||
elt = elt - *v * Dot::dot(&elt, v)
|
||||
};
|
||||
|
||||
if !ApproxEq::approx_eq(&Norm::sqnorm(&elt), &Zero::zero()) {
|
||||
@ -336,7 +336,7 @@ macro_rules! dvec_scalar_mul_impl (
|
||||
impl $mul<$n, $dvec<$n>> for $n {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<$n>, right: &$n) -> $dvec<$n> {
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| a * *right))
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| *a * *right))
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -347,7 +347,7 @@ macro_rules! dvec_scalar_div_impl (
|
||||
impl $div<$n, $dvec<$n>> for $n {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<$n>, right: &$n) -> $dvec<$n> {
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| a / *right))
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| *a / *right))
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -358,7 +358,7 @@ macro_rules! dvec_scalar_add_impl (
|
||||
impl $add<$n, $dvec<$n>> for $n {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<$n>, right: &$n) -> $dvec<$n> {
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| a + *right))
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| *a + *right))
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -369,7 +369,7 @@ macro_rules! dvec_scalar_sub_impl (
|
||||
impl $sub<$n, $dvec<$n>> for $n {
|
||||
#[inline]
|
||||
fn binop(left: &$dvec<$n>, right: &$n) -> $dvec<$n> {
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| a - *right))
|
||||
FromIterator::from_iter(left.as_slice().iter().map(|a| *a - *right))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -88,7 +88,7 @@ macro_rules! pnt_mul_iso_impl(
|
||||
impl<N: Clone + Num> $tmul<N, $tv<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn binop(left: &$tv<N>, right: &$t<N>) -> $tv<N> {
|
||||
(left + right.translation) * right.rotation
|
||||
(*left + right.translation) * right.rotation
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -140,12 +140,12 @@ macro_rules! translate_impl(
|
||||
impl<N: Clone + Add<N, N> + Sub<N, N>> Translate<$tv<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn translate(&self, v: &$tv<N>) -> $tv<N> {
|
||||
v + self.translation
|
||||
*v + self.translation
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inv_translate(&self, v: &$tv<N>) -> $tv<N> {
|
||||
v - self.translation
|
||||
*v - self.translation
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -235,7 +235,7 @@ macro_rules! transformation_impl(
|
||||
}
|
||||
|
||||
fn append_transformation_cpy(iso: &$t<N>, t: &$t<N>) -> $t<N> {
|
||||
t * *iso
|
||||
*t * *iso
|
||||
}
|
||||
|
||||
fn prepend_transformation(&mut self, t: &$t<N>) {
|
||||
@ -284,7 +284,7 @@ macro_rules! transform_impl(
|
||||
|
||||
#[inline]
|
||||
fn inv_transform(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
t.rotation.inv_transform(&(p - t.translation))
|
||||
t.rotation.inv_transform(&(*p - t.translation))
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -136,7 +136,7 @@ impl<N: Mul<N, N> + Sub<N, N> + Add<N, N>> QuatMulRhs<N, Quat<N>> for Quat<N> {
|
||||
impl<N: ApproxEq<N> + Float + Clone> QuatDivRhs<N, Quat<N>> for Quat<N> {
|
||||
#[inline]
|
||||
fn binop(left: &Quat<N>, right: &Quat<N>) -> Quat<N> {
|
||||
left * Inv::inv_cpy(right).expect("Unable to invert the denominator.")
|
||||
*left * Inv::inv_cpy(right).expect("Unable to invert the denominator.")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,24 +37,24 @@ macro_rules! rotate_impl(
|
||||
impl<N: Num + Clone> $trhs<N> for $tv<N> {
|
||||
#[inline]
|
||||
fn rotate(t: &$t<N>, v: &$tv<N>) -> $tv<N> {
|
||||
t * *v
|
||||
*t * *v
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inv_rotate(t: &$t<N>, v: &$tv<N>) -> $tv<N> {
|
||||
v * *t
|
||||
*v * *t
|
||||
}
|
||||
}
|
||||
|
||||
impl<N: Num + Clone> $trhs<N> for $tp<N> {
|
||||
#[inline]
|
||||
fn rotate(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
t * *p
|
||||
*t * *p
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inv_rotate(t: &$t<N>, p: &$tp<N>) -> $tp<N> {
|
||||
p * *t
|
||||
*p * *t
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -136,7 +136,7 @@ impl<N: Clone + Add<N, N> + Neg<N>> Translation<vec::Vec0<N>> for vec::Vec0<N> {
|
||||
|
||||
#[inline]
|
||||
fn inv_translation(&self) -> vec::Vec0<N> {
|
||||
-self
|
||||
-*self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -156,7 +156,7 @@ impl<N: Clone + Add<N, N> + Neg<N>> Translation<vec::Vec0<N>> for vec::Vec0<N> {
|
||||
|
||||
#[inline]
|
||||
fn prepend_translation_cpy(vec: &vec::Vec0<N>, t: &vec::Vec0<N>) -> vec::Vec0<N> {
|
||||
vec + *t
|
||||
*vec + *t
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -8,7 +8,7 @@ use std::slice::{Items, MutItems};
|
||||
use std::iter::{Iterator, FromIterator};
|
||||
use traits::operations::{ApproxEq, POrd, POrdering, PartialLess, PartialEqual,
|
||||
PartialGreater, NotComparable, Axpy, ScalarAdd, ScalarSub, ScalarMul,
|
||||
ScalarDiv};
|
||||
ScalarDiv, Absolute};
|
||||
use traits::geometry::{Transform, Rotate, FromHomogeneous, ToHomogeneous, Dot, Norm,
|
||||
Translation, Translate};
|
||||
use traits::structure::{Basis, Cast, Dim, Indexable, Iterable, IterableMut, VecAsPnt, Shape,
|
||||
@ -135,6 +135,7 @@ rotate_impl!(Pnt1)
|
||||
transform_impl!(Vec1, Pnt1)
|
||||
vec_as_pnt_impl!(Vec1, Pnt1, x)
|
||||
num_float_vec_impl!(Vec1, Vec1MulRhs, Vec1DivRhs)
|
||||
absolute_vec_impl!(Vec1, x)
|
||||
|
||||
/// Vector of dimension 2.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||
@ -239,6 +240,7 @@ rotate_impl!(Pnt2)
|
||||
transform_impl!(Vec2, Pnt2)
|
||||
vec_as_pnt_impl!(Vec2, Pnt2, x, y)
|
||||
num_float_vec_impl!(Vec2, Vec2MulRhs, Vec2DivRhs)
|
||||
absolute_vec_impl!(Vec2, x, y)
|
||||
|
||||
/// Vector of dimension 3.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||
@ -348,6 +350,7 @@ rotate_impl!(Pnt3)
|
||||
transform_impl!(Vec3, Pnt3)
|
||||
vec_as_pnt_impl!(Vec3, Pnt3, x, y, z)
|
||||
num_float_vec_impl!(Vec3, Vec3MulRhs, Vec3DivRhs)
|
||||
absolute_vec_impl!(Vec3, x, y, z)
|
||||
|
||||
|
||||
/// Vector of dimension 4.
|
||||
@ -457,6 +460,7 @@ rotate_impl!(Pnt4)
|
||||
transform_impl!(Vec4, Pnt4)
|
||||
vec_as_pnt_impl!(Vec4, Pnt4, x, y, z, w)
|
||||
num_float_vec_impl!(Vec4, Vec4MulRhs, Vec4DivRhs)
|
||||
absolute_vec_impl!(Vec4, x, y, z, w)
|
||||
|
||||
/// Vector of dimension 5.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||
@ -567,6 +571,7 @@ rotate_impl!(Pnt5)
|
||||
transform_impl!(Vec5, Pnt5)
|
||||
vec_as_pnt_impl!(Vec5, Pnt5, x, y, z, w, a)
|
||||
num_float_vec_impl!(Vec5, Vec5MulRhs, Vec5DivRhs)
|
||||
absolute_vec_impl!(Vec5, x, y, z, w, a)
|
||||
|
||||
/// Vector of dimension 6.
|
||||
#[deriving(Eq, PartialEq, Encodable, Decodable, Clone, Hash, Rand, Zero, Show)]
|
||||
@ -677,3 +682,4 @@ rotate_impl!(Pnt6)
|
||||
transform_impl!(Vec6, Pnt6)
|
||||
vec_as_pnt_impl!(Vec6, Pnt6, x, y, z, w, a, b)
|
||||
num_float_vec_impl!(Vec6, Vec6MulRhs, Vec6DivRhs)
|
||||
absolute_vec_impl!(Vec6, x, y, z, w, a, b)
|
||||
|
@ -323,7 +323,7 @@ macro_rules! basis_impl(
|
||||
elt = elt - *n * Dot::dot(&basis_element, n);
|
||||
|
||||
for v in basis.iter() {
|
||||
elt = elt - v * Dot::dot(&elt, v)
|
||||
elt = elt - *v * Dot::dot(&elt, v)
|
||||
};
|
||||
|
||||
if !ApproxEq::approx_eq(&Norm::sqnorm(&elt), &Zero::zero()) {
|
||||
@ -519,7 +519,7 @@ macro_rules! translation_impl(
|
||||
|
||||
#[inline]
|
||||
fn inv_translation(&self) -> $t<N> {
|
||||
-self
|
||||
-*self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -539,7 +539,7 @@ macro_rules! translation_impl(
|
||||
|
||||
#[inline]
|
||||
fn prepend_translation_cpy(transform: &$t<N>, t: &$t<N>) -> $t<N> {
|
||||
transform + *t
|
||||
*transform + *t
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -773,3 +773,14 @@ macro_rules! num_float_vec_impl(
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
macro_rules! absolute_vec_impl(
|
||||
($t: ident, $comp0: ident $(,$compN: ident)*) => (
|
||||
impl<N: Signed> Absolute<$t<N>> for $t<N> {
|
||||
#[inline]
|
||||
fn abs(m: &$t<N>) -> $t<N> {
|
||||
$t::new(m.$comp0.abs() $(, m.$compN.abs() )*)
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -12,7 +12,7 @@ macro_rules! test_iterator_impl(
|
||||
let mut mv: $t = v.clone();
|
||||
let n: $n = random();
|
||||
|
||||
let nv: $t = v.iter().map(|e| e * n).collect();
|
||||
let nv: $t = v.iter().map(|e| *e * n).collect();
|
||||
|
||||
for e in mv.iter_mut() {
|
||||
*e = *e * n
|
||||
|
Loading…
Reference in New Issue
Block a user