Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

ThreeDCamera move bug fix

BrendanMartin096ce035f93d
diff --git a/manim/camera/camera.py b/manim/camera/camera.py
index 84bbdc50e..9835f4a41 100644
--- a/manim/camera/camera.py
+++ b/manim/camera/camera.py
@@ -3,7 +3,7 @@
__all__ = ["Camera", "BackgroundColoredVMobjectDisplayer"]
-
+from functools import reduce
import itertools as it
import operator as op
import time
@@ -1039,7 +1039,7 @@ class Camera(object):
"""
# TODO: This seems...unsystematic
- big_sum = op.add(config["default_pixel_height"], config["default_pixel_width"])
+ big_sum = op.add(config["pixel_height"], config["pixel_width"])
this_sum = op.add(self.pixel_height, self.pixel_width)
factor = fdiv(big_sum, this_sum)
return 1 + (thickness - 1) / factor
diff --git a/manim/scene/three_d_scene.py b/manim/scene/three_d_scene.py
index 5065899f5..f35ee0a47 100644
--- a/manim/scene/three_d_scene.py
+++ b/manim/scene/three_d_scene.py
@@ -165,7 +165,7 @@ class ThreeDScene(Scene):
anims.append(ApplyMethod(tracker.set_value, value, **kwargs))
if frame_center is not None:
anims.append(
- ApplyMethod(self.renderer.camera.frame_center.move_to, frame_center)
+ ApplyMethod(self.renderer.camera._frame_center.move_to, frame_center)
)
self.play(*anims + added_anims)
diff --git a/tests/control_data/graphical_units_data/threed/CameraMoveTest.npz b/tests/control_data/graphical_units_data/threed/CameraMoveTest.npz
index 7c4dcd197..4d7054c93 100644
Binary files a/tests/control_data/graphical_units_data/threed/CameraMoveTest.npz and b/tests/control_data/graphical_units_data/threed/CameraMoveTest.npz differ
diff --git a/tests/test_graphical_units/test_threed.py b/tests/test_graphical_units/test_threed.py
index ce7cc8ae3..83865cd41 100644
--- a/tests/test_graphical_units/test_threed.py
+++ b/tests/test_graphical_units/test_threed.py
@@ -24,7 +24,7 @@ class CameraMoveTest(ThreeDScene):
def construct(self):
cube = Cube()
self.play(Animation(cube))
- self.move_camera(phi=PI / 4, theta=PI / 4)
+ self.move_camera(phi=PI / 4, theta=PI / 4, frame_center=[0, 0, -1])
class AmbientCameraMoveTest(ThreeDScene):