mirror of
https://github.com/felt/tippecanoe.git
synced 2026-12-05 06:41:41 +01:00
Treat hot pixels as half-open when snapping to a layer's common set
With consistent snapping, edges are snapped to every hot pixel they touch, including those whose corners they only touch. But with closed pixels, an edge passing diagonally through a lattice point touches the corners of the two pixels beside it as well, and is snapped into a zigzag through all four. Two edges from different polygons that cross at a pixel corner zigzag through the same pixels in different orders, and the zigzags cross each other. (In Dane County tile 10/258/376, this left a quarter-pixel gap and a quarter-pixel overlap between two blocks on either side of a sliver.) Hobby's snap rounding, whose guarantee that snapped edges don't cross is what makes snapping to a common set of hot pixels work, uses half-open pixels, [x - 0.5, x + 0.5) by [y - 0.5, y + 0.5), consistent with rounding halves up, which is how wagyu rounds intersection points. So when snapping to a common set of hot pixels, find the range of pixels an edge passes through in each row that way, so that a point on a pixel boundary belongs to only one pixel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CQ6vQUJtmGZnqz7RmVYQaJ
This commit is contained in:
+4
-4
File diff suppressed because one or more lines are too long
@@ -21,7 +21,7 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.492188, 39.977120 ], [ -100.019531, 39.977120 ], [ -100.019531, 40.044438 ], [ -99.931641, 40.044438 ], [ -99.755859, 40.044438 ], [ -99.492188, 39.977120 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.755859, 40.044438 ], [ -99.492188, 39.977120 ], [ -99.316406, 39.977120 ], [ -99.316406, 39.909736 ], [ -100.019531, 39.909736 ], [ -100.019531, 39.977120 ], [ -100.019531, 40.044438 ], [ -99.931641, 40.044438 ], [ -99.755859, 40.044438 ] ] ] } }
|
||||
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.755859, 40.044438 ], [ -99.492188, 39.977120 ], [ -99.316406, 39.977120 ], [ -99.316406, 39.909736 ], [ -100.019531, 39.909736 ], [ -100.019531, 39.977120 ], [ -99.931641, 40.044438 ], [ -99.755859, 40.044438 ] ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
@@ -91,11 +91,11 @@
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "R" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.448242, 39.749434 ], [ -99.420776, 39.740986 ], [ -99.385071, 39.743098 ], [ -99.354858, 39.728313 ], [ -99.319153, 39.726201 ], [ -99.297180, 39.717751 ], [ -99.297180, 39.713525 ], [ -99.319153, 39.721976 ], [ -99.354858, 39.724089 ], [ -99.385071, 39.738874 ], [ -99.420776, 39.736762 ], [ -99.448242, 39.745210 ], [ -99.489441, 39.728313 ], [ -99.519653, 39.728313 ], [ -99.555359, 39.713525 ], [ -99.582825, 39.719863 ], [ -99.618530, 39.715638 ], [ -99.654236, 39.732538 ], [ -99.684448, 39.732538 ], [ -99.717407, 39.745210 ], [ -99.753113, 39.734650 ], [ -99.783325, 39.736762 ], [ -99.819031, 39.719863 ], [ -99.854736, 39.719863 ], [ -99.882202, 39.711413 ], [ -99.917908, 39.724089 ], [ -99.953613, 39.726201 ], [ -99.981079, 39.740986 ], [ -100.000305, 39.740986 ], [ -100.000305, 39.745210 ], [ -99.981079, 39.745210 ], [ -99.953613, 39.730426 ], [ -99.917908, 39.728313 ], [ -99.882202, 39.715638 ], [ -99.854736, 39.724089 ], [ -99.819031, 39.724089 ], [ -99.783325, 39.740986 ], [ -99.753113, 39.738874 ], [ -99.717407, 39.749434 ], [ -99.684448, 39.736762 ], [ -99.654236, 39.736762 ], [ -99.618530, 39.719863 ], [ -99.582825, 39.724089 ], [ -99.555359, 39.717751 ], [ -99.519653, 39.732538 ], [ -99.489441, 39.732538 ], [ -99.448242, 39.749434 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "P" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -99.717407, 40.000268 ], [ -99.747620, 39.985538 ], [ -99.753113, 39.985538 ], [ -99.717407, 40.000268 ] ] ], [ [ [ -99.783325, 39.989747 ], [ -99.813538, 39.985538 ], [ -99.819031, 39.987643 ], [ -99.783325, 39.989747 ] ] ], [ [ [ -99.582825, 40.010787 ], [ -99.555359, 39.996060 ], [ -99.519653, 39.993956 ], [ -99.555359, 39.993956 ], [ -99.582825, 40.010787 ] ] ] ] } }
|
||||
{ "type": "Feature", "properties": { "name": "P" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -99.717407, 40.000268 ], [ -99.747620, 39.985538 ], [ -99.753113, 39.985538 ], [ -99.717407, 40.000268 ] ] ], [ [ [ -99.783325, 39.989747 ], [ -99.813538, 39.985538 ], [ -99.819031, 39.987643 ], [ -99.783325, 39.989747 ] ] ], [ [ [ -99.851990, 40.002372 ], [ -99.846497, 40.002372 ], [ -99.824524, 39.989747 ], [ -99.851990, 40.002372 ] ] ], [ [ [ -99.582825, 40.010787 ], [ -99.555359, 39.996060 ], [ -99.519653, 39.993956 ], [ -99.555359, 39.993956 ], [ -99.582825, 40.010787 ] ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "A" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.297180, 40.071766 ], [ -99.297180, 40.006580 ], [ -99.319153, 40.017098 ], [ -99.354858, 40.008683 ], [ -99.385071, 40.010787 ], [ -99.420776, 39.993956 ], [ -99.453735, 39.993956 ], [ -99.483948, 39.983434 ], [ -99.519653, 39.993956 ], [ -99.555359, 39.996060 ], [ -99.582825, 40.010787 ], [ -99.618530, 40.008683 ], [ -99.648743, 40.017098 ], [ -99.684448, 40.002372 ], [ -99.717407, 40.000268 ], [ -99.753113, 39.985538 ], [ -99.758606, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.819031, 39.987643 ], [ -99.824524, 39.989747 ], [ -99.846497, 40.002372 ], [ -99.851990, 40.002372 ], [ -99.882202, 40.004476 ], [ -99.917908, 40.017098 ], [ -99.953613, 40.006580 ], [ -99.981079, 40.008683 ], [ -100.000305, 40.000268 ], [ -100.000305, 40.071766 ], [ -99.297180, 40.071766 ] ] ] } }
|
||||
,
|
||||
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.912415, 40.017098 ], [ -99.882202, 40.004476 ], [ -99.854736, 40.004476 ], [ -99.851990, 40.002372 ], [ -99.846497, 40.002372 ], [ -99.824524, 39.989747 ], [ -99.819031, 39.987643 ], [ -99.813538, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.758606, 39.985538 ], [ -99.753113, 39.985538 ], [ -99.747620, 39.985538 ], [ -99.717407, 40.000268 ], [ -99.684448, 40.002372 ], [ -99.648743, 40.017098 ], [ -99.618530, 40.008683 ], [ -99.582825, 40.010787 ], [ -99.555359, 39.993956 ], [ -99.519653, 39.993956 ], [ -99.483948, 39.983434 ], [ -99.453735, 39.993956 ], [ -99.420776, 39.993956 ], [ -99.385071, 40.010787 ], [ -99.354858, 40.008683 ], [ -99.319153, 40.017098 ], [ -99.297180, 40.006580 ], [ -99.297180, 39.928695 ], [ -100.000305, 39.928695 ], [ -100.000305, 40.000268 ], [ -99.981079, 40.008683 ], [ -99.953613, 40.006580 ], [ -99.923401, 40.017098 ], [ -99.917908, 40.017098 ], [ -99.912415, 40.017098 ] ] ] } }
|
||||
{ "type": "Feature", "properties": { "name": "B" }, "geometry": { "type": "Polygon", "coordinates": [ [ [ -99.912415, 40.017098 ], [ -99.882202, 40.004476 ], [ -99.854736, 40.004476 ], [ -99.851990, 40.002372 ], [ -99.824524, 39.989747 ], [ -99.819031, 39.987643 ], [ -99.813538, 39.985538 ], [ -99.783325, 39.989747 ], [ -99.758606, 39.985538 ], [ -99.753113, 39.985538 ], [ -99.747620, 39.985538 ], [ -99.717407, 40.000268 ], [ -99.684448, 40.002372 ], [ -99.648743, 40.017098 ], [ -99.618530, 40.008683 ], [ -99.582825, 40.010787 ], [ -99.555359, 39.993956 ], [ -99.519653, 39.993956 ], [ -99.483948, 39.983434 ], [ -99.453735, 39.993956 ], [ -99.420776, 39.993956 ], [ -99.385071, 40.010787 ], [ -99.354858, 40.008683 ], [ -99.319153, 40.017098 ], [ -99.297180, 40.006580 ], [ -99.297180, 39.928695 ], [ -100.000305, 39.928695 ], [ -100.000305, 40.000268 ], [ -99.981079, 40.008683 ], [ -99.953613, 40.006580 ], [ -99.923401, 40.017098 ], [ -99.917908, 40.017098 ], [ -99.912415, 40.017098 ] ] ] } }
|
||||
] }
|
||||
] }
|
||||
,
|
||||
|
||||
Reference in New Issue
Block a user