3b1b / 3b1b/manim

DecimalNumber not following line

未關閉
#1,700 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Python
星號
93.9k
分支
7.7k
平均合併
2 天 13 小時
30 天內合併 PR
4

描述

### Describe the bug

When a `DecimalNumber` is set `next_to` a line, it doesn't follow. The behavior is different when you add a `Brace`. Try uncommenting the lines related to `Brace`, you will see that the number is following it even though the number is not following the `Brace`.

**Code**:
```python
SCALE = 3
plane = NumberPlane((-2, 2),(-2, 2)).scale(SCALE)
plane.set_stroke(BLUE_E, 1)

self.add(plane)

p1 = Point(plane.c2p(1,0))
line = Line(plane.get_origin(), p1.get_location()).set_stroke(GREEN_E, 2)

# brace = always_redraw(Brace, line, UP)

distance = DecimalNumber(0, num_decimal_places=2, font_size=24)
distance.arrange(RIGHT)

always(distance.next_to, line, UP)
f_always(distance.set_value, lambda : line.get_length() / SCALE)
# f_always(brace.rotate, line.get_angle)

self.add(distance)
# self.add(brace)

self.play(
ShowCreation(line)
)

for x in range(360//15)
self.play(
line.animate.set_angle(line.get_angle() + 15 * DEGREES)
)
self.wait(0.2)

```
**Wrong display or Error traceback**:

![with_brace](https://user-images.githubusercontent.com/7023385/147456546-500d6456-df7e-4051-8c9c-5b6022bc7d04.png)
![without_brace](https://user-images.githubusercontent.com/7023385/147456550-51b07883-8943-4e21-827d-33a6656d1185.png)

### Additional context

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

查看 manim 的原始碼(很可能在 manim/mobject/numbers.py 或類似檔案)中的 DecimalNumber 類別及其 next_to 方法。比較它與 Line 與 Brace 的互動。運行提供的腳本以重現該問題,然後追踪 always 與 f_always 函數中的更新邏輯。修正可能涉及確保 Line 旋轉時 DecimalNumber 的位置正確更新。

由索引模型根據 Issue 內容生成。

評估

領域
computer-graphics
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
65/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。