Added some more functionality to Axes

This commit is contained in:
Grant Sanderson
2018-01-16 09:44:51 -08:00
parent 42b11d284c
commit f223ffa772

View File

@ -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,