-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Complex/number plane axes tips & ticks #3624
base: main
Are you sure you want to change the base?
Complex/number plane axes tips & ticks #3624
Conversation
Add attribute `inlcude_tips` (note* plural), initialize variable `self.include_tips = include_tips` add a check `if self.include_tips` and perform appropriate logic which invokes the function `add_tip_opposite_end` on self while preserving the parameters (tip_shape, tip_height, tip_width) of the original/right-most tip as well as the stroke and finaly setting `x_max` and `x_min` based on `self.include_tip` or `self.include_tips`
Define a new function `add_tip_opposite_end` to allow the user to specify the `include_tips` attribute in the NumberLine __inint__() method.
for more information, see https://pre-commit.ci
It seems to me more like patching on top of a problem which sits on NumberLine itself. Therefore, i think that there is some discussion needed if we want to change the default behavior in this case because adding another parameter to "fix" the scaling seems like a very confusing solution for the future, especially with the naming. Maybe rethinking how the tips work might be a good idea here. |
I don't think it's necessary to change the default behavior, but I believe manim is designed with the goal in mind to be flexible, easy-to-use and easy-to-understand. You are entirely correct that a deeper problem persists with the NumberLine MObject in that the elements are shifted/scaled ever-so-slightly "off grid" (can't figure out exactly to what degree) But this is most likely the exact cause of the distortion-issue, i.e. the NumberLine with a tip included on either end scales the new grouped MObjects length ever-so-slightly which causes this misalignment with "grid" MObjects (Axes, NumberPlane, ComplexPlane, ...) To fix this issue, may be ten times more challenging than the proposed changes. I suspect that excluding the length of the arrow tip on the grouped NumberLine MObjects, should give back the default behavior, but I am not entirely sure where would we start with that, So I believe this "patchy" solution isn't all that bad, from manim users' perspective, although changes may break it in the future - until we can come up with an improved mechanism to deal with the underlying NumberLine-distortion issue. |
Instead of a separate keyword argument, I feel a modification of What do you think about that? |
Overview: What does this pull request change?
This commit updates the behavior of NumberPlane and ComplexPlane Mobjects axes tips, by defining a new attribute
include_tips
(note* plural) inside theaxis_config
argument for displaying the leftmost & rightmost tips without distorting/stretching the ticks along the axes.Note the updated code files number_line.py & arc.py may have some code redundancies
Motivation and Explanation: Why and how do your changes improve the library?
Links to added or changed documentation pages
Further Information and Comments
Works for ComplexPlane, NumberPlane & NumberLine.
No need to define such behavior for Axes, because the ticks are not distorted when including leftmost tip using other "rudimentary" methods
The attribute
include_tips = True
is simple to use.Avoid using
include_tips=True
in conjunction withinclude_tip
(use one or the other) since this will create a double arrow-head on one of the sides of an axisBelow is an illustration of the output using a ComplexPlane Mobject that distorts the ticks along the x- and y-axes. See the code below, with certain parts that can be uncommented to achieve the desired effect:
Below is an illustration of the output using a ComplexPlane Mobject with the added attribute
include_tips
showing that the axes ticks are aligned with the NumberPlane grid (lines parallel to the axes)Here's the code snippet that produces this output:
`
`
Here's a screenshot of a way to manipulate Axes Mobjects left/right tips which does not work exactly the same for NumberPlane and ComplexPlane Mobjects, which is the motive for this commit:
In the above case, the leftmost tip shape, width and height does not inherit from the rightmost tip, but can easily be manipulated using code below, by toggling some of the comments:
However, this functionality applies only to Axes Mobjects, not NumberPlane and ComplexPlane, thus, the proposed change is very relevant and can hopefully be merged into existing manim CE master
`
`
Reviewer Checklist