Skip to content

Numberline elongated ticks do not work for certain float values #3394

@hari387

Description

@hari387

Description of bug / unexpected behavior

When attempting to specify precisely which ticks were to be elongated in NumberLine or UnitInterval, I found that some of the ticks specified were not in fact elongated in the output. This is likely due to floating point equality being used to check which ticks should be elongated.

Expected behavior

There should be elongated ticks on every tick specified in the argument.

How to reproduce the issue

Code for reproducing the problem
from manim import *

class NumberLineBug(Scene):
    def construct(self):
        ui = UnitInterval(numbers_with_elongated_ticks=(
            (0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0)))
        self.add(ui)

Additional media files

Images/GIFs

NumberLineBug_ManimCE_v0 17 3

Logs

Terminal output
❯ manim scene.py NumberLineBug --media_dir /mnt/c/Users/narah/Videos/manim -qm -v DEBUG
Manim Community v0.17.3

[10/08/23 16:16:53] INFO                                                                                                            scene_file_writer.py:736
                             File ready at '/mnt/c/Users/narah/Videos/manim/images/scene/NumberLineBug_ManimCE_v0.17.3.png'

                    INFO     Rendered NumberLineBug                                                                                             scene.py:241
                             Played 0 animations

System specifications

System Details
  • OS: WSL2 (Debian 11, Bullseye) on Windows 11
  • RAM: 16GB
  • Python version (python/py/python3 --version): 3.9.2
  • Installed modules (provide output from pip list):
Package             Version
------------------- ---------
certifi             2023.7.22
charset-normalizer  3.3.0
click               8.1.7
click-default-group 1.2.4
cloup               0.13.1
colour              0.1.5
contourpy           1.1.1
cycler              0.12.1
decorator           5.1.1
fonttools           4.43.1
glcontext           2.4.0
idna                3.4
importlib-resources 6.1.0
isosurfaces         0.1.0
kiwisolver          1.4.5
manim               0.17.3
ManimPango          0.4.4
mapbox-earcut       1.0.1
markdown-it-py      3.0.0
matplotlib          3.8.0
mdurl               0.1.2
moderngl            5.8.2
moderngl-window     2.4.4
multipledispatch    1.0.0
networkx            2.8.8
numpy               1.26.0
packaging           23.2
Pillow              9.5.0
pip                 23.2.1
pkg_resources       0.0.0
pycairo             1.25.0
pydub               0.25.1
pyglet              2.0.9
Pygments            2.16.1
pyparsing           3.1.1
pyrr                0.10.3
python-dateutil     2.8.2
requests            2.31.0
rich                13.6.0
scipy               1.11.3
screeninfo          0.8.1
setuptools          44.1.1
six                 1.16.0
skia-pathops        0.7.4
srt                 3.5.3
svgelements         1.9.6
tqdm                4.66.1
urllib3             2.0.6
watchdog            2.3.1
zipp                3.17.0
LaTeX details
  • LaTeX distribution: TeX Live 2020/Debian
  • Installed LaTeX packages:
    On debian, so tlmgr does not work. Almost certainly not relevant for this issue anyway.
FFMPEG

Output of ffmpeg -version:

ffmpeg version 4.3.6-0+deb11u1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100
libpostproc    55.  7.100 / 55.  7.100

Additional comments

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions