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

Sector.get_arc_center() return a reference but not a copy, cause rotate unexpected behavior. #3572

Closed
Maxwin-z opened this issue Jan 5, 2024 · 0 comments · Fixed by #3599

Comments

@Maxwin-z
Copy link

Maxwin-z commented Jan 5, 2024

  • Description of bug / unexpected behavior

manim version: 0.18.0

class SectorArcCenterRotate(Scene):
  def construct(self):
    self.add(NumberPlane())
    sector = Sector(outer_radius=2, start_angle=0, angle=PI / 6)
    sector.shift(LEFT * 3)
    self.add(sector)
    self.wait()
    self.add(sector.copy().set_color(RED).set_opacity(0.5))
    sector.rotate(PI / 6, about_point=sector.get_arc_center())  # unexcepted
    # sector.rotate(PI / 6, about_point=deepcopy(sector.get_arc_center()))
    self.wait()

Expected behavior

expected behavior:
image

the actual behavior:
image

System specifications

System Details - OS (MacOS 14.2.1 (23C71)): - RAM: - Python version 3.11.5 - Installed modules (provide output from `pip list`):

I think the "problem" is get_arc_center return a reference of Sector's point:

def get_arc_center(self, warning: bool = True) -> Point3D:
"""Looks at the normals to the first two
anchors, and finds their intersection points
"""
# First two anchors and handles
a1, h1, h2, a2 = self.points[:4]
if np.all(a1 == a2):
# For a1 and a2 to lie at the same point arc radius
# must be zero. Thus arc_center will also lie at
# that point.
return a1

But the other method, such as get_corner return a copy.
Not sure it's a feature or a bug. Thanks.

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