mirror of
https://github.com/3b1b/manim.git
synced 2025-08-21 05:44:04 +00:00
Added some more functionality to Axes
This commit is contained in:
parent
42b11d284c
commit
f223ffa772
1 changed files with 9 additions and 0 deletions
|
@ -175,6 +175,12 @@ class Axes(VGroup):
|
|||
y_axis_projection = self.y_axis.number_to_point(y)
|
||||
return x_axis_projection + y_axis_projection - origin
|
||||
|
||||
def point_to_coords(self, point):
|
||||
return (
|
||||
self.x_axis.point_to_number(point),
|
||||
self.y_axis.point_to_number(point),
|
||||
)
|
||||
|
||||
def get_graph(self, function, num_graph_points = 40, **kwargs):
|
||||
kwargs["fill_opacity"] = kwargs.get("fill_opacity", 0)
|
||||
graph = VMobject(**kwargs)
|
||||
|
@ -185,6 +191,9 @@ class Axes(VGroup):
|
|||
graph.underlying_function = function
|
||||
return graph
|
||||
|
||||
def input_to_graph_point(self, x, graph):
|
||||
return self.coords_to_point(x, graph.underlying_function(x))
|
||||
|
||||
class ThreeDAxes(Axes):
|
||||
CONFIG = {
|
||||
"x_min" : -5.5,
|
||||
|
|
Loading…
Add table
Reference in a new issue