Skip to content

Commit aa75e13

Browse files
committed
minor doc formatting changes
1 parent 38ab914 commit aa75e13

File tree

1 file changed

+52
-46
lines changed

1 file changed

+52
-46
lines changed

manim/mobject/geometry.py

Lines changed: 52 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -888,17 +888,19 @@ def __init__(self, n=6, **kwargs):
888888
class ArcPolygon(VMobject):
889889
"""A generalized polygon allowing for points to be connected with arcs.
890890
891-
This version tries to stick close to the way :class:`Polygon` is used. Points can be
892-
passed to it directly which are used to generate the according arcs
891+
This version tries to stick close to the way :class:`Polygon` is used. Points
892+
can be passed to it directly which are used to generate the according arcs
893893
(using :class:`ArcBetweenPoints`). An angle or radius can be passed to it to
894-
use across all arcs, but to configure arcs individually an arc_config list has to be
895-
passed with the syntax explained below.
894+
use across all arcs, but to configure arcs individually an ``arc_config`` list
895+
has to be passed with the syntax explained below.
896896
897-
Two instances of :class:`ArcPolygon` can be transformed properly into one another as
898-
well. Be advised that any arc initialized with ``angle=0`` will actually be
899-
a straight line, so if a straight section should seamlessly
900-
transform into an arced section or vice versa, initialize the straight section
901-
with a negligible angle instead (such as ``angle=0.0001``).
897+
.. tip::
898+
899+
Two instances of :class:`ArcPolygon` can be transformed properly into one
900+
another as well. Be advised that any arc initialized with ``angle=0``
901+
will actually be a straight line, so if a straight section should seamlessly
902+
transform into an arced section or vice versa, initialize the straight section
903+
with a negligible angle instead (such as ``angle=0.0001``).
902904
903905
There is an alternative version (:class:`ArcPolygonFromArcs`) that is instantiated
904906
with pre-defined arcs.
@@ -909,7 +911,7 @@ class ArcPolygon(VMobject):
909911
910912
Parameters
911913
----------
912-
*vertices : Union[:class:`list`, :class:`np.array`]
914+
vertices : Union[:class:`list`, :class:`np.array`]
913915
A list of vertices, start and end points for the arc segments.
914916
angle : :class:`float`
915917
The angle used for constructing the arcs. If no other parameters
@@ -922,20 +924,22 @@ class ArcPolygon(VMobject):
922924
arguments to :class:`~.ArcBetweenPoints`. Otherwise, a list
923925
of dictionaries containing values that are passed as keyword
924926
arguments for every individual arc can be passed.
927+
kwargs
928+
Further keyword arguments that are passed to the constructor of
929+
:class:`~.VMobject`.
925930
926931
Attributes
927932
----------
928933
arcs : :class:`list`
929-
The arcs created from the input parameters.
930-
::
934+
The arcs created from the input parameters::
935+
931936
>>> from manim import ArcPolygon
932937
>>> ap = ArcPolygon([0, 0, 0], [2, 0, 0], [0, 2, 0])
933938
>>> ap.arcs
934939
[ArcBetweenPoints, ArcBetweenPoints, ArcBetweenPoints]
935940
936941
Examples
937942
--------
938-
For further examples see :class:`ArcPolygonFromArcs`
939943
940944
.. manim:: SeveralArcPolygons
941945
@@ -955,6 +959,7 @@ def construct(self):
955959
self.play(*[ShowCreation(ap) for ap in [ap1, ap2, ap3, ap4]])
956960
self.wait()
957961
962+
For further examples see :class:`ArcPolygonFromArcs`.
958963
"""
959964

960965
def __init__(self, *vertices, angle=PI / 4, radius=None, arc_config=None, **kwargs):
@@ -993,17 +998,17 @@ def __init__(self, *vertices, angle=PI / 4, radius=None, arc_config=None, **kwar
993998
class ArcPolygonFromArcs(VMobject):
994999
"""A generalized polygon allowing for points to be connected with arcs.
9951000
996-
This version takes in pre-defined arcs to generate the arcpoylgon and introduces
1001+
This version takes in pre-defined arcs to generate the arcpolygon and introduces
9971002
little new syntax. However unlike :class:`Polygon` it can't be created with points
9981003
directly.
9991004
1000-
For proper appearance the passed arcs should usually seamlessly connect:
1001-
[a,b][b,c][c,a]
1005+
For proper appearance the passed arcs should connect seamlessly:
1006+
``[a,b][b,c][c,a]``
10021007
10031008
If there are any gaps between the arcs, those will be filled in
10041009
with straight lines, which can be used deliberately for any straight
10051010
sections. Arcs can also be passed as straight lines such as an arc
1006-
initialized with 'angle=0'.
1011+
initialized with ``angle=0``.
10071012
10081013
Two instances of :class:`ArcPolygon` can be transformed properly into one another as
10091014
well. Be advised that any arc initialized with ``angle=0`` will actually be
@@ -1020,17 +1025,18 @@ class ArcPolygonFromArcs(VMobject):
10201025
10211026
Parameters
10221027
----------
1023-
*arcs : Union[:class:`Arc`, :class:`ArcBetweenPoints`]
1028+
arcs : Union[:class:`Arc`, :class:`ArcBetweenPoints`]
10241029
These are the arcs from which the arcpolygon is assembled.
1025-
**kwargs : Any
1026-
Affects how the ArcPolygon itself is drawn, but doesn't affect
1027-
passed arcs.
1030+
kwargs
1031+
Keyword arguments that are passed to the constructor of
1032+
:class:`~.VMobject`. Affects how the ArcPolygon itself is drawn,
1033+
but doesn't affect passed arcs.
10281034
10291035
Attributes
10301036
----------
10311037
arcs : :class:`list`
1032-
The arcs used to initialize the ArcPolygonFromArcs.
1033-
::
1038+
The arcs used to initialize the ArcPolygonFromArcs::
1039+
10341040
>>> from manim import ArcPolygonFromArcs, Arc, ArcBetweenPoints
10351041
>>> ap = ArcPolygonFromArcs(Arc(), ArcBetweenPoints([1,0,0], [0,1,0]), Arc())
10361042
>>> ap.arcs
@@ -1048,45 +1054,45 @@ class ArcPolygonFromArcs(VMobject):
10481054
for example when it's shifted, and these arcs can be manipulated
10491055
after the arcpolygon has been initialized.
10501056
1051-
Also both the arcs contained in an ArcPolygonFromArcs, as well as the
1052-
arcpolygon itself are drawn, which affects draw time in ShowCreation
1057+
Also both the arcs contained in an :class:`~.ArcPolygonFromArcs`, as well as the
1058+
arcpolygon itself are drawn, which affects draw time in :class:`~.ShowCreation`
10531059
for example. In most cases the arcs themselves don't
10541060
need to be drawn, in which case they can be passed as invisible.
10551061
10561062
.. manim:: ArcPolygonExample
10571063
10581064
class ArcPolygonExample(Scene):
10591065
def construct(self):
1060-
arc_conf = {"stroke_width":0}
1061-
poly_conf = {"stroke_width":10,"stroke_color":BLUE,
1062-
"fill_opacity":1,"color": PURPLE}
1063-
a=[-1,0,0]
1064-
b=[1,0,0]
1065-
c=[0,np.sqrt(3),0]
1066-
arc0=ArcBetweenPoints(a,b,radius=2,**arc_conf)
1067-
arc1=ArcBetweenPoints(b,c,radius=2,**arc_conf)
1068-
arc2=ArcBetweenPoints(c,a,radius=2,**arc_conf)
1069-
reuleaux_tri=ArcPolygonFromArcs(arc0,arc1,arc2,**poly_conf)
1066+
arc_conf = {"stroke_width": 0}
1067+
poly_conf = {"stroke_width": 10, "stroke_color": BLUE,
1068+
"fill_opacity": 1, "color": PURPLE}
1069+
a = [-1, 0, 0]
1070+
b = [1, 0, 0]
1071+
c = [0, np.sqrt(3), 0]
1072+
arc0 = ArcBetweenPoints(a, b, radius=2, **arc_conf)
1073+
arc1 = ArcBetweenPoints(b, c, radius=2, **arc_conf)
1074+
arc2 = ArcBetweenPoints(c, a, radius=2, **arc_conf)
1075+
reuleaux_tri = ArcPolygonFromArcs(arc0, arc1, arc2, **poly_conf)
10701076
self.play(FadeIn(reuleaux_tri))
10711077
self.wait(2)
10721078
1073-
The ArcPolygon itself can also be hidden so that instead only the contained
1079+
The arcpolygon itself can also be hidden so that instead only the contained
10741080
arcs are drawn. This can be used to easily debug arcs or to highlight them.
10751081
10761082
.. manim:: ArcPolygonExample2
10771083
10781084
class ArcPolygonExample2(Scene):
10791085
def construct(self):
1080-
arc_conf = {"stroke_width":3,"stroke_color":BLUE,
1081-
"fill_opacity":0.5,"color": GREEN}
1082-
poly_conf = {"color":None}
1083-
a=[-1,0,0]
1084-
b=[1,0,0]
1085-
c=[0,np.sqrt(3),0]
1086-
arc0=ArcBetweenPoints(a,b,radius=2,**arc_conf)
1087-
arc1=ArcBetweenPoints(b,c,radius=2,**arc_conf)
1088-
arc2 = ArcBetweenPoints(c, a, radius=2, **{"stroke_color":RED})
1089-
reuleaux_tri=ArcPolygonFromArcs(arc0,arc1,arc2,**poly_conf)
1086+
arc_conf = {"stroke_width": 3, "stroke_color": BLUE,
1087+
"fill_opacity": 0.5, "color": GREEN}
1088+
poly_conf = {"color": None}
1089+
a = [-1, 0, 0]
1090+
b = [1, 0, 0]
1091+
c = [0, np.sqrt(3), 0]
1092+
arc0 = ArcBetweenPoints(a, b, radius=2, **arc_conf)
1093+
arc1 = ArcBetweenPoints(b, c, radius=2, **arc_conf)
1094+
arc2 = ArcBetweenPoints(c, a, radius=2, stroke_color=RED)
1095+
reuleaux_tri = ArcPolygonFromArcs(arc0, arc1, arc2, **poly_conf)
10901096
self.play(FadeIn(reuleaux_tri))
10911097
self.wait(2)
10921098

0 commit comments

Comments
 (0)