ManimCommunity/manim

VMobject inaccurately attributes width/height attrs to its bézier control points

Open

#3.619 geöffnet am 15. Feb. 2024

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (1.378 Forks)batch import
good first issueissue:bug

Repository-Metriken

Stars
 (17.820 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 11T 17h) (4 gemergte PRs in 30 T)

Beschreibung

Description of bug / unexpected behavior

The VMobject width/height attributes are calculated using the points array which is actually the control points for the quadratic bézier curves. This is not very intuitive behavior for end-users.

Expected behavior

The VMobject width/height attributes should indicate the width/height of the physical curve, respectively.

How to reproduce the issue

class TestFail(Scene):
  def construct(self):
    c = Circle().scale(3)
    c.rotate(30*DEGREES)
    radius = c.width / 2
    l = Line().set_length(radius * 2).move_to(c)

    self.add(c, l)

image

Additional media files

https://discord.com/channels/581738731934056449/976376734935048223/1207665909871677500

Additional comments

Possibly related to this issue: #3344 This may be helpful for anyone fixing this issue in the future: https://stackoverflow.com/questions/2587751/an-algorithm-to-find-bounding-box-of-closed-bezier-curves

Contributor Guide