diff --git a/src/structs/iso_macros.rs b/src/structs/iso_macros.rs index 50d83de4..f3380019 100644 --- a/src/structs/iso_macros.rs +++ b/src/structs/iso_macros.rs @@ -318,13 +318,13 @@ macro_rules! inv_impl( macro_rules! to_homogeneous_impl( ($t: ident, $th: ident) => ( impl ToHomogeneous<$th> for $t { - fn to_homogeneous(m: &$t) -> $th { - let mut res = ToHomogeneous::to_homogeneous(&m.rotation); + fn to_homogeneous(&self) -> $th { + let mut res = self.rotation.to_homogeneous(); // copy the translation let dim = Dim::dim(None::<$th>); - res.set_col(dim - 1, ToHomogeneous::to_homogeneous(m.translation.as_pnt()).to_vec()); + res.set_col(dim - 1, self.translation.as_pnt().to_homogeneous().to_vec()); res } diff --git a/src/structs/mat_macros.rs b/src/structs/mat_macros.rs index 27e82c44..bc236065 100644 --- a/src/structs/mat_macros.rs +++ b/src/structs/mat_macros.rs @@ -645,12 +645,12 @@ macro_rules! to_homogeneous_impl( ($t: ident, $t2: ident, $dim: expr, $dim2: expr) => ( impl ToHomogeneous<$t2> for $t { #[inline] - fn to_homogeneous(m: &$t) -> $t2 { + fn to_homogeneous(&self) -> $t2 { let mut res: $t2 = ::one(); for i in range(0u, $dim) { for j in range(0u, $dim) { - res.set((i, j), m.at((i, j))) + res.set((i, j), self.at((i, j))) } } diff --git a/src/structs/pnt_macros.rs b/src/structs/pnt_macros.rs index fc10fce3..83e2c320 100644 --- a/src/structs/pnt_macros.rs +++ b/src/structs/pnt_macros.rs @@ -101,11 +101,11 @@ macro_rules! pnt_as_vec_impl( macro_rules! pnt_to_homogeneous_impl( ($t: ident, $t2: ident, $extra: ident, $comp0: ident $(,$compN: ident)*) => ( impl ToHomogeneous<$t2> for $t { - fn to_homogeneous(v: &$t) -> $t2 { + fn to_homogeneous(&self) -> $t2 { let mut res: $t2 = Orig::orig(); - res.$comp0 = v.$comp0.clone(); - $( res.$compN = v.$compN.clone(); )* + res.$comp0 = self.$comp0.clone(); + $( res.$compN = self.$compN.clone(); )* res.$extra = ::one(); res diff --git a/src/structs/rot_macros.rs b/src/structs/rot_macros.rs index 82a105fd..fbee6c14 100644 --- a/src/structs/rot_macros.rs +++ b/src/structs/rot_macros.rs @@ -283,8 +283,8 @@ macro_rules! to_homogeneous_impl( ($t: ident, $tm: ident) => ( impl ToHomogeneous<$tm> for $t { #[inline] - fn to_homogeneous(m: &$t) -> $tm { - ToHomogeneous::to_homogeneous(&m.submat) + fn to_homogeneous(&self) -> $tm { + self.submat.to_homogeneous() } } ) diff --git a/src/structs/vec_macros.rs b/src/structs/vec_macros.rs index 4fb3f9ff..7785933f 100644 --- a/src/structs/vec_macros.rs +++ b/src/structs/vec_macros.rs @@ -696,11 +696,11 @@ macro_rules! bounded_impl( macro_rules! vec_to_homogeneous_impl( ($t: ident, $t2: ident, $extra: ident, $comp0: ident $(,$compN: ident)*) => ( impl ToHomogeneous<$t2> for $t { - fn to_homogeneous(v: &$t) -> $t2 { + fn to_homogeneous(&self) -> $t2 { let mut res: $t2 = ::zero(); - res.$comp0 = v.$comp0.clone(); - $( res.$compN = v.$compN.clone(); )* + res.$comp0 = self.$comp0.clone(); + $( res.$compN = self.$compN.clone(); )* res } diff --git a/src/traits/geometry.rs b/src/traits/geometry.rs index 8a229a18..dca03b36 100644 --- a/src/traits/geometry.rs +++ b/src/traits/geometry.rs @@ -244,7 +244,7 @@ pub trait CrossMatrix { /// Traits of objects which can be put in homogeneous coordinates form. pub trait ToHomogeneous { /// Gets the homogeneous coordinates form of this object. - fn to_homogeneous(&Self) -> U; + fn to_homogeneous(&self) -> U; } /// Traits of objects which can be build from an homogeneous coordinate form.