Indentation fixes.

This commit is contained in:
Sébastien Crozet 2013-08-05 09:44:56 +02:00
parent 53a5dbb6e3
commit a810bf6008
29 changed files with 1726 additions and 1792 deletions

View File

@ -168,9 +168,7 @@ Translatable<V, Transform<M, V>> for Transform<M, V>
{ Transform::new(self.submat.clone(), self.subtrans.translated(t)) }
}
impl<M: Rotation<AV> + RMul<V> + One,
V,
AV>
impl<M: Rotation<AV> + RMul<V> + One, V, AV>
Rotation<AV> for Transform<M, V>
{
#[inline]
@ -204,10 +202,7 @@ impl<M: Rotate<V>, V, _0> Rotate<V> for Transform<M, _0>
{ self.submat.inv_rotate(v) }
}
impl<M: Rotatable<AV, Res> + One,
Res: Rotation<AV> + RMul<V> + One,
V,
AV>
impl<M: Rotatable<AV, Res> + One, Res: Rotation<AV> + RMul<V> + One, V, AV>
Rotatable<AV, Transform<Res, V>> for Transform<M, V>
{
#[inline]

View File

@ -61,8 +61,8 @@ impl<N, Iter: Iterator<N>> FromIterator<N, Iter> for DVec<N>
impl<N: Clone + DivisionRing + Algebraic + ApproxEq<N>> DVec<N>
{
/// Computes the canonical basis for the given dimension. A canonical basis is a set of
/// vectors, mutually orthogonal, with all its component equal to 0.0 exept one which is equal to
/// 1.0.
/// vectors, mutually orthogonal, with all its component equal to 0.0 exept one which is equal
/// to 1.0.
pub fn canonical_basis_with_dim(dim: uint) -> ~[DVec<N>]
{
let mut res : ~[DVec<N>] = ~[];
@ -145,8 +145,7 @@ impl<N: Neg<N>> Neg<DVec<N>> for DVec<N>
{ DVec { at: self.at.iter().transform(|a| -a).collect() } }
}
impl<N: Ring>
Dot<N> for DVec<N>
impl<N: Ring> Dot<N> for DVec<N>
{
#[inline]
fn dot(&self, other: &DVec<N>) -> N
@ -176,8 +175,7 @@ impl<N: Ring> SubDot<N> for DVec<N>
}
}
impl<N: Mul<N, N>>
ScalarMul<N> for DVec<N>
impl<N: Mul<N, N>> ScalarMul<N> for DVec<N>
{
#[inline]
fn scalar_mul(&self, s: &N) -> DVec<N>
@ -192,8 +190,7 @@ ScalarMul<N> for DVec<N>
}
impl<N: Div<N, N>>
ScalarDiv<N> for DVec<N>
impl<N: Div<N, N>> ScalarDiv<N> for DVec<N>
{
#[inline]
fn scalar_div(&self, s: &N) -> DVec<N>
@ -207,8 +204,7 @@ ScalarDiv<N> for DVec<N>
}
}
impl<N: Add<N, N>>
ScalarAdd<N> for DVec<N>
impl<N: Add<N, N>> ScalarAdd<N> for DVec<N>
{
#[inline]
fn scalar_add(&self, s: &N) -> DVec<N>
@ -222,8 +218,7 @@ ScalarAdd<N> for DVec<N>
}
}
impl<N: Sub<N, N>>
ScalarSub<N> for DVec<N>
impl<N: Sub<N, N>> ScalarSub<N> for DVec<N>
{
#[inline]
fn scalar_sub(&self, s: &N) -> DVec<N>
@ -259,8 +254,7 @@ impl<N: Add<N, N> + Neg<N> + Clone> Translatable<DVec<N>, DVec<N>> for DVec<N>
{ self + *t }
}
impl<N: DivisionRing + Algebraic + Clone>
Norm<N> for DVec<N>
impl<N: DivisionRing + Algebraic + Clone> Norm<N> for DVec<N>
{
#[inline]
fn sqnorm(&self) -> N

View File

@ -131,8 +131,7 @@ macro_rules! column_impl(
macro_rules! mul_impl(
($t: ident, $dim: expr) => (
impl<N: Clone + Ring>
Mul<$t<N>, $t<N>> for $t<N>
impl<N: Clone + Ring> Mul<$t<N>, $t<N>> for $t<N>
{
fn mul(&self, other: &$t<N>) -> $t<N>
{
@ -159,8 +158,7 @@ macro_rules! mul_impl(
macro_rules! rmul_impl(
($t: ident, $v: ident, $dim: expr) => (
impl<N: Clone + Ring>
RMul<$v<N>> for $t<N>
impl<N: Clone + Ring> RMul<$v<N>> for $t<N>
{
fn rmul(&self, other: &$v<N>) -> $v<N>
{
@ -183,12 +181,10 @@ macro_rules! rmul_impl(
macro_rules! lmul_impl(
($t: ident, $v: ident, $dim: expr) => (
impl<N: Clone + Ring>
LMul<$v<N>> for $t<N>
impl<N: Clone + Ring> LMul<$v<N>> for $t<N>
{
fn lmul(&self, other: &$v<N>) -> $v<N>
{
let mut res : $v<N> = Zero::zero();
for i in range(0u, $dim)

View File

@ -5,62 +5,3 @@ pub trait Dim {
/// The dimension of the object.
fn dim() -> uint;
}
// Some dimension token. Useful to restrict the dimension of n-dimensional
// object at the type-level.
/// Dimensional token for 0-dimensions. Dimensional tokens are the preferred
/// way to specify at the type level the dimension of n-dimensional objects.
#[deriving(Eq, Ord, ToStr)]
pub struct D0;
/// Dimensional token for 1-dimension. Dimensional tokens are the preferred
/// way to specify at the type level the dimension of n-dimensional objects.
#[deriving(Eq, Ord, ToStr)]
pub struct D1;
/// Dimensional token for 2-dimensions. Dimensional tokens are the preferred
/// way to specify at the type level the dimension of n-dimensional objects.
#[deriving(Eq, Ord, ToStr)]
pub struct D2;
/// Dimensional token for 3-dimensions. Dimensional tokens are the preferred
/// way to specify at the type level the dimension of n-dimensional objects.
#[deriving(Eq, Ord, ToStr)]
pub struct D3;
/// Dimensional token for 4-dimensions. Dimensional tokens are the preferred
/// way to specify at the type level the dimension of n-dimensional objects.
#[deriving(Eq, Ord, ToStr)]
pub struct D4;
/// Dimensional token for 5-dimensions. Dimensional tokens are the preferred
/// way to specify at the type level the dimension of n-dimensional objects.
#[deriving(Eq, Ord, ToStr)]
pub struct D5;
/// Dimensional token for 6-dimensions. Dimensional tokens are the preferred
/// way to specify at the type level the dimension of n-dimensional objects.
#[deriving(Eq, Ord, ToStr)]
pub struct D6;
impl Dim for D0
{ fn dim() -> uint { 0 } }
impl Dim for D1
{ fn dim() -> uint { 1 } }
impl Dim for D2
{ fn dim() -> uint { 2 } }
impl Dim for D3
{ fn dim() -> uint { 3 } }
impl Dim for D4
{ fn dim() -> uint { 4 } }
impl Dim for D5
{ fn dim() -> uint { 5 } }
impl Dim for D6
{ fn dim() -> uint { 6 } }

View File

@ -18,15 +18,15 @@ pub trait IterableMut<N>
* FIXME: the prevous traits are only workarounds.
* It should be something like:
pub trait Iterable<'self, N, I: Iterator<N>>
{
pub trait Iterable<'self, N, I: Iterator<N>>
{
fn iter(&'self self) -> I;
}
}
pub trait IterableMut<'self, N, I: Iterator<N>>
{
pub trait IterableMut<'self, N, I: Iterator<N>>
{
fn mut_iter(&'self self) -> I;
}
}
* but this gives an ICE =(
* For now, we oblige the iterator to be one specific type which works with

View File

@ -46,8 +46,11 @@ pub trait Rotate<V>
pub fn rotated_wrt_point<M: Translatable<LV, M2>,
M2: Rotation<AV> + Translation<LV>,
LV: Neg<LV>,
AV>
(m: &M, ammount: &AV, center: &LV) -> M2
AV>(
m: &M,
ammount: &AV,
center: &LV)
-> M2
{
let mut res = m.translated(&-center);
@ -66,8 +69,10 @@ pub fn rotated_wrt_point<M: Translatable<LV, M2>,
#[inline]
pub fn rotate_wrt_point<M: Rotation<AV> + Translation<LV>,
LV: Neg<LV>,
AV>
(m: &mut M, ammount: &AV, center: &LV)
AV>(
m: &mut M,
ammount: &AV,
center: &LV)
{
m.translate_by(&-center);
m.rotate_by(ammount);
@ -85,8 +90,10 @@ pub fn rotate_wrt_point<M: Rotation<AV> + Translation<LV>,
pub fn rotated_wrt_center<M: Translatable<LV, M2> + Translation<LV>,
M2: Rotation<AV> + Translation<LV>,
LV: Neg<LV>,
AV>
(m: &M, ammount: &AV) -> M2
AV>(
m: &M,
ammount: &AV)
-> M2
{ rotated_wrt_point(m, ammount, &m.translation()) }
/**
@ -99,8 +106,9 @@ pub fn rotated_wrt_center<M: Translatable<LV, M2> + Translation<LV>,
#[inline]
pub fn rotate_wrt_center<M: Translatable<LV, M> + Translation<LV> + Rotation<AV>,
LV: Neg<LV>,
AV>
(m: &mut M, ammount: &AV)
AV>(
m: &mut M,
ammount: &AV)
{
let t = m.translation();

View File

@ -111,7 +111,6 @@ from_homogeneous_impl!(Vec2, Vec3, z, x, y)
/// Vector of dimension 3.
#[deriving(Eq, Encodable, Decodable, Clone, DeepClone, IterBytes, Rand, Zero, ToStr)]
pub struct Vec3<N>
{
/// First component of the vector.
x: N,

View File

@ -18,7 +18,8 @@ impl<N: Mul<N, N> + Sub<N, N>> Cross<Vec3<N>> for Vec3<N>
#[inline]
fn cross(&self, other : &Vec3<N>) -> Vec3<N>
{
Vec3::new(self.y * other.z - self.z * other.y,
Vec3::new(
self.y * other.z - self.z * other.y,
self.z * other.x - self.x * other.z,
self.x * other.y - self.y * other.x
)