Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Added filled angle Example (#1245)

kolibril13808c35fa3f31
diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.py
index d669f3342..a0efc3753 100644
--- a/manim/mobject/geometry.py
+++ b/manim/mobject/geometry.py
@@ -2270,6 +2270,27 @@ class Angle(Arc, Elbow):
self.add(
line_list
)
+ .. manim:: FilledAngle
+ :save_last_frame:
+
+ class FilledAngle(Scene):
+ def construct(self):
+ l1 = Line(ORIGIN, 2 * UP + RIGHT).set_color(GREEN)
+ l2 = (
+ Line(ORIGIN, 2 * UP + RIGHT)
+ .set_color(GREEN)
+ .rotate(-20 * DEGREES, about_point=ORIGIN)
+ )
+ norm = l1.get_length()
+ a1 = Angle(l1, l2, other_angle=True, radius=norm - 0.5).set_color(GREEN)
+ a2 = Angle(l1, l2, other_angle=True, radius=norm).set_color(GREEN)
+ q1 = a1.get_points() # save all coordinates of points of angle a1
+ q2 = a2.reverse_direction().get_points() # save all coordinates of points of angle a1 (in reversed direction)
+ pnts = np.concatenate([q1, q2, q1[0].reshape(1, 3)]) # adds points and ensures that path starts and ends at same point
+ mfill = VMobject().set_color(ORANGE)
+ mfill.set_points_as_corners(pnts).set_fill(GREEN, opacity=1)
+ self.add(l1, l2)
+ self.add(mfill)
"""