ManimCommunity / ManimCommunity/manim

V0.18.1 NumberLine's number_to_point() is broken when using `add_tip`

Open
#3,740 6 comments 0 reactions 0 assignees View on GitHub

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 method `.number_to_point()` does not provide the correct position in scene coordinates

## Expected behavior
...well, it should provide the correct location along the numberline

## How to reproduce the issue
Code for reproducing the problem

```py
class group2(Scene):
def construct(self):
axes = NumberLine(x_range=[-5,5.2,1]).add_numbers().add_tip(tip_length=0.5,tip_width=0.1)
t = [MathTex("h_{i}") for i in range(1,11)]
self.add(axes)
for i in range(1,10):
self.add(t[i].next_to(axes.n2p(i-6),DOWN,buff=0.5))
self.add(Dot().move_to(axes.n2p(i-6)))
```

Without the added tip, the positions are correct

```py
class group2(Scene):
def construct(self):
axes = NumberLine(
x_range=[-5,5.2,1]).add_numbers()
t = [MathTex("h_{i}") for i in range(1,11)]
self.add(axes)
for i in range(1,10):
self.add(t[i].next_to(axes.n2p(i-6),DOWN,buff=0.5))
self.add(Dot().move_to(axes.n2p(i-6)))
```

Also adding the tip from the start works

```py
class group2(Scene):
def construct(self):
axes = NumberLine(
x_range=[-5,5.5,1],
include_tip=True,
).add_numbers()
t = [MathTex("h_{i}") for i in range(1,11)]
self.add(axes)
for i in range(1,10):
self.add(t[i].next_to(axes.n2p(i-6),DOWN,buff=0.5))
self.add(Dot().move_to(axes.n2p(i-6)))
```

## Additional media files
Images/GIFs

![image](https://github.com/ManimCommunity/manim/assets/8582807/becf43e2-6478-468f-b985-0e16a4062653)

![image](https://github.com/ManimCommunity/manim/assets/8582807/810b3ba5-04aa-4832-a328-3eb9752ea633)

![image](https://github.com/ManimCommunity/manim/assets/8582807/6f618d80-8a63-4ad3-b5a4-684dd904089b)

## System specifications

System Details

- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)): Windows 10 64 bit
- Python version (`python/py/python3 --version`): 3.11.6

## Additional comments

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 at NumberLine.number_to_point() and compare the provided reproductions where add_tip() is called after construction versus include_tip=True at initialization. Run the example scene and verify that points returned by number_to_point() remain at the correct scene coordinates when a tip is added.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.