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

VMobject: get_anchors() and get_anchors_and_handles() different behavior #3185

Closed
ubaldot opened this issue Mar 13, 2023 · 0 comments · Fixed by #3214
Closed

VMobject: get_anchors() and get_anchors_and_handles() different behavior #3185

ubaldot opened this issue Mar 13, 2023 · 0 comments · Fixed by #3214

Comments

@ubaldot
Copy link

ubaldot commented Mar 13, 2023

Description of bug / unexpected behavior

It seems that get_anchors() returns a new object whereas get_anchors_and_handles() returns a reference.
get_start_anchors() and get_end_anchors() also return a reference.

Expected behavior

Consistency between the methods would be desirable.

How to reproduce the issue

The following snippet produce

c = Circle()

print("get_anchors = ", c.get_anchors()[-1])
print("get_anchors_and_handles = ", c.get_anchors_and_handles()[-1][-1])
c.get_anchors_and_handles()[-1][-1] += 2 * mn.RIGHT
print("get_anchors = ", c.get_anchors()[-1])
print("get_anchors_and_handles = ", c.get_anchors_and_handles()[-1][-1])

produces

get_anchors =  [ 1.0000000e+00 -2.4492936e-16  0.0000000e+00]
get_anchors_and_handles =  [ 1.0000000e+00 -2.4492936e-16  0.0000000e+00]
get_anchors =  [ 3.0000000e+00 -2.4492936e-16  0.0000000e+00]
get_anchors_and_handles =  [ 3.0000000e+00 -2.4492936e-16  0.0000000e+00]

whereas the following snippet

c =  Circle()

print("get_anchors = ", c.get_anchors()[-1])
print("get_anchors_and_handles = ", c.get_anchors_and_handles()[-1][-1])
c.get_anchors()[-1] += 2 * mn.RIGHT
print("get_anchors = ", c.get_anchors()[-1])
print("get_anchors_and_handles = ", c.get_anchors_and_handles()[-1][-1])

produces

get_anchors =  [ 1.0000000e+00 -2.4492936e-16  0.0000000e+00]
get_anchors_and_handles =  [ 1.0000000e+00 -2.4492936e-16  0.0000000e+00]
get_anchors =  [ 1.0000000e+00 -2.4492936e-16  0.0000000e+00]
get_anchors_and_handles =  [ 1.0000000e+00 -2.4492936e-16  0.0000000e+00]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

1 participant