From 02369dd42ac9aba4c402307b977bba44cb15793a Mon Sep 17 00:00:00 2001 From: Chris Marchesi Date: Tue, 1 Sep 2026 16:57:50 -0700 Subject: [PATCH] Polygon: boxes with bottom or right side of exactly zero are not in the box I missed this in 58724f9 - bottom or right extents of zero are not in the box either (consider an infinitely thin line representing the edge with the fill area to the left or top of this boundary). --- src/internal/tess/Polygon.zig | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/internal/tess/Polygon.zig b/src/internal/tess/Polygon.zig index ed4e326..fb026db 100644 --- a/src/internal/tess/Polygon.zig +++ b/src/internal/tess/Polygon.zig @@ -156,7 +156,7 @@ pub fn inBox(self: *const Polygon, scale: f64, box_width: i32, box_height: i32) // Fast-path negative bottom or right side - if either of these are true, // then there's no chance we're in the box. - if (self.extent_right < 0.0 or self.extent_bottom < 0.0 ) { + if (self.extent_right <= 0.0 or self.extent_bottom <= 0.0) { return false; } @@ -706,6 +706,32 @@ test "Polygon.inBox" { .box_width = 10, .expected = false, }, + .{ + .name = "OOB, bottom adjacent at exactly zero", + .polygon = .{ + .extent_left = -37.0, + .extent_top = -29.0, + .extent_right = 21.0, + .extent_bottom = 0.0, + }, + .scale = 1.0, + .box_height = 100, + .box_width = 100, + .expected = false, + }, + .{ + .name = "OOB, right side adjacent at exactly zero", + .polygon = .{ + .extent_left = -37.0, + .extent_top = -29.0, + .extent_right = 0.0, + .extent_bottom = 21.0, + }, + .scale = 1.0, + .box_height = 100, + .box_width = 100, + .expected = false, + }, .{ .name = "scale", .polygon = .{