Skip to content

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

@Maxwin-z

Description

@Maxwin-z
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions