Struct array3d::Array3d
[−]
[src]
pub struct Array3d<T> { pub shape: V3i, pub data: Vec<T>, }
Fields
shape: V3i
data: Vec<T>
Methods
impl<T: Clone> Array3d<T>
[src]
fn from_fn<F: Fn(V3i) -> T>(s: V3i, f: F) -> Array3d<T>
[src]
fn from_fn_doubled<F: Fn(V3i) -> (T, T)>(sz: V3i, axis: i32, f: F) -> Array3d<T>
[src]
production from a function with expansion, todo - make this more general e.g.'production in blocks' the motivation is to share state across the production of a block of adjacent cells
fn fill_val(size: V3i, val: T) -> Array3d<T>
[src]
fn len(&self) -> usize
[src]
fn linear_index(&self, pos: V3i) -> usize
[src]
fn size(&self) -> V3i
[src]
fn map_xyz<B: Clone, F: Fn(V3i, &T) -> B>(&self, f: F) -> Array3d<B>
[src]
produce a new array3d by applying a function to every element
fn map_strided_region<B: Clone, F: Fn(V3i, &T) -> B>(
&self,
range: Range<V3i>,
stride: V3i,
f: F
) -> Array3d<B>
[src]
&self,
range: Range<V3i>,
stride: V3i,
f: F
) -> Array3d<B>
fn for_each<F: Fn(V3i, &mut T)>(&mut self, f: F)
[src]
internal iteration with inplace mutation
fn map_xy<F, B>(&self, a_func: F) -> Array2d<B> where
F: Fn(&Self, i32, i32) -> B,
B: Clone,
[src]
F: Fn(&Self, i32, i32) -> B,
B: Clone,
fn map_xz<F, B>(&self, a_func: F) -> Array2d<B> where
F: Fn(&Self, i32, i32) -> B,
B: Clone,
[src]
F: Fn(&Self, i32, i32) -> B,
B: Clone,
fn map_yz<F, B>(&self, a_func: F) -> Array2d<B> where
F: Fn(&Self, i32, i32) -> B,
B: Clone,
[src]
F: Fn(&Self, i32, i32) -> B,
B: Clone,
fn reshape(&mut self, s: V3i)
[src]
fn fold_z<B, F>(&self, init_val: B, f: F) -> Array2d<B> where
B: Clone,
F: Fn(V3i, B, &T) -> B,
[src]
B: Clone,
F: Fn(V3i, B, &T) -> B,
fn fold_x<B: Clone, F: Fn(V3i, B, &T) -> B>(&self, input: B, f: F) -> Array2d<B>
[src]
produce a 2d array by folding along the X axis
fn fold_xyz<A, B, C, FOLDX, FOLDY, FOLDZ>(
&self,
(input_x, fx): (A, FOLDX),
(input_y, fy): (B, FOLDY),
(input_z, fz): (C, FOLDZ)
) -> A where
A: Clone,
B: Clone,
C: Clone,
FOLDZ: Fn(V3i, C, &T) -> C,
FOLDY: Fn(i32, i32, B, &C) -> B,
FOLDX: Fn(i32, A, &B) -> A,
[src]
&self,
(input_x, fx): (A, FOLDX),
(input_y, fy): (B, FOLDY),
(input_z, fz): (C, FOLDZ)
) -> A where
A: Clone,
B: Clone,
C: Clone,
FOLDZ: Fn(V3i, C, &T) -> C,
FOLDY: Fn(i32, i32, B, &C) -> B,
FOLDX: Fn(i32, A, &B) -> A,
fold values along x,y,z in turn without intermediate storage
fn fold_zyx<A, B, C, FOLDX, FOLDY, FOLDZ>(
&self,
(input_x, fx): (A, FOLDX),
(input_y, fy): (B, FOLDY),
(input_z, fz): (C, FOLDZ)
) -> C where
A: Clone,
B: Clone,
C: Clone,
FOLDZ: Fn(i32, C, &B) -> C,
FOLDY: Fn(i32, i32, B, &A) -> B,
FOLDX: Fn(V3i, A, &T) -> A,
[src]
&self,
(input_x, fx): (A, FOLDX),
(input_y, fy): (B, FOLDY),
(input_z, fz): (C, FOLDZ)
) -> C where
A: Clone,
B: Clone,
C: Clone,
FOLDZ: Fn(i32, C, &B) -> C,
FOLDY: Fn(i32, i32, B, &A) -> B,
FOLDX: Fn(V3i, A, &T) -> A,
fold values along z,y,x in turn without intermediate storage
fn fold<B, F>(&self, input: B, f: F) -> B where
F: Fn(V3i, B, &T) -> B,
B: Clone,
[src]
F: Fn(V3i, B, &T) -> B,
B: Clone,
fold the whole array to produce a single value
fn fold_tiles<B, F>(&self, tilesize: V3i, input: B, f: &F) -> Array3d<B> where
F: Fn(V3i, B, &T) -> B,
B: Clone,
[src]
F: Fn(V3i, B, &T) -> B,
B: Clone,
produce tiles by applying a function to every subtile output size is divided by tilesize must be exact multiple.
fn fold_region<B, F>(&self, r: Range<V3i>, input: B, f: &F) -> B where
F: Fn(V3i, B, &T) -> B,
B: Clone,
[src]
F: Fn(V3i, B, &T) -> B,
B: Clone,
subroutine for 'fold tiles', see context closure is borrowed for multiple invocation by caller
fn get_indexed(&self, pos: V3i) -> (V3i, &T)
[src]
fn region_all(&self) -> Range<V3i>
[src]
fn map_region_strided<F, B>(
&self,
region: Range<V3i>,
stride: V3i,
f: F
) -> Array3d<B> where
F: Fn(V3i, &T) -> B,
B: Clone,
[src]
&self,
region: Range<V3i>,
stride: V3i,
f: F
) -> Array3d<B> where
F: Fn(V3i, &T) -> B,
B: Clone,
fn map_strided<F, B>(&self, stride: V3i, f: F) -> Array3d<B> where
F: Fn(V3i, &T) -> B,
B: Clone,
[src]
F: Fn(V3i, &T) -> B,
B: Clone,
fn map_region<F, B>(&self, region: Range<V3i>, f: F) -> Array3d<B> where
F: Fn(V3i, &T) -> B,
B: Clone,
[src]
F: Fn(V3i, &T) -> B,
B: Clone,
fn convolute_neighbours<F, B>(&self, f: F) -> Array3d<B> where
F: Fn(&T, Vec3<Neighbours<&T>>) -> B,
B: Clone,
[src]
F: Fn(&T, Vec3<Neighbours<&T>>) -> B,
B: Clone,
X form of convolution
XOX passing each cell and it's
X immiediate neighbours on each axis
fn index_wrap(&self, pos: V3i) -> &T
[src]
fn get_wrap(&self, pos: V3i) -> &T
[src]
fn get_ofs_wrap(&self, pos: V3i, dx: i32, dy: i32, dz: i32) -> &T
[src]
fn convolute_neighbours_wrap<F, B>(&self, f: F) -> Array3d<B> where
F: Fn(&T, Vec3<Neighbours<&T>>) -> B,
B: Clone,
[src]
F: Fn(&T, Vec3<Neighbours<&T>>) -> B,
B: Clone,
fn convolute_2x2x2_wrap<F, B>(&self, f: F) -> Array3d<B> where
F: Fn(V3i, [[[&T; 2]; 2]; 2]) -> B,
B: Clone,
[src]
F: Fn(V3i, [[[&T; 2]; 2]; 2]) -> B,
B: Clone,
special case of convolution for 2x2 cells, e.g. for marching cubes
fn fold_half<F, B>(&self, fold_fn: F) -> Array3d<B> where
F: Fn(V3i, [[[&T; 2]; 2]; 2]) -> B,
B: Clone,
[src]
F: Fn(V3i, [[[&T; 2]; 2]; 2]) -> B,
B: Clone,
take 2x2x2 blocks, fold to produce new values
Trait Implementations
impl<T: Clone> Index<V3i> for Array3d<T>
[src]
type Output = T
The returned type after indexing.
fn index(&self, pos: V3i) -> &T
[src]
Performs the indexing (container[index]
) operation.