Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Simple 3D axes

Grant Sanderson97a563abc073
diff --git a/topics/number_line.py b/topics/number_line.py
index e8578d189..05ee0f48d 100644
--- a/topics/number_line.py
+++ b/topics/number_line.py
@@ -123,13 +123,21 @@ class UnitInterval(NumberLine):
class Axes(VGroup):
CONFIG = {
- "propogate_style_to_family" : True
+ "propogate_style_to_family" : True,
+ "three_d" : True,
+ "color" : LIGHT_GREY
}
def __init__(self, **kwargs):
- VGroup.__init__(self)
+ digest_config(self, kwargs)
+ parts = []
self.x_axis = NumberLine(**kwargs)
self.y_axis = NumberLine(**kwargs).rotate(np.pi/2)
- self.add(self.x_axis, self.y_axis)
+ parts = [self.x_axis, self.y_axis]
+ if self.three_d:
+ self.z_axis = NumberLine(**kwargs)
+ self.z_axis.rotate(np.pi/2, UP)
+ parts.append(self.z_axis)
+ VGroup.__init__(self, *parts, **kwargs)
class NumberPlane(VMobject):
CONFIG = {