diff --git a/manim/mobject/three_d/three_dimensions.py b/manim/mobject/three_d/three_dimensions.py index b040e4f6eb..7e2dc5bf0d 100644 --- a/manim/mobject/three_d/three_dimensions.py +++ b/manim/mobject/three_d/three_dimensions.py @@ -1187,8 +1187,8 @@ def __init__( height=height, **kwargs, ) - self.cone.shift(end) - self.end_point = VectorizedPoint(end) + self.cone.shift(np.array(end,np.float64)) + self.end_point = VectorizedPoint(np.array(end,np.float64)) self.add(self.end_point, self.cone) self.set_color(color) diff --git a/test.py b/test.py new file mode 100644 index 0000000000..60ed2ff5c7 --- /dev/null +++ b/test.py @@ -0,0 +1,25 @@ +from manim import * + + +class Example(Scene): + def construct(self): + t = MathTex(r"\int_{a}^{b} f(x) \;dx = F(b) - F(a)") + self.play(Write(t)) + self.wait() + self.play(Unwrite(t)) + self.wait() + + +class Intro(ThreeDScene): + def construct(self): + + v1 = Arrow3D([0, 0, 0], [1, 1, 0]) + + a = Tex("hi").move_to(v1.get_end()) + a.add_updater(lambda m: m.move_to(v1.get_end())) + + self.add(a, v1) + self.play(Rotate(v1)) + +with tempconfig({"quality": "low_quality", "preview": True}): + Intro().render() diff --git a/tests/test_graphical_units/test_threed.py b/tests/test_graphical_units/test_threed.py index 7eaf255af6..3525c48092 100644 --- a/tests/test_graphical_units/test_threed.py +++ b/tests/test_graphical_units/test_threed.py @@ -164,7 +164,7 @@ def param_surface(u, v): def test_get_start_and_end_Arrow3d(): - start, end = ORIGIN, np.array([2, 1, 0]) + start, end = ORIGIN, np.array([2, 1, 0],dtype=np.float64) arrow = Arrow3D(start, end) assert np.allclose( arrow.get_start(), start, atol=0.01 @@ -180,3 +180,10 @@ def test_type_conversion_in_Line3D(): type_table = [type(item) for item in [*line.get_start(), *line.get_end()]] bool_table = [t == np.float64 for t in type_table] assert all(bool_table), "Types of start and end points are not np.float64" + +def test_type_conversion_in_Arrow3D(): + start,end = [0,0,0],[1,1,1] + line = Arrow3D(start,end) + type_table = [type(item) for item in [*line.get_start(),*line.get_end()]] + bool_table = [t == np.float64 for t in type_table] + assert all(bool_table), "Types of start and end points are not np.float64" \ No newline at end of file