-
Notifications
You must be signed in to change notification settings - Fork 110
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
update unify cycles #1413
update unify cycles #1413
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1413 +/- ##
==========================================
+ Coverage 61.57% 61.69% +0.11%
==========================================
Files 207 207
Lines 22281 22292 +11
==========================================
+ Hits 13720 13753 +33
+ Misses 8561 8539 -22 ☔ View full report in Codecov by Sentry. |
"""Unify the cycles of the mesh. | ||
|
||
Parameters | ||
---------- | ||
root : str, optional |
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.
type of root is int
src/compas/topology/orientation.py
Outdated
@@ -166,6 +172,10 @@ def unify_cycles(vertices, faces, root=None): | |||
The faces of the mesh defined as lists of vertex indices. | |||
root : str, optional |
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.
same here
src/compas/topology/orientation.py
Outdated
if nmax is not None: | ||
if radius is not None: | ||
return _face_adjacency(points, faces, nmax=nmax, radius=radius) | ||
return _face_adjacency(points, faces, nmax=nmax) | ||
if radius is not None: | ||
return _face_adjacency(points, faces, radius=radius) |
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.
perhaps it would make sense to refactor _face_adjacency
such that you can write here
if nmax or radius:
return _face_adjacency(points, faces, nmax=nmax, radius=radius)
btw, since the switch is no longer based on the number of faces, it should be easier to test using generated boundary cases... |
correct. do you have something in mind or should I leave the tests for now? |
was thinking that we could use the meshgrid with awkward proportions in x and y to generate inputs where radius and nmax provide very different results in different directions... |
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.
LGTM
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.
everything looks good but the tests are a bit confusing.
should we not include an assertion of some sorts?
also, if you know when the tests are supposed to fail, should we then not add a @pytest.mark.xfail
?
vertices = test_data["vertices"] | ||
faces = test_data["faces"] | ||
unify_cycles(vertices, faces) | ||
unify_cycles(vertices, faces, nmax=29, max_distance=22.4) # anything below won't work |
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.
is it clear why that is the case?
or it is just something you noticed?
unify_cycles(vertices, faces, nmax=29, max_distance=22.4) # anything below won't work | ||
|
||
|
||
def test_face_adjacency(): |
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.
why is this a face adjacency test and not also a test of unify cycles?
@romanarust perhaps just a few things to sort out regarding the test(s) |
Thanks! I've added now some |
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.
LGTM
As noted in #1411 there is a problem with face_adjacency on meshes with arbitrary-sized faces. I've now exposed the parameters
radius
andnmax
fromcompas.topology._face_adjacency
tocompas.topology.face_adjacency
and further propagated them tounify_cycles
andMesh.unify_cycles
.What type of change is this?
Checklist
Put an
x
in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.CHANGELOG.md
file in theUnreleased
section under the most fitting heading (e.g.Added
,Changed
,Removed
).invoke test
).invoke lint
).compas.datastructures.Mesh
.