sample in the middle of pixels, instead of the top-left

This commit is contained in:
Gered 2023-04-01 00:40:05 -04:00
parent 832daefbda
commit a106228517

View file

@ -81,7 +81,7 @@ impl<PixelType: Pixel> Bitmap<PixelType> {
for (idx, pixel) in row_pixels.iter_mut().enumerate() {
let x = min_x + idx as i32;
let p = Vector2::new(x as f32, y as f32);
let p = Vector2::new(x as f32 + 0.5, y as f32 + 0.5);
let w0 = cross(b, c, p);
let w1 = cross(c, a, p);
let w2 = cross(a, b, p);