Changed flattening function names.
This commit is contained in:
parent
4c65f793e8
commit
53486fe614
|
@ -115,9 +115,9 @@ impl<N: Copy> Flatten<N> for Mat1<N>
|
|||
fn from_flattened(l: &[N], off: uint) -> Mat1<N>
|
||||
{ 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 }
|
||||
}
|
||||
|
|
|
@ -179,9 +179,9 @@ impl<N: Copy> Flatten<N> for Vec1<N>
|
|||
fn from_flattened(l: &[N], off: uint) -> Vec1<N>
|
||||
{ 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 }
|
||||
}
|
||||
|
|
|
@ -168,10 +168,10 @@ impl<N: Copy> Flatten<N> for Mat2<N>
|
|||
fn from_flattened(l: &[N], off: uint) -> Mat2<N>
|
||||
{ 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;
|
||||
|
|
|
@ -213,10 +213,10 @@ impl<N: Copy> Flatten<N> for Vec2<N>
|
|||
fn from_flattened(l: &[N], off: uint) -> Vec2<N>
|
||||
{ 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;
|
||||
|
|
|
@ -224,7 +224,7 @@ impl<N: Copy> Flatten<N> for Mat3<N>
|
|||
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<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 + 1] = self.m12;
|
||||
|
|
|
@ -242,10 +242,10 @@ impl<N: Copy> Flatten<N> for Vec3<N>
|
|||
fn from_flattened(l: &[N], off: uint) -> Vec3<N>
|
||||
{ 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;
|
||||
|
|
|
@ -186,7 +186,7 @@ impl<D: Dim, N: Zero + Copy> Flatten<N> for NMat<D, N>
|
|||
res
|
||||
}
|
||||
|
||||
fn to_flattened(&self) -> ~[N]
|
||||
fn flatten(&self) -> ~[N]
|
||||
{
|
||||
let dim = Dim::dim::<D>();
|
||||
let mut res = ~[];
|
||||
|
@ -197,7 +197,7 @@ impl<D: Dim, N: Zero + Copy> Flatten<N> for NMat<D, N>
|
|||
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>();
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ impl<D: Dim, N: Zero + Copy> Flatten<N> for NVec<D, N>
|
|||
res
|
||||
}
|
||||
|
||||
fn to_flattened(&self) -> ~[N]
|
||||
fn flatten(&self) -> ~[N]
|
||||
{
|
||||
let dim = Dim::dim::<D>();
|
||||
let mut res = ~[];
|
||||
|
@ -225,7 +225,7 @@ impl<D: Dim, N: Zero + Copy> Flatten<N> for NVec<D, N>
|
|||
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>();
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ pub trait Flatten<N>
|
|||
* 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<N>
|
|||
* - `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…)?
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue