Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

fixed ZeroDivisionError in manim/mobject/three_dimensions.py (#2392)

Vectozavr7d184ab346d4
diff --git a/manim/mobject/three_dimensions.py b/manim/mobject/three_dimensions.py
index 5b2679963..b45995dd7 100644
--- a/manim/mobject/three_dimensions.py
+++ b/manim/mobject/three_dimensions.py
@@ -516,7 +516,10 @@ class Cone(Surface):
x, y, z = self.direction
r = np.sqrt(x ** 2 + y ** 2 + z ** 2)
- theta = np.arccos(z / r)
+ if r > 0:
+ theta = np.arccos(z / r)
+ else:
+ theta = 0
if x == 0:
if y == 0: # along the z axis
@@ -644,7 +647,10 @@ class Cylinder(Surface):
x, y, z = self.direction
r = np.sqrt(x ** 2 + y ** 2 + z ** 2)
- theta = np.arccos(z / r)
+ if r > 0:
+ theta = np.arccos(z / r)
+ else:
+ theta = 0
if x == 0:
if y == 0: # along the z axis