-
Notifications
You must be signed in to change notification settings - Fork 5
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
Added edge_lengths
property
#196
Conversation
Codecov Report
@@ Coverage Diff @@
## master #196 +/- ##
==========================================
- Coverage 54.88% 54.87% -0.01%
==========================================
Files 24 25 +1
Lines 2551 2582 +31
==========================================
+ Hits 1400 1417 +17
- Misses 1151 1165 +14
|
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.
This looks good. Lets make sure that order of edge lengths is well defined in the docs and this is good to go.
coxeter/shapes/polyhedron.py
Outdated
@@ -390,6 +390,11 @@ def edge_vectors(self): | |||
""":class:`numpy.ndarray`: Get the polyhedron's edges as vectors.""" | |||
return self.vertices[self.edges[:, 1]] - self.vertices[self.edges[:, 0]] | |||
|
|||
@property | |||
def edge_lengths(self): | |||
""":class:`numpy.ndarray`: Get the length of each edge of the polyhedron.""" |
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.
""":class:`numpy.ndarray`: Get the length of each edge of the polyhedron.""" | |
""":class:`numpy.ndarray`: Get the length of each edge of the polyhedron in the same order as order of edges in :meth:`edge_vectors` .""" |
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.
Should we add this ordering specification to edge_vectors as well? Both use the same ordering as :meth:edges
which is the primary sorted array
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.
Maybe. Is it super obvious what this is? If it is maybe this needs not be in the docstring, but if it is not then it should be for sure.
Description
Added edge_lengths property to the Polyhedron class.
Motivation and Context
Although this is a single line of code, I use it extremely frequently (as it has additional value in helping to determine the degree of uniformity of a solid). This should be a quick PR, and if it seems unnecessary I am happy to continue manually implementing this function.
Types of Changes
1The change breaks (or has the potential to break) existing functionality.
Checklist: