Changed flattening function names.

This commit is contained in:
Sébastien Crozet 2013-06-10 09:46:42 +02:00
parent 4c65f793e8
commit 53486fe614
9 changed files with 18 additions and 18 deletions

View File

@ -115,9 +115,9 @@ impl<N: Copy> Flatten<N> for Mat1<N>
fn from_flattened(l: &[N], off: uint) -> Mat1<N> fn from_flattened(l: &[N], off: uint) -> Mat1<N>
{ Mat1::new(l[off]) } { Mat1::new(l[off]) }
fn to_flattened(&self) -> ~[N] fn flatten(&self) -> ~[N]
{ ~[ self.m11 ] } { ~[ 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 } { l[off] = self.m11 }
} }

View File

@ -179,9 +179,9 @@ impl<N: Copy> Flatten<N> for Vec1<N>
fn from_flattened(l: &[N], off: uint) -> Vec1<N> fn from_flattened(l: &[N], off: uint) -> Vec1<N>
{ Vec1::new(l[off]) } { Vec1::new(l[off]) }
fn to_flattened(&self) -> ~[N] fn flatten(&self) -> ~[N]
{ ~[ self.x ] } { ~[ 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 } { l[off] = self.x }
} }

View File

@ -168,10 +168,10 @@ impl<N: Copy> Flatten<N> for Mat2<N>
fn from_flattened(l: &[N], off: uint) -> Mat2<N> fn from_flattened(l: &[N], off: uint) -> Mat2<N>
{ Mat2::new(l[off], l[off + 1], l[off + 2], l[off + 3]) } { 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 ] } { ~[ 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] = self.m11;
l[off + 1] = self.m12; l[off + 1] = self.m12;

View File

@ -213,10 +213,10 @@ impl<N: Copy> Flatten<N> for Vec2<N>
fn from_flattened(l: &[N], off: uint) -> Vec2<N> fn from_flattened(l: &[N], off: uint) -> Vec2<N>
{ Vec2::new(l[off], l[off + 1]) } { Vec2::new(l[off], l[off + 1]) }
fn to_flattened(&self) -> ~[N] fn flatten(&self) -> ~[N]
{ ~[ self.x, self.y ] } { ~[ 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] = self.x;
l[off + 1] = self.y; l[off + 1] = self.y;

View File

@ -224,7 +224,7 @@ impl<N: Copy> Flatten<N> for Mat3<N>
l[off + 3], l[off + 4], l[off + 5], l[off + 3], l[off + 4], l[off + 5],
l[off + 6], l[off + 7], l[off + 8]) } l[off + 6], l[off + 7], l[off + 8]) }
fn to_flattened(&self) -> ~[N] fn flatten(&self) -> ~[N]
{ {
~[ ~[
self.m11, self.m12, self.m13, self.m11, self.m12, self.m13,
@ -233,7 +233,7 @@ impl<N: Copy> Flatten<N> for Mat3<N>
] ]
} }
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 + 0] = self.m11;
l[off + 1] = self.m12; l[off + 1] = self.m12;

View File

@ -242,10 +242,10 @@ impl<N: Copy> Flatten<N> for Vec3<N>
fn from_flattened(l: &[N], off: uint) -> Vec3<N> fn from_flattened(l: &[N], off: uint) -> Vec3<N>
{ Vec3::new(l[off], l[off + 1], l[off + 2]) } { 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 ] } { ~[ 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] = self.x;
l[off + 1] = self.y; l[off + 1] = self.y;

View File

@ -186,7 +186,7 @@ impl<D: Dim, N: Zero + Copy> Flatten<N> for NMat<D, N>
res res
} }
fn to_flattened(&self) -> ~[N] fn flatten(&self) -> ~[N]
{ {
let dim = Dim::dim::<D>(); let dim = Dim::dim::<D>();
let mut res = ~[]; let mut res = ~[];
@ -197,7 +197,7 @@ impl<D: Dim, N: Zero + Copy> Flatten<N> for NMat<D, N>
res res
} }
fn to_flattened_inplace(&self, l: &mut [N], off: uint) fn flatten_to(&self, l: &mut [N], off: uint)
{ {
let dim = Dim::dim::<D>(); let dim = Dim::dim::<D>();

View File

@ -214,7 +214,7 @@ impl<D: Dim, N: Zero + Copy> Flatten<N> for NVec<D, N>
res res
} }
fn to_flattened(&self) -> ~[N] fn flatten(&self) -> ~[N]
{ {
let dim = Dim::dim::<D>(); let dim = Dim::dim::<D>();
let mut res = ~[]; let mut res = ~[];
@ -225,7 +225,7 @@ impl<D: Dim, N: Zero + Copy> Flatten<N> for NVec<D, N>
res res
} }
fn to_flattened_inplace(&self, l: &mut [N], off: uint) fn flatten_to(&self, l: &mut [N], off: uint)
{ {
let dim = Dim::dim::<D>(); let dim = Dim::dim::<D>();

View File

@ -20,7 +20,7 @@ pub trait Flatten<N>
* Creates a flattened version of `self`. The result vector must be of size * Creates a flattened version of `self`. The result vector must be of size
* `flat_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 * Creates a flattened version of `self` on a vector. It is assumed that
@ -30,5 +30,5 @@ pub trait Flatten<N>
* - `off`: index from which (included) the flat version write must begin. * - `off`: index from which (included) the flat version write must begin.
* It is assumed that the caller allocated a long enough list. * 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…)?
} }