Fixes to work with the new compiler.

This commit is contained in:
Sébastien Crozet 2013-06-29 12:06:39 +00:00
parent 3bb470ac95
commit 8e8a87b667
3 changed files with 14 additions and 14 deletions

View File

@ -101,11 +101,11 @@ impl<M: Translate<V>, V, _0> Translate<V> for Transform<M, _0>
{ self.submat.inv_translate(v) }
}
impl<M: Copy, V: Translatable<V, Res>, Res: Translation<V>>
Translatable<V, Transform<M, Res>> for Transform<M, V>
impl<M: Copy, V: Translatable<V, V> + Translation<V>>
Translatable<V, Transform<M, V>> for Transform<M, V>
{
#[inline]
fn translated(&self, t: &V) -> Transform<M, Res>
fn translated(&self, t: &V) -> Transform<M, V>
{ Transform::new(copy self.submat, self.subtrans.translated(t)) }
}
@ -146,7 +146,7 @@ impl<M: Rotate<V>, V, _0> Rotate<V> for Transform<M, _0>
}
impl<M: Rotatable<AV, Res> + One,
Res: Rotation<AV> + RMul<V>,
Res: Rotation<AV> + RMul<V> + One,
V,
AV>
Rotatable<AV, Transform<Res, V>> for Transform<M, V>
@ -189,7 +189,7 @@ transformation::Transform<V> for Transform<M, V>
// FIXME: constraints are too restrictive.
// Should be: Transformable<M2, // Transform<Res, V> ...
impl<M: RMul<V> + Mul<M, M>, V: Add<V, V>>
impl<M: RMul<V> + Mul<M, M> + Inv, V: Add<V, V> + Neg<V>>
Transformable<Transform<M, V>, Transform<M, V>> for Transform<M, V>
{
fn transformed(&self, t: &Transform<M, V>) -> Transform<M, V>

View File

@ -13,7 +13,7 @@ use traits::norm::Norm;
use traits::translation::{Translation, Translatable};
use traits::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
#[deriving(Eq, Ord, ToStr, Clone)]
#[deriving(Eq, Ord, ToStr)]
pub struct DVec<N>
{
at: ~[N]
@ -53,7 +53,7 @@ impl<N, Iter: Iterator<N>> FromIterator<N, Iter> for DVec<N>
}
// FIXME: is Clone needed?
impl<N: Copy + DivisionRing + Algebraic + Clone + ApproxEq<N>> DVec<N>
impl<N: Copy + DivisionRing + Algebraic + ApproxEq<N>> DVec<N>
{
pub fn canonical_basis_with_dim(dim: uint) -> ~[DVec<N>]
{
@ -87,7 +87,7 @@ impl<N: Copy + DivisionRing + Algebraic + Clone + ApproxEq<N>> DVec<N>
if res.len() == dim - 1
{ break; }
let mut elt = basis_element.clone();
let mut elt = copy basis_element;
elt = elt - self.scalar_mul(&basis_element.dot(self));
@ -223,11 +223,11 @@ ScalarSub<N> for DVec<N>
}
}
impl<N: Clone + Copy + Add<N, N> + Neg<N>> Translation<DVec<N>> for DVec<N>
impl<N: Copy + Add<N, N> + Neg<N>> Translation<DVec<N>> for DVec<N>
{
#[inline]
fn translation(&self) -> DVec<N>
{ self.clone() }
{ copy *self }
#[inline]
fn inv_translation(&self) -> DVec<N>
@ -238,14 +238,14 @@ impl<N: Clone + Copy + Add<N, N> + Neg<N>> Translation<DVec<N>> for DVec<N>
{ *self = *self + *t; }
}
impl<N: Add<N, N> + Copy> Translatable<DVec<N>, DVec<N>> for DVec<N>
impl<N: Add<N, N> + Neg<N> + Copy> Translatable<DVec<N>, DVec<N>> for DVec<N>
{
#[inline]
fn translated(&self, t: &DVec<N>) -> DVec<N>
{ self + *t }
}
impl<N: Copy + DivisionRing + Algebraic + Clone>
impl<N: Copy + DivisionRing + Algebraic>
Norm<N> for DVec<N>
{
#[inline]
@ -259,7 +259,7 @@ Norm<N> for DVec<N>
#[inline]
fn normalized(&self) -> DVec<N>
{
let mut res : DVec<N> = self.clone();
let mut res : DVec<N> = copy *self;
res.normalize();

View File

@ -309,7 +309,7 @@ macro_rules! translation_impl(
macro_rules! translatable_impl(
($t: ident) => (
impl<N: Add<N, N> + Copy> Translatable<$t<N>, $t<N>> for $t<N>
impl<N: Add<N, N> + Neg<N> + Copy> Translatable<$t<N>, $t<N>> for $t<N>
{
#[inline]
fn translated(&self, t: &$t<N>) -> $t<N>