Skip to content

Commit

Permalink
fixed broken test and Arrow3D
Browse files Browse the repository at this point in the history
  • Loading branch information
SirJamesClarkMaxwell committed Dec 30, 2024
1 parent ca96427 commit 7b81730
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
4 changes: 2 additions & 2 deletions manim/mobject/three_d/three_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
25 changes: 25 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -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()
9 changes: 8 additions & 1 deletion tests/test_graphical_units/test_threed.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

0 comments on commit 7b81730

Please sign in to comment.