-
-
Notifications
You must be signed in to change notification settings - Fork 764
Reintroduce Sutherland-Hodgman Clipping Algorithm #640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
⏱️ Benchmark run finished in 1m 5s 📈 Compared against baseline: 69s 🟢 Generation time is unchanged. You can retrigger the benchmark by commenting |
… water rendering - Fix O(n*m) performance regression in highway processing by building connectivity map once - Store unclipped ways in ways_map for proper relation member merging (merge_loopy_loops) - Use clipped ways for standalone way processing - Add empty vector guard in merge_loopy_loops to prevent panic - Expose build_highway_connectivity_map as public API - Add debug_logging module for development diagnostics
ac884b8 to
41fc566
Compare
|
retrigger-benchmark |
|
retrigger-benchmark |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
retrigger-benchmark |
|
This was frustrating and took days but it looks like it's working now. Will do some more tests in the next week. Feedback is appreciated |
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This was accidentally removed by #586 (comment), but we need it for generation performance reasons.
Problem
After removing Sutherland-Hodgman clipping, large area generation became slow due to processing full OSM polygons instead of bbox-clipped versions. Additionally, polygons extending beyond the bbox boundary were rendered with diagonal cuts instead of following the bbox edges.
Solution
Reintroduce Sutherland-Hodgman clipping with proper corner insertion - when a polygon exits one bbox edge and enters another, insert the appropriate corner points to follow the bbox boundary instead of creating diagonal cuts.
Dual storage for ways - store unclipped ways in
ways_mapfor relation member lookup (required formerge_loopy_loopsto match endpoint IDs), while using clipped ways for standalone element processing.Separate clipping paths:
Edge-specific clamping - during each Sutherland-Hodgman pass, clamp intersection points only to the current edge to prevent premature corner artifacts.
Changes
is_water_element()detection; separate clipping logic for closed polygons vs open polylinesclip_water_ring_to_bbox(); added corner insertion for water polygons; added empty vector guards inmerge_loopy_loops