Fixes to work with the new compiler.
This commit is contained in:
parent
3bb470ac95
commit
8e8a87b667
|
@ -101,11 +101,11 @@ impl<M: Translate<V>, V, _0> Translate<V> for Transform<M, _0>
|
||||||
{ self.submat.inv_translate(v) }
|
{ self.submat.inv_translate(v) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<M: Copy, V: Translatable<V, Res>, Res: Translation<V>>
|
impl<M: Copy, V: Translatable<V, V> + Translation<V>>
|
||||||
Translatable<V, Transform<M, Res>> for Transform<M, V>
|
Translatable<V, Transform<M, V>> for Transform<M, V>
|
||||||
{
|
{
|
||||||
#[inline]
|
#[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)) }
|
{ 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,
|
impl<M: Rotatable<AV, Res> + One,
|
||||||
Res: Rotation<AV> + RMul<V>,
|
Res: Rotation<AV> + RMul<V> + One,
|
||||||
V,
|
V,
|
||||||
AV>
|
AV>
|
||||||
Rotatable<AV, Transform<Res, V>> for Transform<M, V>
|
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.
|
// FIXME: constraints are too restrictive.
|
||||||
// Should be: Transformable<M2, // Transform<Res, V> ...
|
// 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>
|
Transformable<Transform<M, V>, Transform<M, V>> for Transform<M, V>
|
||||||
{
|
{
|
||||||
fn transformed(&self, t: &Transform<M, V>) -> Transform<M, V>
|
fn transformed(&self, t: &Transform<M, V>) -> Transform<M, V>
|
||||||
|
|
16
src/dvec.rs
16
src/dvec.rs
|
@ -13,7 +13,7 @@ use traits::norm::Norm;
|
||||||
use traits::translation::{Translation, Translatable};
|
use traits::translation::{Translation, Translatable};
|
||||||
use traits::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
|
use traits::scalar_op::{ScalarMul, ScalarDiv, ScalarAdd, ScalarSub};
|
||||||
|
|
||||||
#[deriving(Eq, Ord, ToStr, Clone)]
|
#[deriving(Eq, Ord, ToStr)]
|
||||||
pub struct DVec<N>
|
pub struct DVec<N>
|
||||||
{
|
{
|
||||||
at: ~[N]
|
at: ~[N]
|
||||||
|
@ -53,7 +53,7 @@ impl<N, Iter: Iterator<N>> FromIterator<N, Iter> for DVec<N>
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: is Clone needed?
|
// 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>]
|
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
|
if res.len() == dim - 1
|
||||||
{ break; }
|
{ break; }
|
||||||
|
|
||||||
let mut elt = basis_element.clone();
|
let mut elt = copy basis_element;
|
||||||
|
|
||||||
elt = elt - self.scalar_mul(&basis_element.dot(self));
|
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]
|
#[inline]
|
||||||
fn translation(&self) -> DVec<N>
|
fn translation(&self) -> DVec<N>
|
||||||
{ self.clone() }
|
{ copy *self }
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn inv_translation(&self) -> DVec<N>
|
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; }
|
{ *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]
|
#[inline]
|
||||||
fn translated(&self, t: &DVec<N>) -> DVec<N>
|
fn translated(&self, t: &DVec<N>) -> DVec<N>
|
||||||
{ self + *t }
|
{ self + *t }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<N: Copy + DivisionRing + Algebraic + Clone>
|
impl<N: Copy + DivisionRing + Algebraic>
|
||||||
Norm<N> for DVec<N>
|
Norm<N> for DVec<N>
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -259,7 +259,7 @@ Norm<N> for DVec<N>
|
||||||
#[inline]
|
#[inline]
|
||||||
fn normalized(&self) -> DVec<N>
|
fn normalized(&self) -> DVec<N>
|
||||||
{
|
{
|
||||||
let mut res : DVec<N> = self.clone();
|
let mut res : DVec<N> = copy *self;
|
||||||
|
|
||||||
res.normalize();
|
res.normalize();
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ macro_rules! translation_impl(
|
||||||
|
|
||||||
macro_rules! translatable_impl(
|
macro_rules! translatable_impl(
|
||||||
($t: ident) => (
|
($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]
|
#[inline]
|
||||||
fn translated(&self, t: &$t<N>) -> $t<N>
|
fn translated(&self, t: &$t<N>) -> $t<N>
|
||||||
|
|
Loading…
Reference in New Issue