From a4bf17b7900e26e20e93fda767bec53351fa7c94 Mon Sep 17 00:00:00 2001 From: Sir James Clark Maxwell <71722499+SirJamesClarkMaxwell@users.noreply.github.com> Date: Mon, 30 Dec 2024 18:18:40 +0100 Subject: [PATCH] fixed problem with type conversions in Line3D --- manim/mobject/three_d/three_dimensions.py | 4 ++++ tests/test_graphical_units/test_threed.py | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/manim/mobject/three_d/three_dimensions.py b/manim/mobject/three_d/three_dimensions.py index 5732ebb98c..e8dd8d8e67 100644 --- a/manim/mobject/three_d/three_dimensions.py +++ b/manim/mobject/three_d/three_dimensions.py @@ -926,6 +926,10 @@ def __init__( ): self.thickness = thickness self.resolution = (2, resolution) if isinstance(resolution, int) else resolution + + start = np.array(start,np.float64) + end = np.array(end,np.float64) + self.set_start_and_end_attrs(start, end, **kwargs) if color is not None: self.set_color(color) diff --git a/tests/test_graphical_units/test_threed.py b/tests/test_graphical_units/test_threed.py index b6079e5e4c..0d0bb659b5 100644 --- a/tests/test_graphical_units/test_threed.py +++ b/tests/test_graphical_units/test_threed.py @@ -172,3 +172,10 @@ def test_get_start_and_end_Arrow3d(): assert np.allclose( arrow.get_end(), end, atol=0.01 ), "end points of Arrow3D do not match" + +def test_type_conversion_in_Line3D(): + start,end = [0,0,0],[1,1,1] + line = Line3D(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