mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
A few bits of cleanup
This commit is contained in:
parent
932d056ff7
commit
ad4ceb3f1a
3 changed files with 16 additions and 8 deletions
|
@ -100,12 +100,12 @@ class VMobject(Mobject):
|
||||||
#match styles accordingly
|
#match styles accordingly
|
||||||
submobs1, submobs2 = self.submobjects, vmobject.submobjects
|
submobs1, submobs2 = self.submobjects, vmobject.submobjects
|
||||||
if len(submobs1) == 0:
|
if len(submobs1) == 0:
|
||||||
return
|
return self
|
||||||
elif len(submobs2) == 0:
|
elif len(submobs2) == 0:
|
||||||
submobs2 = [vmobject]
|
submobs2 = [vmobject]
|
||||||
for sm1, sm2 in zip(*make_even(submobs1, submobs2)):
|
for sm1, sm2 in zip(*make_even(submobs1, submobs2)):
|
||||||
sm1.match_style(sm2)
|
sm1.match_style(sm2)
|
||||||
return
|
return self
|
||||||
|
|
||||||
def fade(self, darkness = 0.5):
|
def fade(self, darkness = 0.5):
|
||||||
for submob in self.submobject_family():
|
for submob in self.submobject_family():
|
||||||
|
|
|
@ -97,9 +97,6 @@ class Arc(VMobject):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Circle(Arc):
|
class Circle(Arc):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"color" : RED,
|
"color" : RED,
|
||||||
|
@ -511,6 +508,7 @@ class Arrow(Line):
|
||||||
Line.put_start_and_end_on(self, *args, **kwargs)
|
Line.put_start_and_end_on(self, *args, **kwargs)
|
||||||
self.set_tip_points(self.tip, preserve_normal = False)
|
self.set_tip_points(self.tip, preserve_normal = False)
|
||||||
self.set_rectangular_stem_points()
|
self.set_rectangular_stem_points()
|
||||||
|
return self
|
||||||
|
|
||||||
def scale(self, scale_factor, **kwargs):
|
def scale(self, scale_factor, **kwargs):
|
||||||
Line.scale(self, scale_factor, **kwargs)
|
Line.scale(self, scale_factor, **kwargs)
|
||||||
|
@ -520,6 +518,9 @@ class Arrow(Line):
|
||||||
self.set_rectangular_stem_points()
|
self.set_rectangular_stem_points()
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def copy(self):
|
||||||
|
return self.deepcopy()
|
||||||
|
|
||||||
class Vector(Arrow):
|
class Vector(Arrow):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"color" : YELLOW,
|
"color" : YELLOW,
|
||||||
|
|
|
@ -200,14 +200,21 @@ class Axes(VGroup):
|
||||||
self.y_axis.point_to_number(point),
|
self.y_axis.point_to_number(point),
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_graph(self, function, num_graph_points = None, **kwargs):
|
def get_graph(
|
||||||
|
self, function, num_graph_points = None,
|
||||||
|
x_min = None,
|
||||||
|
x_max = None,
|
||||||
|
**kwargs
|
||||||
|
):
|
||||||
kwargs["fill_opacity"] = kwargs.get("fill_opacity", 0)
|
kwargs["fill_opacity"] = kwargs.get("fill_opacity", 0)
|
||||||
kwargs["num_anchor_points"] = \
|
kwargs["num_anchor_points"] = \
|
||||||
num_graph_points or self.default_num_graph_points
|
num_graph_points or self.default_num_graph_points
|
||||||
|
x_min = x_min or self.x_min
|
||||||
|
x_max = x_max or self.x_max
|
||||||
graph = ParametricFunction(
|
graph = ParametricFunction(
|
||||||
lambda t : self.coords_to_point(t, function(t)),
|
lambda t : self.coords_to_point(t, function(t)),
|
||||||
t_min = self.x_min,
|
t_min = x_min,
|
||||||
t_max = self.x_max,
|
t_max = x_max,
|
||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
graph.underlying_function = function
|
graph.underlying_function = function
|
||||||
|
|
Loading…
Add table
Reference in a new issue