Filter degenerate decomposition cells and short-circuit sweep generation for near-zero-area polygons#33
Draft
Filter degenerate decomposition cells and short-circuit sweep generation for near-zero-area polygons#33
Conversation
Agent-Logs-Url: https://github.com/kasperg3/trajgenpy/sessions/25fd8e99-6f86-49d1-a055-c202cd466f53 Co-authored-by: kasperg3 <34032375+kasperg3@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kasperg3/trajgenpy/sessions/25fd8e99-6f86-49d1-a055-c202cd466f53 Co-authored-by: kasperg3 <34032375+kasperg3@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
kasperg3
April 14, 2026 10:08
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
decompose_polygon()could return zero/near-zero-area cells from CGAL decomposition, and forwarding those cells togenerate_sweep_pattern()could trigger CGAL orientation errors or numeric failures. This PR adds area-based guards at both boundaries so degenerate polygons are excluded before sweep computation.Area thresholds for degenerate geometry handling
trajgenpy/Geometries.py:MIN_DECOMPOSE_POLYGON_AREA = 1.0MIN_SWEEP_POLYGON_AREA = 1.0Decomposition output filtering
decompose_polygon()to filter sub-polygons returned bybindings.decompose(...).MIN_DECOMPOSE_POLYGON_AREAare dropped before return.Sweep generation safety guard
generate_sweep_pattern()to return[]immediately whenpolygon.area < MIN_SWEEP_POLYGON_AREA.bindings.generate_sweeps(...).Regression coverage
tests/test_geometries.pyfor:decompose_polygon()generate_sweep_pattern()and no call-through to bindings for small polygons