From 89179b8d65b782f5ce156c89807d56bab8cea62a Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Fri, 28 Jun 2024 17:16:15 +0900 Subject: [PATCH] fix test --- src/voxelize.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/voxelize.rs b/src/voxelize.rs index 14df569..27ab7a4 100644 --- a/src/voxelize.rs +++ b/src/voxelize.rs @@ -98,7 +98,7 @@ fn draw_line( // TODO: We could optimize this since we actually need 2D DDA, not 3D DDA - while current_voxel != last_voxel && t <= 1.0 { + while current_voxel != last_voxel && t < 1.0 { put_voxel( buffer, current_voxel, @@ -283,7 +283,7 @@ fn fill_triangle( // overjet if end_pos[sweep_axis] - 0.5 < ordered_verts[2][sweep_axis] - && end_pos[sweep_axis] - 0.5 >= ordered_verts[1][sweep_axis] + && end_pos[sweep_axis] - 0.5 > ordered_verts[1][sweep_axis] { start_pos -= start_step2 * 0.5; end_pos -= end_step * 0.5; @@ -430,10 +430,10 @@ mod tests { [3.0, 0.0, 0.0], [3.0, 3.0, 0.0], [0.0, 3.0, 0.0], - [1.0, 1.0, 0.0], - [2.0, 1.0, 0.0], - [2.0, 2.0, 0.0], - [1.0, 2.0, 0.0], + [0.49, 0.49, 0.0], + [2.51, 0.49, 0.0], + [2.51, 2.51, 0.0], + [0.49, 2.51, 0.0], ]; let mut mpoly = MultiPolygon::::new(); @@ -488,12 +488,8 @@ mod tests { [2, 0, 0], [3, 0, 0], [0, 1, 0], - [1, 1, 0], - [2, 1, 0], [3, 1, 0], [0, 2, 0], - [1, 2, 0], - [2, 2, 0], [3, 2, 0], [0, 3, 0], [1, 3, 0],