From 0cef9a1e6197e8f5869be50bf41888fe90332079 Mon Sep 17 00:00:00 2001 From: Bill Xi <86190295+TurkeyBilly@users.noreply.github.com> Date: Sun, 6 Mar 2022 13:54:42 +0800 Subject: [PATCH] Reorganize getters for ParametricCurve --- manimlib/mobject/functions.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/manimlib/mobject/functions.py b/manimlib/mobject/functions.py index 3677a119..d6869bbf 100644 --- a/manimlib/mobject/functions.py +++ b/manimlib/mobject/functions.py @@ -48,6 +48,18 @@ class ParametricCurve(VMobject): self.set_points([self.t_func(t_min)]) return self + def get_t_func(self): + return self.t_func + + def get_function(self): + if hasattr(self, "underlying_function"): + return self.underlying_function + if hasattr(self, "function"): + return self.function + + def get_x_range(self): + if hasattr(self, "x_range"): + return self.x_range class FunctionGraph(ParametricCurve): CONFIG = { @@ -67,12 +79,6 @@ class FunctionGraph(ParametricCurve): super().__init__(parametric_function, self.x_range, **kwargs) - def get_function(self): - return self.function - - def get_point_from_function(self, x): - return self.t_func(x) - class ImplicitFunction(VMobject): CONFIG = {