rect-iter

Crates.iorect-iter
lib.rsrect-iter
version0.3.0
sourcesrc
created_at2018-04-17 09:05:45.771198
updated_at2019-08-20 20:32:16.880167
descriptionIterator for 2D rectangle areas
homepagehttps://github.com/kngwyu/rect-iter
repositoryhttps://github.com/kngwyu/rect-iter
max_upload_size
id61047
size44,605
Yuji Kanagawa (kngwyu)

documentation

README

rect-iter

Build Status crate.io Documentation

This library provides general iterator for enumerating Rectangle.

There are many libralies which handle 2D rectangle area, so I thought it's convinient if we can use those libraries in the same way.

And, here's the result.

Currently, ndarray, image, euclid are supported.

Example

with euclid feature(it's included by default):

extern crate rect_iter;
extern crate euclid;
use euclid::TypedVector2D;
use rect_iter::{RectRange, FromTuple2, GetMut2D};
type MyVec = TypedVector2D<u64, ()>;
fn main() {
    let range = RectRange::from_ranges(4..9, 5..10).unwrap();
    let mut buffer = vec![vec![0.0; 100]; 100];
    range.iter().for_each(|t| {
        let len = MyVec::from_tuple2(t).to_f64().length();
        *buffer.get_mut_p(t) = len;
    });
}

License

This project is licensed under either of

at your option.

Commit count: 52

cargo fmt