image-rs / imageproc

Image processing operations
MIT License
758 stars 149 forks source link

Make `Rect` a "closed set" #690

Closed cospectrum closed 1 month ago

cospectrum commented 1 month ago

I think the whole boundary should be included. At the moment, the rectangle is half open, half closed:

use imageproc::rect::{Rect, Region};

let rect = Rect::at(0, 0).of_size(1, 1);
assert!(rect.contains(0, 0));  // success
assert!(rect.contains(1, 0));  // fail
cospectrum commented 1 month ago

Maybe I'm wrong. (0, 0) is the upper-left pixel, not a point on the "grid", right?