-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Custom Arrow Tips #366
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
Custom Arrow Tips #366
Conversation
|
Thanks for your contribution ! |
|
WOWOWOW This is beautiful thanks so much! I'll review in a sec, but thank you! |
leotrs
left a comment
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.
Great stuff here!
One more suggestion: I think the current way of creating filled/hollow tips is a bit awkward. Why not add a filled class to each? In this way this code
a12 = Arrow(np.array([-2,2,0]), np.array([2, 2, 0]),
tip_shape=ArrowTriangleTip,
tip_style={'fill_opacity': 0, 'stroke_width': 3})becomes this
a12 = Arrow(np.array([-2,2,0]), np.array([2, 2, 0]),
tip_shape=ArrowTriangleFilledTip)|
Thank you for this lightning-fast review! I was just typing that you don't need to stress yourself, as I don't know how soon I can add documentation and tests. 😄 I'll look at your comments a bit later -- thanks again! |
|
Speaking of tests, I think we should wait for #335 to be merged before adding new tests, so it will be easier. |
Great idea! It really was rather clunky before. I've added some convenience classes for filled/hollow tips in e8d076c. :-) |
|
Great great stuff. BTW, it was extremely helpful of you to leave the commit link in each of your comments. Super easy to review! |
Thank you for the kind words and your reviews! The thing with the commit hashes in the comments is what I like most when I have to review stuff, glad you like it as well. 😄 I'll finish this here up by writing some docstrings, then the draft status of the PR can be removed again. As @huguesdevimeux suggested above, I'll wait with adding tests until #335 is ready (or take care of that in a follow-up PR). 👍 |
|
Sounds like a plan |
|
There was no actual conflict, I only needed to merge master locally. And of course, black still fails. Unfortunately, the tests revealed another inconvenience: due to different architectures, numerics are slightly different between operating systems, which leads to numpy yielding I'll come up with a fix for this, or replace the faulty doctests. |
Ready to be reviewed again! |
| :: | ||
| >>> arrow = Arrow(np.array([0, 0, 0]), np.array([2, 0, 0]), buff=0) | ||
| >>> arrow.tip.base.round(2) | ||
| >>> arrow.tip.base.round(2) + 0. # add 0. to avoid negative 0 in output |
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.
lol, I did not know about this hack
|
Can we get one more approval here? This is super ready @huguesdevimeux @Aathish04 |
Aathish04
left a comment
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.
Thank you for the contributions!
huguesdevimeux
left a comment
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.
SGTM !
|
🥳 |


List of Changes
ArrowTipingeometry.pyto be a (actually quite concrete) abstract base class so that different arrow tip shapes can be implemented by inheriting from it.ArrowTriangleTip(the current default tip), and two new tipsArrowCircleTip,ArrowSquareTip.tip_shapeto pass the custom shape to theArrowconstructor.Motivation
This is part of #272.
Explanation for Changes
This PR changes the class hierarchy for arrow tips a little in order to allow the (easy) implementation of custom tips. Details are given in the List of Changes.
Testing Status
As an example, rendering the
ArrowTestscene in the Snippetyields
Acknowledgement