Improve how the dummy parameter are passed to the Dim::dim function.

This commit is contained in:
Sébastien Crozet 2013-08-30 09:53:17 +02:00
parent 82ddda154f
commit 346a803b7f
3 changed files with 6 additions and 12 deletions

View File

@ -209,8 +209,7 @@ Rand for Rotmat<Mat3<N>> {
impl<M: Dim> Dim for Rotmat<M> { impl<M: Dim> Dim for Rotmat<M> {
#[inline] #[inline]
fn dim(_: Option<Rotmat<M>>) -> uint { fn dim(_: Option<Rotmat<M>>) -> uint {
let _dim: Option<M> = None; Dim::dim(None::<M>)
Dim::dim(_dim)
} }
} }

View File

@ -86,8 +86,7 @@ impl<N: Clone + Num + Algebraic> Transform<Rotmat<Mat3<N>>, Vec3<N>> {
impl<M: Dim, V> Dim for Transform<M, V> { impl<M: Dim, V> Dim for Transform<M, V> {
#[inline] #[inline]
fn dim(_: Option<Transform<M, V>>) -> uint { fn dim(_: Option<Transform<M, V>>) -> uint {
let _dim: Option<M> = None; Dim::dim(None::<M>)
Dim::dim(_dim)
} }
} }
@ -285,8 +284,7 @@ ToHomogeneous<M2> for Transform<M, V> {
let mut res = self.submat.to_homogeneous(); let mut res = self.submat.to_homogeneous();
// copy the translation // copy the translation
let _dim: Option<M2> = None; let dim = Dim::dim(None::<M2>);
let dim = Dim::dim(_dim);
res.set_column(dim - 1, self.subtrans.to_homogeneous()); res.set_column(dim - 1, self.subtrans.to_homogeneous());
@ -297,8 +295,7 @@ ToHomogeneous<M2> for Transform<M, V> {
impl<M: Column<V> + Dim, M2: FromHomogeneous<M>, V> impl<M: Column<V> + Dim, M2: FromHomogeneous<M>, V>
FromHomogeneous<M> for Transform<M2, V> { FromHomogeneous<M> for Transform<M2, V> {
fn from(m: &M) -> Transform<M2, V> { fn from(m: &M) -> Transform<M2, V> {
let _dim: Option<M> = None; Transform::new(FromHomogeneous::from(m), m.column(Dim::dim(None::<M>) - 1))
Transform::new(FromHomogeneous::from(m), m.column(Dim::dim(_dim) - 1))
} }
} }

View File

@ -502,10 +502,8 @@ macro_rules! outer_impl(
fn outer(&self, other: &$t<N>) -> $m<N> { fn outer(&self, other: &$t<N>) -> $m<N> {
let mut res: $m<N> = Zero::zero(); let mut res: $m<N> = Zero::zero();
let _dim: Option<$t<N>> = None; for i in range(0u, Dim::dim(None::<$t<N>>)) {
for i in range(0u, Dim::dim(_dim)) { for j in range(0u, Dim::dim(None::<$t<N>>)) {
let _dim: Option<$t<N>> = None;
for j in range(0u, Dim::dim(_dim)) {
res.set((i, j), self.at(i) * other.at(j)) res.set((i, j), self.at(i) * other.at(j))
} }
} }