mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Docs: Fix TangentialArc example and add quadrant visualization (codeberg-mirror/#1)
## Overview: What does this pull request change? This PR fixes the documentation for `TangentialArc`. 1. It replaces the static code block in the `TangentialArc` example with the `.. manim::` directive, allowing the example image/video to actually render in the documentation. 2. It adds a new second example scene, `TangentialArcCorners`, which visually demonstrates how the `corner` parameter (e.g., `(1,1)`, `(-1,1)`) affects the arc's orientation. ## Motivation and Explanation: Why and how do your changes improve the library? Previously, the `TangentialArc` example was hidden inside a standard code block, so users could not see what the output looked like. Additionally, the `corner` parameter is complex to visualize mentally. The new `TangentialArcCorners` scene provides a clear visual reference for all four possible quadrant configurations, making the class much easier to learn. ## Links to added or changed documentation pages N/A ## Further Information and Comments I have tested these changes locally and verified that the images generate correctly. I am submitting this to the Codeberg mirror as per the current guidance regarding the GitHub incident. **Visual Proof of the new example:** I have attached the image ## Reviewer Checklist - [ ] The PR title is descriptive enough for the changelog, and the PR is labeled correctly - [ ] If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section - [ ] If applicable: newly added functions and classes are tested Reviewed-on: https://codeberg.org/ManimCommunity/manim/pulls/1 Reviewed-by: Benjamin Hackl <behackl@noreply.codeberg.org> Co-authored-by: TahaShams <01-134222-153@student.bahria.edu.pk> Co-committed-by: TahaShams <01-134222-153@student.bahria.edu.pk>
This commit is contained in:
parent
d60154d024
commit
ef0cf2a34d
1 changed files with 29 additions and 2 deletions
|
|
@ -505,9 +505,10 @@ class TangentialArc(ArcBetweenPoints):
|
|||
You can choose any of the 4 possible corner arcs via the `corner` tuple.
|
||||
corner = (s1, s2) where each si is ±1 to control direction along each line.
|
||||
|
||||
Example
|
||||
-------
|
||||
Examples
|
||||
--------
|
||||
.. manim:: TangentialArcExample
|
||||
:save_last_frame:
|
||||
|
||||
class TangentialArcExample(Scene):
|
||||
def construct(self):
|
||||
|
|
@ -518,6 +519,32 @@ class TangentialArc(ArcBetweenPoints):
|
|||
|
||||
arc = TangentialArc(line1, line2, radius=2.25, corner=(1, 1), color=TEAL)
|
||||
self.add(arc, line1, line2)
|
||||
|
||||
The following example shows all four possible corner configurations:
|
||||
|
||||
.. manim:: TangentialArcCorners
|
||||
:save_last_frame:
|
||||
|
||||
class TangentialArcCorners(Scene):
|
||||
def construct(self):
|
||||
# Create two intersecting lines
|
||||
line1 = DashedLine(start=3 * LEFT, end=3 * RIGHT, color=GREY)
|
||||
line2 = DashedLine(start=3 * UP, end=3 * DOWN, color=GREY)
|
||||
|
||||
# All four corner configurations with different colors
|
||||
arc_pp = TangentialArc(line1, line2, radius=1.5, corner=(1, 1), color=RED)
|
||||
arc_pn = TangentialArc(line1, line2, radius=1.5, corner=(1, -1), color=GREEN)
|
||||
arc_np = TangentialArc(line1, line2, radius=1.5, corner=(-1, 1), color=BLUE)
|
||||
arc_nn = TangentialArc(line1, line2, radius=1.5, corner=(-1, -1), color=YELLOW)
|
||||
|
||||
# Labels for each arc
|
||||
label_pp = Text("(1,1)", font_size=24, color=RED).next_to(arc_pp, UR, buff=0.1)
|
||||
label_pn = Text("(1,-1)", font_size=24, color=GREEN).next_to(arc_pn, DR, buff=0.1)
|
||||
label_np = Text("(-1,1)", font_size=24, color=BLUE).next_to(arc_np, UL, buff=0.1)
|
||||
label_nn = Text("(-1,-1)", font_size=24, color=YELLOW).next_to(arc_nn, DL, buff=0.1)
|
||||
|
||||
self.add(line1, line2, arc_pp, arc_pn, arc_np, arc_nn)
|
||||
self.add(label_pp, label_pn, label_np, label_nn)
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue