diff --git a/src/drawing/line.rs b/src/drawing/line.rs index d4fdc8a2..2d38b1d6 100644 --- a/src/drawing/line.rs +++ b/src/drawing/line.rs @@ -353,6 +353,21 @@ mod tests { // 3 / | \ 0 // / 2 | 1 \ + #[test] + fn test_draw_line_segment_zero_length() { + let image = GrayImage::from_pixel(5, 5, Luma([1u8])); + + let expected = gray_image!( + 1, 1, 1, 1, 1; + 4, 1, 1, 1, 1; + 1, 1, 1, 1, 1; + 1, 1, 1, 1, 1; + 1, 1, 1, 1, 1); + + let actual = draw_line_segment(&image, (0f32, 1f32), (0f32, 1f32), Luma([4u8])); + assert_pixels_eq!(actual, expected); + } + #[test] fn test_draw_line_segment_horizontal() { let image = GrayImage::from_pixel(5, 5, Luma([1u8])); diff --git a/src/hough.rs b/src/hough.rs index 87746aca..b6af7f8e 100644 --- a/src/hough.rs +++ b/src/hough.rs @@ -170,9 +170,6 @@ pub fn intersection_points( if right_y >= 0.0 && right_y <= h { let right_intersect = (w, right_y); - if let Some(s) = start { - return Some((s, right_intersect)); - } start = Some(right_intersect); }