From 81dde53f5a06850a077567b9364a10fb322707dc Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Tue, 4 Feb 2020 15:26:39 -0800 Subject: [PATCH] Get rid of various PMobject types --- manimlib/mobject/types/point_cloud_mobject.py | 58 ------------------- 1 file changed, 58 deletions(-) diff --git a/manimlib/mobject/types/point_cloud_mobject.py b/manimlib/mobject/types/point_cloud_mobject.py index f8276382..c4edf9fc 100644 --- a/manimlib/mobject/types/point_cloud_mobject.py +++ b/manimlib/mobject/types/point_cloud_mobject.py @@ -4,9 +4,7 @@ from manimlib.utils.bezier import interpolate from manimlib.utils.color import color_gradient from manimlib.utils.color import color_to_rgba from manimlib.utils.color import rgba_to_color -from manimlib.utils.config_ops import digest_config from manimlib.utils.iterables import stretch_array_to_length -from manimlib.utils.space_ops import get_norm class PMobject(Mobject): @@ -185,42 +183,6 @@ class PMobject(Mobject): setattr(self, attr, partial_array) -# TODO, Make the two implementations bellow non-redundant -class Mobject1D(PMobject): - CONFIG = { - "density": DEFAULT_POINT_DENSITY_1D, - } - - def __init__(self, **kwargs): - digest_config(self, kwargs) - self.epsilon = 1.0 / self.density - Mobject.__init__(self, **kwargs) - - def add_line(self, start, end, color=None): - start, end = list(map(np.array, [start, end])) - length = get_norm(end - start) - if length == 0: - points = [start] - else: - epsilon = self.epsilon / length - points = [ - interpolate(start, end, t) - for t in np.arange(0, 1, epsilon) - ] - self.add_points(points, color=color) - - -class Mobject2D(PMobject): - CONFIG = { - "density": DEFAULT_POINT_DENSITY_2D, - } - - def __init__(self, **kwargs): - digest_config(self, kwargs) - self.epsilon = 1.0 / self.density - Mobject.__init__(self, **kwargs) - - class PGroup(PMobject): def __init__(self, *pmobs, **kwargs): if not all([isinstance(m, PMobject) for m in pmobs]): @@ -229,26 +191,6 @@ class PGroup(PMobject): self.add(*pmobs) -class PointCloudDot(Mobject1D): - CONFIG = { - "radius": 0.075, - "stroke_width": 2, - "density": DEFAULT_POINT_DENSITY_1D, - "color": YELLOW, - } - - def __init__(self, center=ORIGIN, **kwargs): - Mobject1D.__init__(self, **kwargs) - self.shift(center) - - def generate_points(self): - self.add_points([ - r * (np.cos(theta) * RIGHT + np.sin(theta) * UP) - for r in np.arange(0, self.radius, self.epsilon) - for theta in np.arange(0, 2 * np.pi, self.epsilon / r) - ]) - - class Point(PMobject): CONFIG = { "color": BLACK,