Skip to content
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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

update unify cycles #1413

wants to merge 10 commits into from

Conversation

romanarust
Copy link
Member

As noted in #1411 there is a problem with face_adjacency on meshes with arbitrary-sized faces. I've now exposed the parameters radius and nmax from compas.topology._face_adjacency to compas.topology.face_adjacency and further propagated them to unify_cycles and Mesh.unify_cycles.

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

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.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • I added new functions/classes and made them available on a second-level import, e.g. compas.datastructures.Mesh.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 65.62500% with 11 lines in your changes missing coverage. Please review.

Project coverage is 61.68%. Comparing base (f24872a) to head (c13863b).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/compas/topology/orientation.py 63.33% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1413      +/-   ##
==========================================
+ Coverage   61.57%   61.68%   +0.10%     
==========================================
  Files         207      207              
  Lines       22281    22292      +11     
==========================================
+ Hits        13720    13751      +31     
+ Misses       8561     8541      -20     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"""Unify the cycles of the mesh.

Parameters
----------
root : str, optional
Copy link
Member

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

@@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Comment on lines 124 to 129
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)
Copy link
Member

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)

@tomvanmele
Copy link
Member

btw, since the switch is no longer based on the number of faces, it should be easier to test using generated boundary cases...

@romanarust
Copy link
Member Author

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?

@tomvanmele
Copy link
Member

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants