mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Fix ThreeDAxes bug
This commit is contained in:
parent
b70e0a0c75
commit
9619ebfd61
1 changed files with 14 additions and 12 deletions
|
@ -36,21 +36,23 @@ class Axes(VGroup):
|
|||
|
||||
def __init__(self, **kwargs):
|
||||
VGroup.__init__(self, **kwargs)
|
||||
x_axis_config = merge_config([
|
||||
self.x_axis_config,
|
||||
{"x_min": self.x_min, "x_max": self.x_max},
|
||||
self.number_line_config,
|
||||
])
|
||||
y_axis_config = merge_config([
|
||||
self.y_axis_config,
|
||||
{"x_min": self.y_min, "x_max": self.y_max},
|
||||
self.number_line_config,
|
||||
])
|
||||
self.x_axis = NumberLine(**x_axis_config)
|
||||
self.y_axis = NumberLine(**y_axis_config)
|
||||
self.x_axis = self.get_axis(
|
||||
self.x_min, self.x_max, self.x_axis_config
|
||||
)
|
||||
self.y_axis = self.get_axis(
|
||||
self.y_min, self.y_max, self.y_axis_config
|
||||
)
|
||||
self.y_axis.rotate(90 * DEGREES, about_point=ORIGIN)
|
||||
self.add(self.x_axis, self.y_axis)
|
||||
|
||||
def get_axis(self, min_val, max_val, axis_config):
|
||||
new_config = merge_config([
|
||||
axis_config,
|
||||
{"x_min": min_val, "x_max": max_val},
|
||||
self.number_line_config,
|
||||
])
|
||||
return NumberLine(**new_config)
|
||||
|
||||
def coords_to_point(self, *coords):
|
||||
origin = self.x_axis.number_to_point(0)
|
||||
result = np.array(origin)
|
||||
|
|
Loading…
Add table
Reference in a new issue