remove MathUtils::distance()

This commit is contained in:
Vukašin Stepanović
2023-02-16 09:28:22 +00:00
parent 844ffc3b81
commit 79d9b28d19
10 changed files with 92 additions and 87 deletions

View File

@@ -290,7 +290,10 @@ impl<'a> WhiteRectangleDetector<'_> {
}
fn get_black_point_on_segment(&self, a_x: f32, a_y: f32, b_x: f32, b_y: f32) -> Option<Point> {
let dist = MathUtils::round(MathUtils::distance(a_x, a_y, b_x, b_y));
let a = Point::new(a_x, a_y);
let b = Point::new(b_x, b_y);
let dist = MathUtils::round(a.distance(b));
let x_step: f32 = (b_x - a_x) / dist as f32;
let y_step: f32 = (b_y - a_y) / dist as f32;