ManimCommunity / ManimCommunity/manim
VMobject inaccurately attributes width/height attrs to its bézier control points
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
## 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
```py
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)
```

## 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how VMobject width and height are calculated from its points array, then review the linked Bézier bounding-box algorithm and related issue #3344. Done means the attributes represent the physical curve bounds, including for the rotated Circle reproduction, rather than its control points.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100