diff --git a/src/dim1/mat1.rs b/src/dim1/mat1.rs index ec6cd4ff..2e7024d8 100644 --- a/src/dim1/mat1.rs +++ b/src/dim1/mat1.rs @@ -115,9 +115,9 @@ impl Flatten for Mat1 fn from_flattened(l: &[N], off: uint) -> Mat1 { Mat1::new(l[off]) } - fn to_flattened(&self) -> ~[N] + fn flatten(&self) -> ~[N] { ~[ self.m11 ] } - fn to_flattened_inplace(&self, l: &mut [N], off: uint) + fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = self.m11 } } diff --git a/src/dim1/vec1.rs b/src/dim1/vec1.rs index cf484fb1..76513fa1 100644 --- a/src/dim1/vec1.rs +++ b/src/dim1/vec1.rs @@ -179,9 +179,9 @@ impl Flatten for Vec1 fn from_flattened(l: &[N], off: uint) -> Vec1 { Vec1::new(l[off]) } - fn to_flattened(&self) -> ~[N] + fn flatten(&self) -> ~[N] { ~[ self.x ] } - fn to_flattened_inplace(&self, l: &mut [N], off: uint) + fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = self.x } } diff --git a/src/dim2/mat2.rs b/src/dim2/mat2.rs index f60acaad..f7b934cf 100644 --- a/src/dim2/mat2.rs +++ b/src/dim2/mat2.rs @@ -168,10 +168,10 @@ impl Flatten for Mat2 fn from_flattened(l: &[N], off: uint) -> Mat2 { Mat2::new(l[off], l[off + 1], l[off + 2], l[off + 3]) } - fn to_flattened(&self) -> ~[N] + fn flatten(&self) -> ~[N] { ~[ self.m11, self.m12, self.m21, self.m22 ] } - fn to_flattened_inplace(&self, l: &mut [N], off: uint) + fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = self.m11; l[off + 1] = self.m12; diff --git a/src/dim2/vec2.rs b/src/dim2/vec2.rs index 8c3bfce4..a49f1705 100644 --- a/src/dim2/vec2.rs +++ b/src/dim2/vec2.rs @@ -213,10 +213,10 @@ impl Flatten for Vec2 fn from_flattened(l: &[N], off: uint) -> Vec2 { Vec2::new(l[off], l[off + 1]) } - fn to_flattened(&self) -> ~[N] + fn flatten(&self) -> ~[N] { ~[ self.x, self.y ] } - fn to_flattened_inplace(&self, l: &mut [N], off: uint) + fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = self.x; l[off + 1] = self.y; diff --git a/src/dim3/mat3.rs b/src/dim3/mat3.rs index 6466114b..27d6c966 100644 --- a/src/dim3/mat3.rs +++ b/src/dim3/mat3.rs @@ -224,7 +224,7 @@ impl Flatten for Mat3 l[off + 3], l[off + 4], l[off + 5], l[off + 6], l[off + 7], l[off + 8]) } - fn to_flattened(&self) -> ~[N] + fn flatten(&self) -> ~[N] { ~[ self.m11, self.m12, self.m13, @@ -233,7 +233,7 @@ impl Flatten for Mat3 ] } - fn to_flattened_inplace(&self, l: &mut [N], off: uint) + fn flatten_to(&self, l: &mut [N], off: uint) { l[off + 0] = self.m11; l[off + 1] = self.m12; diff --git a/src/dim3/vec3.rs b/src/dim3/vec3.rs index d4eb4f4c..500de8df 100644 --- a/src/dim3/vec3.rs +++ b/src/dim3/vec3.rs @@ -242,10 +242,10 @@ impl Flatten for Vec3 fn from_flattened(l: &[N], off: uint) -> Vec3 { Vec3::new(l[off], l[off + 1], l[off + 2]) } - fn to_flattened(&self) -> ~[N] + fn flatten(&self) -> ~[N] { ~[ self.x, self.y, self.z ] } - fn to_flattened_inplace(&self, l: &mut [N], off: uint) + fn flatten_to(&self, l: &mut [N], off: uint) { l[off] = self.x; l[off + 1] = self.y; diff --git a/src/ndim/nmat.rs b/src/ndim/nmat.rs index 555c633d..36c31476 100644 --- a/src/ndim/nmat.rs +++ b/src/ndim/nmat.rs @@ -186,7 +186,7 @@ impl Flatten for NMat res } - fn to_flattened(&self) -> ~[N] + fn flatten(&self) -> ~[N] { let dim = Dim::dim::(); let mut res = ~[]; @@ -197,7 +197,7 @@ impl Flatten for NMat res } - fn to_flattened_inplace(&self, l: &mut [N], off: uint) + fn flatten_to(&self, l: &mut [N], off: uint) { let dim = Dim::dim::(); diff --git a/src/ndim/nvec.rs b/src/ndim/nvec.rs index 52204212..c9c656e4 100644 --- a/src/ndim/nvec.rs +++ b/src/ndim/nvec.rs @@ -214,7 +214,7 @@ impl Flatten for NVec res } - fn to_flattened(&self) -> ~[N] + fn flatten(&self) -> ~[N] { let dim = Dim::dim::(); let mut res = ~[]; @@ -225,7 +225,7 @@ impl Flatten for NVec res } - fn to_flattened_inplace(&self, l: &mut [N], off: uint) + fn flatten_to(&self, l: &mut [N], off: uint) { let dim = Dim::dim::(); diff --git a/src/traits/flatten.rs b/src/traits/flatten.rs index 21b30340..b0d78fba 100644 --- a/src/traits/flatten.rs +++ b/src/traits/flatten.rs @@ -20,7 +20,7 @@ pub trait Flatten * Creates a flattened version of `self`. The result vector must be of size * `flat_size`. */ - fn to_flattened(&self) -> ~[N]; + fn flatten(&self) -> ~[N]; /** * Creates a flattened version of `self` on a vector. It is assumed that @@ -30,5 +30,5 @@ pub trait Flatten * - `off`: index from which (included) the flat version write must begin. * It is assumed that the caller allocated a long enough list. */ - fn to_flattened_inplace(&self, l: &mut [N], off: uint); // FIXME: keep (vector + index) or use an iterator (to a mutable value…)? + fn flatten_to(&self, l: &mut [N], off: uint); // FIXME: keep (vector + index) or use an iterator (to a mutable value…)? }