From b627556fe6a4023ce783437df01ef14ec65d134f Mon Sep 17 00:00:00 2001 From: Jay Gupta <66860950+JayGupta797@users.noreply.github.com> Date: Sun, 8 Sep 2024 15:48:36 -0700 Subject: [PATCH] general fixes fixed added utils (i.e., Incomplete ordering and Explicit returns mixed with implicit), added :quality: high to docstrings, made ConvexHullExample determined --- manim/mobject/geometry/labeled.py | 3 +++ manim/mobject/geometry/polygram.py | 15 +++++++++++++-- manim/utils/polylabel.py | 6 ++++++ manim/utils/qhull.py | 3 ++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/manim/mobject/geometry/labeled.py b/manim/mobject/geometry/labeled.py index 02194f48b4..36120c08d8 100644 --- a/manim/mobject/geometry/labeled.py +++ b/manim/mobject/geometry/labeled.py @@ -42,6 +42,7 @@ class Label(VGroup): -------- .. manim:: LabelExample :save_last_frame: + :quality: high class LabelExample(Scene): def construct(self): @@ -250,6 +251,7 @@ class LabeledPolygram(Polygram): -------- .. manim:: LabeledPolygramExample :save_last_frame: + :quality: high class LabeledPolygramExample(Scene): def construct(self): @@ -288,6 +290,7 @@ def construct(self): .. manim:: LabeledCountryExample :save_last_frame: + :quality: high import requests import json diff --git a/manim/mobject/geometry/polygram.py b/manim/mobject/geometry/polygram.py index df849af89c..5d9fcc9466 100644 --- a/manim/mobject/geometry/polygram.py +++ b/manim/mobject/geometry/polygram.py @@ -784,11 +784,22 @@ class ConvexHull(Polygram): -------- .. manim:: ConvexHullExample :save_last_frame: + :quality: high class ConvexHullExample(Scene): def construct(self): - points = np.random.uniform(low=-3, high=3, size=(100, 3)) - points[:,2] = 0 + points = [ + [-2.35, -2.25, 0], + [1.65, -2.25, 0], + [2.65, -0.25, 0], + [1.65, 1.75, 0], + [-0.35, 2.75, 0], + [-2.35, 0.75, 0], + [-0.35, -1.25, 0], + [0.65, -0.25, 0], + [-1.35, 0.25, 0], + [0.15, 0.75, 0] + ] hull = ConvexHull(*points, color=BLUE) dots = VGroup(*[Dot(point) for point in points]) self.add(hull) diff --git a/manim/utils/polylabel.py b/manim/utils/polylabel.py index 5f22153f10..81e26b6f3f 100644 --- a/manim/utils/polylabel.py +++ b/manim/utils/polylabel.py @@ -67,6 +67,12 @@ def __lt__(self, other): def __gt__(self, other): return self.d > other.d + def __le__(self, other): + return self.d <= other.d + + def __ge__(self, other): + return self.d >= other.d + def PolyLabel(rings, precision=1): """Find the pole of inaccessibility using a grid approach.""" diff --git a/manim/utils/qhull.py b/manim/utils/qhull.py index c56df3481e..d13c551630 100644 --- a/manim/utils/qhull.py +++ b/manim/utils/qhull.py @@ -124,7 +124,8 @@ def _recursive_horizon(self, eye, facet, horizon): ): horizon.boundary.append(subfacet) return 1 - return 0 + else: + return 0 def build(self, points): num, dim = points.shape