-
Notifications
You must be signed in to change notification settings - Fork 69
Fix bug in PolySlab's intersections_plane method #3128
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
Merged
dmarek-flex
merged 1 commit into
develop
from
dmarek/FXC-4688-Incorrect-intersection-of-polyslab-with-coincident-plane
Jan 9, 2026
Merged
Fix bug in PolySlab's intersections_plane method #3128
dmarek-flex
merged 1 commit into
develop
from
dmarek/FXC-4688-Incorrect-intersection-of-polyslab-with-coincident-plane
Jan 9, 2026
+103
−17
Conversation
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
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.
3 files reviewed, 1 comment
f0a7282 to
54ae5af
Compare
Contributor
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
|
71f09f4 to
6204e40
Compare
8843177 to
56aac41
Compare
Contributor
Author
|
@lucas-flexcompute Does this look good? |
lucas-flexcompute
approved these changes
Jan 9, 2026
…plane is coincident with PolySlab side faces
f24ee67 to
a12f5a5
Compare
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.
intersections_plane for PolySlab was missing intersections with planes that were coincident on the + side of polyslab side walls.
Greptile Summary
This PR fixes a bug in
PolySlab.intersections_planewhere intersections were missed when a plane was coincident with the positive side of PolySlab side faces. The fix replaces asymmetric inequality checks (<=and>) with symmetric strict inequalities plus explicit handling of edges that touch the plane.Key Changes:
Technical Details:
The old logic used
f <= position AND orig > positionwhich would miss edges starting on the plane and extending in the negative direction. The new logic explicitly includes all edges where exactly one endpoint is on the plane viatouches = np.logical_xor(orig_on_plane, f_on_plane), ensuring symmetric handling of both directions.Confidence Score: 5/5
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant PolySlab participant IntersectionMethod as _find_intersecting_ys_angle_vertical participant NPUtils as numpy operations User->>PolySlab: intersections_plane(x=500) PolySlab->>IntersectionMethod: _find_intersecting_ys_angle_vertical(vertices, 500, axis=0) Note over IntersectionMethod: Process vertices for axis orientation IntersectionMethod->>IntersectionMethod: Roll vertices to get forward edges Note over IntersectionMethod: Detect intersection types IntersectionMethod->>NPUtils: np.isclose(x_vertices_axis, position) NPUtils-->>IntersectionMethod: orig_on_plane (boolean array) IntersectionMethod->>NPUtils: np.isclose(x_vertices_f, position) NPUtils-->>IntersectionMethod: f_on_plane (boolean array) Note over IntersectionMethod: NEW: Calculate touching edges IntersectionMethod->>NPUtils: np.logical_xor(orig_on_plane, f_on_plane) NPUtils-->>IntersectionMethod: touches (edges with one vertex on plane) Note over IntersectionMethod: Calculate crossing edges IntersectionMethod->>IntersectionMethod: crosses_b = (orig > pos) & (f < pos) IntersectionMethod->>IntersectionMethod: crosses_f = (orig < pos) & (f > pos) Note over IntersectionMethod: Combine intersection types IntersectionMethod->>IntersectionMethod: intersects_b = crosses_b | touches IntersectionMethod->>IntersectionMethod: intersects_f = crosses_f | touches Note over IntersectionMethod: Calculate intersection points IntersectionMethod->>IntersectionMethod: For each intersecting segment:<br/>compute slope and y-coordinate IntersectionMethod-->>PolySlab: ints_y_sort, ints_angle_sort PolySlab-->>User: List of intersection shapesNote
Addresses missed intersections when a slicing plane is coincident with
PolySlabside faces.intersections_planeedge tests to use symmetric strict crossings plus explicit single-endpoint-on-plane detection (excludes whole-edge-on-plane); respectsexclude_on_verticesPolySlaband a rotated-square (diamond) case, including tangent-touch degeneraciesCHANGELOG.mdunder Fixed to note thePolySlab.intersections_planebugfixWritten by Cursor Bugbot for commit a12f5a5. This will update automatically on new commits. Configure here.