ManimCommunity / ManimCommunity/manim

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

Open
#3,619 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

good first issue issue:bug
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)
```
![image](https://github.com/ManimCommunity/manim/assets/29168469/e7294f1f-8d0f-4fe4-b5c3-df7989111fb4)

## 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.