Fix unit test in camera
This commit is contained in:
parent
e8f9040807
commit
8c458d073e
|
|
@ -173,12 +173,12 @@ mod tests {
|
||||||
}) => location,
|
}) => location,
|
||||||
None => panic!(),
|
None => panic!(),
|
||||||
};
|
};
|
||||||
let expected_x: f64 =
|
let expected_x = target.film_width * (200.0/800.0 - 0.5);
|
||||||
ImageSampler::scale(200, 800, target.film_width) - target.film_width * 0.5;
|
assert!(point_on_film_plane.x() - expected_x < target.film_width / 800.0);
|
||||||
assert!((point_on_film_plane.x() - expected_x).abs() < 0.5 / 800.0);
|
assert!(point_on_film_plane.x() - expected_x >= 0.0);
|
||||||
let expected_y =
|
let expected_y = -target.film_height * (100.0/600.0 - 0.5);
|
||||||
-ImageSampler::scale(100, 600, target.film_height) + target.film_height * 0.5;
|
assert!(expected_y - point_on_film_plane.y() < target.film_height / 600.0);
|
||||||
assert!((point_on_film_plane.y() - expected_y).abs() < 0.5 / 600.0);
|
assert!(expected_y - point_on_film_plane.y() >= 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue