Skip to content

Commit

Permalink
fixed problem with type conversions in Line3D
Browse files Browse the repository at this point in the history
  • Loading branch information
SirJamesClarkMaxwell committed Dec 30, 2024
1 parent dbad8a8 commit a4bf17b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions manim/mobject/three_d/three_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions tests/test_graphical_units/test_threed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit a4bf17b

Please sign in to comment.