Repository navigation
Polygon fix to better handle colinear points - #2935
Merged
Merged
Conversation
Contributor
|
Should the examples from #2931, and from slack be added as test cases? |
paulromano
approved these changes
Apr 5, 2024
paulromano
left a comment
Contributor
There was a problem hiding this comment.
Changes here look good to me. @eepeterson if it's easy enough to add a test case based on the example that brought this up, that would be great.
church89
pushed a commit
to openmsr/openmc
that referenced
this pull request
Jul 18, 2024
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
apingegno
pushed a commit
to apingegno/openmc
that referenced
this pull request
May 7, 2026
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
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.
Description
This PR fixes issues with coplanar points in the
openmc.model.Polygonclass. As far as I am aware, QHull cannot be forced to generate specific edges (or follow constraints that would enforce that). As a result, my workaround has been to split edges of the desired polygon in half if the first triangulation does not produce an edge on that segment of the polygon. This produces colinear points that are not included in thescipy.spatial.ConvexHullobject when testing for the convexity of a particular grouping of triangles inside the polygon. However, they do show up in thecoplanarattribute and therefore we can say that if the number of test points is equal to the number of vertices in the convex hull plus the coplanar points then the grouping of triangles is still convex. This combined with increasing the number of attempts at triangulation I believe will provide a more robustPolygonfunctionality. I also altered the algorithm for grouping simplices by starting with ones with the smallest neighbor lists since that has anecdotally resulted in smaller numbers of convex regions comprising a polygon. Although I'm sure it's not universal, it's likely better than grabbing a simplex at random.Fixes #2931 pinging @MicahGale since he raised the issue
Checklist
- [x] I have run clang-format (version 15) on any C++ source files (if applicable)- [x] I have made corresponding changes to the documentation (if applicable)