-
Notifications
You must be signed in to change notification settings - Fork 109
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
romanarust
wants to merge
10
commits into
main
Choose a base branch
from
fix_unify_cyc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
update unify cycles #1413
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9b21995
update unify cycles
romanarust 9bb9e91
skip ipy
romanarust 4d0da5e
Merge branch 'main' into fix_unify_cyc
romanarust 38a7049
updates
romanavyzn 155147b
adding meshgrid test
romanavyzn 77ee059
updates
romanarust 44c7d8c
updates
romanarust b02bde9
Update mesh.py
romanarust e33f06a
Update mesh.py
romanarust c13863b
Update orientation.py
romanarust File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,7 @@ | |
return adjacency | ||
|
||
|
||
def face_adjacency(points, faces): | ||
def face_adjacency(points, faces, nmax=None, radius=None): | ||
"""Build a face adjacency dict. | ||
|
||
Parameters | ||
|
@@ -103,6 +103,10 @@ | |
The vertex locations of the faces. | ||
faces : list[list[int]] | ||
The faces defined as list of indices in the points list. | ||
nmax : int, optional | ||
The maximum number of neighboring faces to consider. If neither nmax nor radius is specified, all faces will be considered. | ||
radius : float, optional | ||
The radius of the search sphere for neighboring faces. If neither nmax nor radius is specified, all faces will be considered. | ||
|
||
Returns | ||
------- | ||
|
@@ -117,10 +121,12 @@ | |
purely geometrical, but uses a spatial indexing tree to speed up the search. | ||
|
||
""" | ||
f = len(faces) | ||
|
||
if f > 100: | ||
return _face_adjacency(points, faces) | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. perhaps it would make sense to refactor if nmax or radius:
return _face_adjacency(points, faces, nmax=nmax, radius=radius) |
||
|
||
adjacency = {} | ||
|
||
|
@@ -152,7 +158,7 @@ | |
return adjacency | ||
|
||
|
||
def unify_cycles(vertices, faces, root=None): | ||
def unify_cycles(vertices, faces, root=None, nmax=None, radius=None): | ||
"""Unify the cycle directions of all faces. | ||
|
||
Unified cycle directions is a necessary condition for the data structure to | ||
|
@@ -166,6 +172,10 @@ | |
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 commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
The key of the root face. | ||
nmax : int, optional | ||
The maximum number of neighboring faces to consider. If neither nmax nor radius is specified, all faces will be considered. | ||
radius : float, optional | ||
The radius of the search sphere for neighboring faces. If neither nmax nor radius is specified, all faces will be considered. | ||
|
||
Returns | ||
------- | ||
|
@@ -196,7 +206,7 @@ | |
if root is None: | ||
root = random.choice(list(range(len(faces)))) | ||
|
||
adj = face_adjacency(vertices, faces) # this is the only place where the vertex coordinates are used | ||
adj = face_adjacency(vertices, faces, nmax=nmax, radius=radius) # this is the only place where the vertex coordinates are used | ||
|
||
visited = breadth_first_traverse(adj, root, unify) | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
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.
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