Skip to content

Commit

Permalink
general fixes
Browse files Browse the repository at this point in the history
fixed added utils (i.e., Incomplete ordering and Explicit returns mixed with implicit), added :quality: high to docstrings, made ConvexHullExample determined
  • Loading branch information
JayGupta797 committed Sep 8, 2024
1 parent 9bf9360 commit b627556
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
3 changes: 3 additions & 0 deletions manim/mobject/geometry/labeled.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Label(VGroup):
--------
.. manim:: LabelExample
:save_last_frame:
:quality: high
class LabelExample(Scene):
def construct(self):
Expand Down Expand Up @@ -250,6 +251,7 @@ class LabeledPolygram(Polygram):
--------
.. manim:: LabeledPolygramExample
:save_last_frame:
:quality: high
class LabeledPolygramExample(Scene):
def construct(self):
Expand Down Expand Up @@ -288,6 +290,7 @@ def construct(self):
.. manim:: LabeledCountryExample
:save_last_frame:
:quality: high
import requests
import json
Expand Down
15 changes: 13 additions & 2 deletions manim/mobject/geometry/polygram.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions manim/utils/polylabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
3 changes: 2 additions & 1 deletion manim/utils/qhull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Check notice

Code scanning / CodeQL

Explicit returns mixed with implicit (fall through) returns Note

Mixing implicit and explicit returns may indicate an error as implicit returns always return None.
num, dim = points.shape
Expand Down

0 comments on commit b627556

Please sign in to comment.