[][src]Trait building_blocks_core::extent::IntegerExtent

pub trait IntegerExtent<N>: Extent<N> + Copy {
    type PointIter: Iterator<Item = PointN<N>>;
    fn num_points(&self) -> usize;
fn iter_points(&self) -> Self::PointIter; }

The methods that all ExtentN<N> should have when the scalar type is an integer, but only those which are implemented specially for each ExtentN<N>. This enables us to assume that any finite extent contains only a finite number of points.

Associated Types

type PointIter: Iterator<Item = PointN<N>>

Loading content...

Required methods

fn num_points(&self) -> usize

The number of points contained in the extent.

fn iter_points(&self) -> Self::PointIter

Iterate over all points in the extent.

let extent = Extent3i::from_min_and_shape(PointN([0, 0, 0]), PointN([2, 2, 1]));
let points = extent.iter_points().collect::<Vec<_>>();
assert_eq!(points, vec![
    PointN([0, 0, 0]), PointN([1, 0, 0]), PointN([0, 1, 0]), PointN([1, 1, 0])
]);
Loading content...

Implementors

impl IntegerExtent<[i32; 2]> for Extent2i[src]

impl IntegerExtent<[i32; 3]> for Extent3i[src]

Loading content...