Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

removed BezierSpline form gallery (#1218)

kolibril13c798f152b035
diff --git a/docs/source/examples.rst b/docs/source/examples.rst
index 844e8e0ad..3c7b6c2b5 100644
--- a/docs/source/examples.rst
+++ b/docs/source/examples.rst
@@ -97,88 +97,6 @@ Basic Concepts
image.background_rectangle = SurroundingRectangle(image, GREEN)
self.add(image, image.background_rectangle)
-.. manim:: BezierSpline
- :save_last_frame:
- :ref_classes: Line VGroup
- :ref_methods: VMobject.add_cubic_bezier_curve
-
- class BezierSpline(Scene):
- def construct(self):
- np.random.seed(42)
- area = 4
-
- x1 = np.random.randint(-area, area)
- y1 = np.random.randint(-area, area)
- p1 = np.array([x1, y1, 0])
- destination_dot1 = Dot(point=p1).set_color(BLUE)
-
- x2 = np.random.randint(-area, area)
- y2 = np.random.randint(-area, area)
- p2 = np.array([x2, y2, 0])
- destination_dot2 = Dot(p2).set_color(RED)
-
- deltaP = p1 - p2
- deltaPNormalized = deltaP / get_norm(deltaP)
-
- theta = np.radians(90)
- r = np.array(
- (
- (np.cos(theta), -np.sin(theta), 0),
- (np.sin(theta), np.cos(theta), 0),
- (0, 0, 0),
- )
- )
- senk = r.dot(deltaPNormalized)
- offset = 0.1
- offset_along = 0.5
- offset_connect = 0.25
-
- dest_line1_point1 = p1 + senk * offset - deltaPNormalized * offset_along
- dest_line1_point2 = p2 + senk * offset + deltaPNormalized * offset_along
- dest_line2_point1 = p1 - senk * offset - deltaPNormalized * offset_along
- dest_line2_point2 = p2 - senk * offset + deltaPNormalized * offset_along
- s1 = p1 - offset_connect * deltaPNormalized
- s2 = p2 + offset_connect * deltaPNormalized
- dest_line1 = Line(dest_line1_point1, dest_line1_point2)
- dest_line2 = Line(dest_line2_point1, dest_line2_point2)
-
- Lp1s1 = Line(p1, s1)
-
- Lp1s1.add_cubic_bezier_curve(
- s1,
- s1 - deltaPNormalized * 0.1,
- dest_line2_point1 + deltaPNormalized * 0.1,
- dest_line2_point1 - deltaPNormalized * 0.01,
- )
- Lp1s1.add_cubic_bezier_curve(
- s1,
- s1 - deltaPNormalized * 0.1,
- dest_line1_point1 + deltaPNormalized * 0.1,
- dest_line1_point1,
- )
-
- Lp2s2 = Line(p2, s2)
-
- Lp2s2.add_cubic_bezier_curve(
- s2,
- s2 + deltaPNormalized * 0.1,
- dest_line2_point2 - deltaPNormalized * 0.1,
- dest_line2_point2,
- )
- Lp2s2.add_cubic_bezier_curve(
- s2,
- s2 + deltaPNormalized * 0.1,
- dest_line1_point2 - deltaPNormalized * 0.1,
- dest_line1_point2,
- )
-
- mobjects = VGroup(
- Lp1s1, Lp2s2, dest_line1, dest_line2, destination_dot1, destination_dot2
- )
-
- mobjects.scale(2)
- self.add(mobjects)
-
Animations
==========