ManimCommunity / manim

A community-maintained Python framework for creating mathematical animations.
https://www.manim.community
MIT License
25.13k stars 1.76k forks source link

Bugs with ThreeDCamera #1378

Closed suhailsherif closed 3 years ago

suhailsherif commented 3 years ago

I have been working with ThreeDCamera over the past few days and have encountered a number of bugs.

Description of bug / unexpected behavior

  1. The simplest bug is just another occurrence of #669 wherein one gets the error

    AttributeError: 'ThreeDCamera' object has no attribute 'extract_mobject_family_members'

when one tries to remove_fixed_orientation_mobjects or remove_fixed_in_frame_mobjects. The fix is quite straightforward so instead of providing details of this bug, for now I will move on to the more involved bugs.

  1. This bug is the same as #875 wherein calling self.move_camera with angles and frame_center does not result in the frame_center actually going to the center of the scene.

  2. When calling self.move_camera with only frame_center as an argument, the animation does not play at all. Only when the animation is done does the scene reflect the fact that frame_center has moved, and even then bug 2 kicks in and the frame_center is not in the correct place.

  3. A black dot appears and I think it sometimes moves where frame_center ought to be, not sure about it though.

Expected behavior

  1. No error should be thrown.
  2. frame_center should move to the center of the scene.
  3. The animation should play with the scene smoothly moving.
  4. frame_center should not actually be a visible component of the scene.

How to reproduce the issue

Code for reproducing the problem In the code below, at least something plays in the first move_camera although it does not take the first dot to the center of the screen. In the second move_camera nothing plays and the scene updates a bit when the subsequent wait is called. ```py class ThreeDIssues(ThreeDScene): def construct(self): cube = Cube() self.play(Animation(cube)) should_be_center = np.array([2,0,0]) self.add(Dot(point=should_be_center),Dot(point=2*should_be_center)) self.move_camera(phi=-10*DEGREES,frame_center=should_be_center) self.wait() self.move_camera(frame_center=2*should_be_center) self.wait() ```

Additional media files

Images/GIFs https://user-images.githubusercontent.com/470168/115444571-5b5fc680-a232-11eb-8869-373f6747cfa4.mp4

System specifications

System Details - OS (with version, e.g Windows 10 v2004 or macOS 10.15 (Catalina)): Ubuntu 20.04 - RAM: 8 GB - Python version (`python/py/python3 --version`): Python 3.8.5 - Installed modules (provide output from `pip list`): ``` Package Version ----------------------- -------------------- apsw 3.28.0.post1 apturl 0.5.2 astroid 2.4.2 attrs 20.3.0 backcall 0.2.0 bcrypt 3.1.7 beautifulsoup4 4.9.3 blinker 1.4 Brlapi 0.7.0 cairocffi 1.2.0 certifi 2019.11.28 cffi 1.14.4 chardet 3.0.4 check50 3.2.0 Click 7.0 colorama 0.4.3 colour 0.1.5 command-not-found 0.3 commonmark 0.9.1 cryptography 2.8 css-parser 1.0.4 cssselect 1.1.0 cssutils 1.0.2 cupshelpers 1.0 cycler 0.10.0 dbus-python 1.2.16 decorator 4.4.2 defer 1.0.6 distro 1.4.0 distro-info 0.23ubuntu1 dnspython 1.16.0 duplicity 0.8.12.0 entrypoints 0.3 evdev 1.3.0 fasteners 0.14.1 feedparser 5.2.1 future 0.18.2 glcontext 2.3.3 html2text 2020.1.16 html5-parser 0.4.9 html5lib 1.0.1 httplib2 0.14.0 idna 2.8 ifaddr 0.1.6 ipython 7.22.0 ipython-genutils 0.2.0 isort 5.6.4 jedi 0.18.0 jellyfish 0.8.2 Jinja2 2.11.2 keyring 18.0.1 kiwisolver 1.3.1 language-selector 0.1 launchpadlib 1.10.13 lazr.restfulclient 0.14.2 lazr.uri 1.0.3 lazy-object-proxy 1.4.3 lib50 2.0.9 lockfile 0.12.2 louis 3.12.0 lxml 4.5.0 macaroonbakery 1.3.1 Mako 1.1.0 manim 0.5.0 manimce 0.1.1 manimgl 1.0.0 ManimPango 0.2.4 mapbox-earcut 0.12.10 Markdown 3.1.1 MarkupSafe 1.1.0 matplotlib 3.3.3 mccabe 0.6.1 mechanize 0.4.5 moderngl 5.6.4 moderngl-window 2.3.0 monotonic 1.5 mpmath 1.2.1 msgpack 0.6.2 multipledispatch 0.6.0 netifaces 0.10.4 networkx 2.5 nose 1.3.7 numpy 1.19.4 oauthlib 3.1.0 olefile 0.46 packaging 20.3 pangocairocffi 0.4.0 pangocffi 0.8.0 paramiko 2.6.0 parso 0.8.2 pexpect 4.6.0 pickleshare 0.7.5 Pillow 7.0.0 pip 20.0.2 progressbar 2.5 prompt-toolkit 3.0.18 protobuf 3.6.1 pycairo 1.20.0 pychm 0.8.6 pycparser 2.20 pycups 1.9.73 pydub 0.24.1 pyglet 1.5.15 Pygments 2.7.3 PyGObject 3.36.0 PyJWT 1.7.1 pylint 2.6.0 pymacaroons 0.13.0 PyNaCl 1.3.0 PyOpenGL 3.1.5 pyparsing 2.4.7 PyQt5 5.14.1 PyQtWebEngine 5.14.0 pyRFC3339 1.1 pyrr 0.10.3 python-apt 2.0.0+ubuntu0.20.4.4 python-dateutil 2.7.3 python-debian 0.1.36ubuntu1 python-magic 0.4.16 pytz 2019.3 pyxattr 0.6.1 pyxdg 0.26 PyYAML 5.3.1 regex 2019.8.19 reportlab 3.5.34 repoze.lru 0.7 requests 2.22.0 requests-unixsocket 0.2.0 rich 6.2.0 Routes 2.4.1 scipy 1.5.4 screen-resolution-extra 0.0.0 screeninfo 0.6.7 SecretStorage 2.3.1 setproctitle 1.1.10 setuptools 45.2.0 simplejson 3.16.0 sip 4.19.21 six 1.14.0 soupsieve 2.1 sympy 1.7.1 systemd-python 234 termcolor 1.1.0 toml 0.10.2 tqdm 4.54.1 traitlets 5.0.5 typing-extensions 3.7.4.3 ubuntu-advantage-tools 20.3 ubuntu-drivers-common 0.0.0 ufw 0.36 unattended-upgrades 0.1 urllib3 1.25.8 usb-creator 0.3.7 validators 0.18.2 wadllib 1.3.3 wcwidth 0.2.5 webencodings 0.5.1 WebOb 1.8.5 wheel 0.34.2 wrapt 1.12.1 xkit 0.0.0 youtube-dl 2020.3.24 zeroconf 0.24.4 ```
FFMPEG Output of `ffmpeg -version`: ``` ffmpeg version 4.2.4-1ubuntu0.1 ```

Additional comments

GitHub4Oli commented 3 years ago

issue still exists in 0.8.0

Line 404 of manim/camera/three_d_camera.py needs to be changed from: for mobject in self.extract_mobject_family_members(mobjects): to: for mobject in extract_mobject_family_members(mobjects):

Nufflee commented 3 years ago

2., 3. and 4. are still not fixed in 0.8.0.

suhailsherif commented 3 years ago

Fixed in PR #1821