
    lj                       d Z ddlmZ g dZddlZddlZddlmZmZm	Z	m
Z
 ddlZddlT ddlmZ ddlmZmZ dd	lmZmZmZmZmZ dd
lmZ ddlmZmZmZmZm Z m!Z! er8ddl"m#Z# ddl$m%c m&c m'Z' ddl(m)Z) ddl*m+Z+ ddl,m-Z-m.Z. ddl/m0Z0 ddl1m2Z2m3Z3m4Z4m5Z5  G d dee          Z6 G d de6          Z7 G d de7          Z8 G d de8          Z9 G d de8          Z: G d de:          Z; G d d e7          Z< G d! d"e<          Z= G d# d$e=          Z> G d% d&e=          Z? G d' d(e<          Z@ G d) d*e7          ZA G d+ d,eA          ZB G d- d.e<          ZC G d/ d0ee          ZD G d1 d2ee          ZE G d3 d4ee          ZFdS )5av  Mobjects that are curved.

Examples
--------
.. manim:: UsefulAnnotations
    :save_last_frame:

    class UsefulAnnotations(Scene):
        def construct(self):
            m0 = Dot()
            m1 = AnnotationDot()
            m2 = LabeledDot("ii")
            m3 = LabeledDot(MathTex(r"\alpha").set_color(ORANGE))
            m4 = CurvedArrow(2*LEFT, 2*RIGHT, radius= -5)
            m5 = CurvedArrow(2*LEFT, 2*RIGHT, radius= 8)
            m6 = CurvedDoubleArrow(ORIGIN, 2*RIGHT)

            self.add(m0, m1, m2, m3, m4, m5, m6)
            for i, mobj in enumerate(self.mobjects):
                mobj.shift(DOWN * (i-3))

    )annotations)TipableVMobjectArcArcBetweenPointsCurvedArrowCurvedDoubleArrowCircleDotAnnotationDot
LabeledDotEllipseAnnularSectorSectorAnnulusCubicBezier
ArcPolygonArcPolygonFromArcsTangentialArcN)TYPE_CHECKINGAnySelfcast)*)ConvertToOpenGL)VGroupVMobject)BLACKBLUEREDWHITEParsableManimColor)adjacent_pairs)angle_between_vectorsangle_of_vectorcartesian_to_sphericalline_intersectionperpendicular_bisectorrotate_vector)IterableLine)Mobject)SingleStringMathTexTex)Text)Point3DPoint3DLikeQuadraticSplineVector3DLikec                       e Zd ZdZeedfd. fdZ	 	 	 	 	 d/d0dZ	 	 	 	 d1d2dZ	 	 	 d3d4dZ	d5d6dZ
d7dZd7dZd8d Zd8d!Zd9d#Zd9d$Zd:d&Zd;d'Zd<d)Zd<d*Zd< fd+Zd< fd,Zd;d-Z xZS )=r   a  Meant for shared functionality between Arc and Line.
    Functionality can be classified broadly into these groups:

        * Adding, Creating, Modifying tips
            - add_tip calls create_tip, before pushing the new tip
                into the TipableVMobject's list of submobjects
            - stylistic and positional configuration

        * Checking for tips
            - Boolean checks for whether the TipableVMobject has a tip
                and a starting tip

        * Getters
            - Straightforward accessors, returning information pertaining
                to the TipableVMobject instance's tip(s), its length etc
    N
tip_lengthfloatnormal_vectorr3   	tip_styledict | Nonekwargsr   returnNonec                l    || _         || _        ||ni | _         t                      j        di | d S N )r5   r7   r8   super__init__)selfr5   r7   r8   r:   	__class__s        U/home/agentuser/manim-venv/lib/python3.11/site-packages/manim/mobject/geometry/arc.pyrA   zTipableVMobject.__init__d   sG     ",*,5,Ayyr""6"""""    Ftiptips.ArrowTip | None	tip_shapetype[tips.ArrowTip] | Nonefloat | None	tip_widthat_startboolr   c                    ||                      ||||          }n|                     ||           |                     ||           |                     ||           |                     |           | S )zAdds a tip to the TipableVMobject instance, recognising
        that the endpoints might need to be switched if it's
        a 'starting tip' or not.
        )
create_tipposition_tipreset_endpoints_based_on_tipassign_tip_attradd)rB   rF   rH   r5   rK   rL   s         rD   add_tipzTipableVMobject.add_tipr   sx     ;//)ZHMMCCc8,,,))#x888S(+++rE   tips.ArrowTipc                `    |                      |||          }|                     ||           |S )zpStylises the tip, positions it spatially, and returns
        the newly instantiated tip to the caller.
        )get_unpositioned_tiprP   )rB   rH   r5   rK   rL   rF   s         rD   rO   zTipableVMobject.create_tip   s6     ''	:yII#x(((
rE   +tips.ArrowTip | tips.ArrowTriangleFilledTipc                L   ddl m} i }||}||u r-||                                 }|                    d|i           ||                                 }|                                 }|                    ||d           |                    | j                    |dd|i|}|S )zvReturns a tip that has been stylistically configured,
        but has not yet been given a position in space.
        r   ArrowTriangleFilledTipNwidth)
fill_colorstroke_colorlengthr?   )manim.mobject.geometry.tipsr[   get_default_tip_lengthupdate	get_colorr8   )rB   rH   r5   rK   r[   stylecolorrF   s           rD   rW   z$TipableVMobject.get_unpositioned_tip   s     	GFFFFF ".I...  7799	LL'9-...4466J  E5AABBBT^$$$i33z3U33
rE   c                p   |r)|                                  }|                                 }n(|                                 }|                                 }t	          ||z
            }|                    |d         t          z
  |j        z
             t          | d          sxt          j
        t          j        |d                   t          j        |d                    dg          }|                    |d          t          dz  z   |           || _        |                    ||j        z
             |S )N   _init_positioning_axisr      )axis)	get_startget_first_handleget_last_handleget_endr%   rotatePI	tip_anglehasattrnparraysincosrh   shift	tip_point)rB   rF   rL   anchorhandleanglesrj   s          rD   rP   zTipableVMobject.position_tip   s2     	$^^%%F**,,FF))++F\\^^F'88

1INS]*	
 	
 	
 t566 	/8F6!9%%VF1I&&& D JJ
R!V#     +/D'		&3=()))
rE   c                    |                                  dk    r| S |r.|                     |j        |                                            n-|                     |                                 |j                   | S )Nr   )
get_lengthput_start_and_end_onbasern   rk   rB   rF   rL   s      rD   rQ   z,TipableVMobject.reset_endpoints_based_on_tip   so    ??!!K 	B%%ch????%%dnn&6&6AAArE   c                (    |r|| _         n|| _        | S N)	start_tiprF   r   s      rD   rR   zTipableVMobject.assign_tip_attr   s     	 DNNDHrE   c                4    t          | d          o| j        | v S )NrF   )rr   rF   rB   s    rD   has_tipzTipableVMobject.has_tip   s    tU##8D(88rE   c                4    t          | d          o| j        | v S )Nr   )rr   r   r   s    rD   has_start_tipzTipableVMobject.has_start_tip   s    t[))Ddn.DDrE   r   c                   |                                  \  }} |                                             }|                                 r4|                    | j                   |                     | j                   |                                 r4|                    | j                   |                     | j                   |j        r| 	                    ||           |S r   )
get_start_and_endget_group_classr   rS   rF   remover   r   submobjectsr~   )rB   startendresults       rD   pop_tipszTipableVMobject.pop_tips   s    ++--
s'%%''))<<>> 	"JJtx   KK!!! 	(JJt~&&&KK''' 	2%%eS111rE   c                     |                                              }t          | d          r|                    | j                   t          | d          r|                    | j                   |S )zkReturns a VGroup (collection of VMobjects) containing
        the TipableVMObject instance's tips.
        rF   r   )r   rr   rS   rF   r   )rB   r   s     rD   get_tipszTipableVMobject.get_tips   sn     (%%''))4 	!JJtx   4%% 	'JJt~&&&rE   r   c                    |                                  }t          |          dk    rt          d          |d         }|S )zcReturns the TipableVMobject instance's (first) tip,
        otherwise throws an exception.
        r   ztip not found)r   len	Exception)rB   tipsrF   s      rD   get_tipzTipableVMobject.get_tip  s<     }}t99>>O,,, GCJrE   c                    | j         S r   )r5   r   s    rD   ra   z&TipableVMobject.get_default_tip_length  s
    rE   r0   c                     | j         d         }|S )Nrg   points)rB   first_handles     rD   rl   z TipableVMobject.get_first_handle  s     !%ArE   c                     | j         d         }|S )Nr   )rB   last_handles     rD   rm   zTipableVMobject.get_last_handle  s      ${2rE   c                    |                                  r| j                                        S t                                                      S r   )r   rF   rk   r@   rn   rB   rC   s    rD   rn   zTipableVMobject.get_end   s;    <<>> 	%8%%'''77??$$$rE   c                    |                                  r| j                                        S t                                                      S r   )r   r   rk   r@   r   s    rD   rk   zTipableVMobject.get_start&  sA     	'>++---77$$&&&rE   c                    |                                  \  }}t          t          j                            ||z
                      S r   )r   r6   rs   linalgnorm)rB   r   r   s      rD   r}   zTipableVMobject.get_length,  s7    ++--
sRY^^ECK00111rE   )
r5   r6   r7   r3   r8   r9   r:   r   r;   r<   )NNNNF)rF   rG   rH   rI   r5   rJ   rK   rJ   rL   rM   r;   r   )NNNF)
rH   rI   r5   rJ   rK   rJ   rL   rM   r;   rU   )NNN)rH   rI   r5   rJ   rK   rJ   r;   rX   )F)rF   rU   rL   rM   r;   rU   )rF   rU   rL   rM   r;   r   )r;   rM   )r;   r   )r;   r   r;   r6   )r;   r0   )__name__
__module____qualname____doc__DEFAULT_ARROW_TIP_LENGTHOUTrA   rT   rO   rW   rP   rQ   rR   r   r   r   r   r   ra   rl   rm   rn   rk   r}   __classcell__rC   s   @rD   r   r   R   s        & 5&)!%	
# 
# 
# 
# 
# 
# 
#  %)04#'"&    . 15#'"&      15#'"&	    :    <	 	 	 	   9 9 9 9E E E E
   	 	 	 		 	 	 	         % % % % % %' ' ' ' ' '2 2 2 2 2 2 2 2rE   r   )	metaclassc                       e Zd ZdZddedz  defd$ fdZd%dZd%dZe		 d&d'd            Z
d%dZd(d)dZd*d"Zd+d#Z xZS ),r   zA circular arc.

    Examples
    --------
    A simple arc of angle Pi.

    .. manim:: ArcExample
        :save_last_frame:

        class ArcExample(Scene):
            def construct(self):
                self.add(Arc(angle=PI))
          ?r      	   radiusrJ   start_angler6   anglenum_componentsint
arc_centerr1   r:   r   c                    |d}|| _         || _        t          j        |          | _        || _        || _        d| _         t                      j	        di | d S )Nr   Fr?   )
r   r   rs   asarrayr   r   r   _failed_to_get_centerr@   rA   )rB   r   r   r   r   r   r:   rC   s          rD   rA   zArc.__init__@  si     >F,#%:j#9#9&
+0"""6"""""rE   r;   r<   c                    |                                   |                     | j        t                     |                     | j                   d S )Nabout_point)_set_pre_positioned_pointsscaler   ORIGINrw   r   r   s    rD   generate_pointszArc.generate_pointsS  sF    '')))

4;F
333

4?#####rE   c                    |                      t                              | j        | j        | j                             |                     | j        t                     | 	                    | j
                   d S )N)r   r   n_componentsr   )
set_pointsr   _create_quadratic_bezier_pointsr   r   r   r   r   r   rw   r   r   s    rD   init_pointszArc.init_points[  su    //j ,!0 0  	
 	
 	
 	

4;F
333

4?#####rE      r   r2   c           	     n   t          j        d t          j        ||| z   d|z  dz             D                       }| |z  }|dd dxx         t          j        |dz            z  cc<   t          j        d|z  df          }|ddd         |dd d<   |dd d         |dd d<   |dd d         |dd d<   |S )Nc                `    g | ]+}t          j        |          t          j        |          d g,S )r   )rs   rv   ru   .0as     rD   
<listcomp>z7Arc._create_quadratic_bezier_points.<locals>.<listcomp>k  s?        BF1IIq)  rE   ri   rg      r   )rs   rt   linspacerv   zeros)r   r   r   samplesthetar   s         rD   r   z#Arc._create_quadratic_bezier_pointsf  s     ( %'$q(   	
 	
 $1	***1|+Q/00qAvqt!tqt!t}qt!tqt!t}qt!trE   c                    t          j        d t          j        | j        | j        | j        z   | j                  D                       }| j        | j        dz
  z  }t          j        |j                  }|d d df         |d d df<   |d d df          |d d df<   dt          j        |dz            z  }|d d         ||d d         z  z   }|dd          ||dd          z  z
  }| 	                    |d d         |||dd                     d S )Nc                    g | ];}t          j        |          t          z  t          j        |          t          z  z   <S r?   )rs   rv   RIGHTru   UPr   s     rD   r   z2Arc._set_pre_positioned_points.<locals>.<listcomp>  sF        q		E!BF1IIN2  rE   r   r   rg   gUUUUUU?r   r   )
rs   rt   r   r   r   r   r   shapetanset_anchors_and_handles)rB   anchorsd_thetatangent_vectorsfactorhandles1handles2s          rD   r   zArc._set_pre_positioned_points}  sA   ( $$tz1'   	
 	
 * 3c 9:(7=11 '11!(A1!,,,3B3<&?3B3+?"??122;/!""*=!==$$WSbS\8Xwqrr{SSSSSrE   TwarningrM   r0   c                   | j         dd         \  }}}}t          j        ||k              rt          j        |          S ||z
  }||z
  }t	          |t
          dz            }t	          |t
          dz            }		 t          |||z   f|||	z   f          S # t          $ r; |rt          j	        dd           d| _
        t          j        t                    cY S w xY w)zcLooks at the normals to the first two
        anchors, and finds their intersection points
        Nr   )line1line2z+Can't find Arc center, using ORIGIN insteadrg   )
stacklevelT)r   rs   allcopyr(   TAUr&   r   warningswarnr   rt   r   )
rB   r   a1h1h2a2t1t2n1n2s
             rD   get_arc_centerzArc.get_arc_center  s   
 RaRBB6"( 	 72;;"W"W2sQw''2sQw''	$$BR=R"WNNNN 	$ 	$ 	$ Aa    *.D&8F#####	$s   <B ACCpointr   c                Z    |                      ||                                 z
             | S r   )rw   r   )rB   r   s     rD   move_arc_center_tozArc.move_arc_center_to  s*    

54..000111rE   c                    t          t          t          | j        d         |                                 z
            t
          z            S )Nr   )r   r6   r$   r   r   r   r   s    rD   
stop_anglezArc.stop_angle  s>    DKOd.A.A.C.CCDDsJ
 
 	
rE   )r   rJ   r   r6   r   r6   r   r   r   r1   r:   r   r;   r<   )r   r   )r   r6   r   r6   r   r   r;   r2   )T)r   rM   r;   r0   )r   r1   r;   r   r   )r   r   r   r   r   r   rA   r   r   staticmethodr   r   r   r   r   r   r   s   @rD   r   r   1  s
           #Qw"(# # # # # # #&$ $ $ $	$ 	$ 	$ 	$ BC    \,T T T T0$ $ $ $ $8   
 
 
 
 
 
 
 
rE   r   c                  0     e Zd ZdZedz  dfd fdZ xZS )r   a  Inherits from Arc and additionally takes 2 points between which the arc is spanned.

    Example
    -------
    .. manim:: ArcBetweenPointsExample

      class ArcBetweenPointsExample(Scene):
          def construct(self):
              circle = Circle(radius=2, stroke_color=GREY)
              dot_1 = Dot(color=GREEN).move_to([2, 0, 0]).scale(0.5)
              dot_1_text = Tex("(2,0)").scale(0.5).next_to(dot_1, RIGHT).set_color(BLUE)
              dot_2 = Dot(color=GREEN).move_to([0, 2, 0]).scale(0.5)
              dot_2_text = Tex("(0,2)").scale(0.5).next_to(dot_2, UP).set_color(BLUE)
              arc= ArcBetweenPoints(start=2 * RIGHT, end=2 * UP, stroke_color=YELLOW)
              self.add(circle, dot_1, dot_2, dot_1_text, dot_2_text)
              self.play(Create(arc))
    r   Nr   r1   r   r   r6   r   rJ   r:   r   r;   r<   c           	     j   ||| _         |dk     rd}|dz  }nd}t          j                            t          j        |          t          j        |          z
            dz  }||k     rt          d          |t          j        |dz  |dz  z
            z
  }t          j        ||z
  |z            |z  } t                      j	        d	||d| |dk    r3| 
                    t          j        t          t          g                     |                     ||           ||                     d          }	| j        s`t!          t"          t          j                            t          j        |          t          j        |	          z
                      | _         d S t          j        | _         d S d S )
Nr   r   r   ri   z|ArcBetweenPoints called with a radius that is
                            smaller than half the distance between the points.)r   r   F)r   r?   )r   rs   r   r   rt   
ValueErrorsqrtarccosr@   rA   set_points_as_cornersLEFTr   r~   r   r   r   r6   inf)rB   r   r   r   r   r:   signhalfdist
arc_heightcenterrC   s             rD   rA   zArcBetweenPoints.__init__  s     DKzz"y~~bhuoo&EFFJH   R    "'&!)hk*A"B"BBJIv
2f<==DE>e>>v>>>A::&&rxu'>'>???!!%--->(((77F- %"29>>"(5//BHV<L<L*LMM  !f >rE   )r   r1   r   r1   r   r6   r   rJ   r:   r   r;   r<   )r   r   r   r   r   rA   r   r   s   @rD   r   r     sX         , Qw#%% %% %% %% %% %% %% %% %% %% %%rE   r   c                  (     e Zd ZdZ	 dd fdZ xZS )r   u  
    Construct an arc that is tangent to two intersecting lines.
    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.

    Examples
    --------
    .. manim:: TangentialArcExample
        :save_last_frame:

        class TangentialArcExample(Scene):
            def construct(self):
                line1 = DashedLine(start=3 * LEFT, end=3 * RIGHT)
                line1.rotate(angle=31 * DEGREES, about_point=ORIGIN)
                line2 = DashedLine(start=3 * UP, end=3 * DOWN)
                line2.rotate(angle=12 * DEGREES, about_point=ORIGIN)

                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)
    rg   rg   r   r+   r   r   r6   cornerr   r:   c                T   || _         || _        t          |                                |                                g|                                |                                g          }|\  }}||                                z  }	||                                z  }
t          |	|
          }|t          j        |dz            z  }|||	z  z   }|||
z  z   }|	d         |
d         z  |	d         |
d         z  z
  }|dk     r|}|}n|}|} t                      j
        d|||d| d S )Nri   r   rg   )r   r   r   r?   )r   r   r&   rk   rn   get_unit_vectorr#   rs   r   r@   rA   )rB   r   r   r   r  r:   intersection_points1s2unit_vector1unit_vector2corner_angletangent_point_distancetangent_point1tangent_point2cross_productstart_point	end_pointrC   s                     rD   rA   zTangentialArc.__init__'  sR    

.__05??3D3Demmoo2V
 
 BE11333E11333,\<HH!'"&1A*B*B!B ,.D|.SS+.D|.SS Ol1o-Q,q/0QQ 	
 1(K&II )K&IS{	&SSFSSSSSrE   )r  )
r   r+   r   r+   r   r6   r  r   r:   r   r   r   r   r   rA   r   r   s   @rD   r   r     s]        - -h )T )T )T )T )T )T )T )T )T )T )TrE   r   c                        e Zd Zd	 fdZ xZS )
r   r  r1   r  r:   r   r;   r<   c                    ddl m} |                    d|          } t                      j        ||fi | |                     |           d S )Nr   rZ   rH   )rH   )r`   r[   popr@   rA   rT   )rB   r  r  r:   r[   rH   rC   s         rD   rA   zCurvedArrow.__init__T  sg     	GFFFFFJJ{,BCC	i::6:::y)))))rE   r  r1   r  r1   r:   r   r;   r<   r   r   r   rA   r   r   s   @rD   r   r   S  s=        * * * * * * * * * *rE   r   c                        e Zd Zd	 fdZ xZS )
r   r  r1   r  r:   r   r;   r<   c                    d|v r|                     d          |d<   ddlm} |                     d|          } t                      j        ||fi | |                     d|           d S )Ntip_shape_endrH   r   rZ   tip_shape_startT)rL   rH   )r  r`   r[   r@   rA   rT   )rB   r  r  r:   r[   r$  rC   s         rD   rA   zCurvedDoubleArrow.__init___  s     f$$"(**_"="=F;FFFFFF **%68NOOi::6:::do>>>>>rE   r  r   r   s   @rD   r   r   ^  s=        	? 	? 	? 	? 	? 	? 	? 	? 	? 	?rE   r   c                  Z     e Zd ZdZdefd! fdZ	 	 	 d"d#dZd$dZed%d             Z	 xZ
S )&r	   ad  A circle.

    Parameters
    ----------
    color
        The color of the shape.
    kwargs
        Additional arguments to be passed to :class:`Arc`

    Examples
    --------
    .. manim:: CircleExample
        :save_last_frame:

        class CircleExample(Scene):
            def construct(self):
                circle_1 = Circle(radius=1.0)
                circle_2 = Circle(radius=1.5, color=GREEN)
                circle_3 = Circle(radius=1.0, color=BLUE_B, fill_opacity=1)

                circle_group = Group(circle_1, circle_2, circle_3).arrange(buff=1)
                self.add(circle_group)
    Nr   rJ   re   r!   r:   r   r;   r<   c                N     t                      j        d|dt          |d| d S )Nr   )r   r   r   re   r?   )r@   rA   r   )rB   r   re   r:   rC   s       rD   rA   zCircle.__init__  sJ     	 	
		
 	

 	
 	
 	
 	
 	
rE   r   F333333?mobjectr,   dim_to_matchr   stretchrM   buffer_factorr6   r   c                    |                      |||           t          j        |j        dz  |j        dz  z             | _        |                     |          S )aS  Modifies a circle so that it surrounds a given mobject.

        Parameters
        ----------
        mobject
            The mobject that the circle will be surrounding.
        dim_to_match
        buffer_factor
            Scales the circle with respect to the mobject. A `buffer_factor` < 1 makes the circle smaller than the mobject.
        stretch
            Stretches the circle to fit more tightly around the mobject. Note: Does not work with :class:`Line`

        Examples
        --------
        .. manim:: CircleSurround
            :save_last_frame:

            class CircleSurround(Scene):
                def construct(self):
                    triangle1 = Triangle()
                    circle1 = Circle().surround(triangle1)
                    group1 = Group(triangle1,circle1) # treat the two mobjects as one

                    line2 = Line()
                    circle2 = Circle().surround(line2, buffer_factor=2.0)
                    group2 = Group(line2,circle2)

                    # buffer_factor < 1, so the circle is smaller than the square
                    square3 = Square()
                    circle3 = Circle().surround(square3, buffer_factor=0.5)
                    group3 = Group(square3, circle3)

                    group = Group(group1, group2, group3).arrange(buff=1)
                    self.add(group)
        ri   )replacers   r  r\   heightr   )rB   r(  r)  r*  r+  s        rD   surroundzCircle.surround  sQ    ^ 	WlG444WW]A-0AABB
zz-(((rE   r   r0   c                n    |t           z  }|t          j        |          z  }|                     |          S )a<  Returns the position of a point on the circle.

        Parameters
        ----------
        angle
            The angle of the point along the circle in radians.

        Returns
        -------
        :class:`numpy.ndarray`
            The location of the point along the circle's circumference.

        Examples
        --------
        .. manim:: PointAtAngleExample
            :save_last_frame:

            class PointAtAngleExample(Scene):
                def construct(self):
                    circle = Circle(radius=2.0)
                    p1 = circle.point_at_angle(PI/2)
                    p2 = circle.point_at_angle(270*DEGREES)

                    s1 = Square(side_length=0.25).move_to(p1)
                    s2 = Square(side_length=0.25).move_to(p2)
                    self.add(circle, s1, s2)

        )r   rs   floorpoint_from_proportion)rB   r   
proportions      rD   point_at_anglezCircle.point_at_angle  s5    : S[
bhz***
))*555rE   p1r1   p2p3c           	        t          t          t          j        |           t          j        |          g          t          t          j        |          t          j        |          g                    }t	          t
          t          j                            | |z
                      }t          dd|i|	                    |          S )aL  Returns a circle passing through the specified
        three points.

        Example
        -------
        .. manim:: CircleFromPointsExample
            :save_last_frame:

            class CircleFromPointsExample(Scene):
                def construct(self):
                    circle = Circle.from_three_points(LEFT, LEFT + UP, UP * 2, color=RED)
                    dots = VGroup(
                        Dot(LEFT),
                        Dot(LEFT + UP),
                        Dot(UP * 2),
                    )
                    self.add(NumberPlane(), circle, dots)
        r   r?   )
r&   r'   rs   r   r   r6   r   r   r	   rw   )r5  r6  r7  r:   r	  r   s         rD   from_three_pointszCircle.from_three_points  s    , #"BJrNNBJrNN#CDD"BJrNNBJrNN#CDD
 

 eRY^^BK8899..V.v..44V<<<rE   )r   rJ   re   r!   r:   r   r;   r<   )r   Fr'  )
r(  r,   r)  r   r*  rM   r+  r6   r;   r   )r   r6   r;   r0   )
r5  r1   r6  r1   r7  r1   r:   r   r;   r	   )r   r   r   r   r   rA   r/  r4  r   r9  r   r   s   @rD   r	   r	   k  s         4  $$'
 
 
 
 
 
 
" "2) 2) 2) 2) 2)h6 6 6 6B = = = \= = = = =rE   r	   c                  0     e Zd ZdZeeddefd fdZ xZS )r
   a  A circle with a very small radius.

    Parameters
    ----------
    point
        The location of the dot.
    radius
        The radius of the dot.
    stroke_width
        The thickness of the outline of the dot.
    fill_opacity
        The opacity of the dot's fill_colour
    color
        The color of the dot.
    kwargs
        Additional arguments to be passed to :class:`Circle`

    Examples
    --------
    .. manim:: DotExample
        :save_last_frame:

        class DotExample(Scene):
            def construct(self):
                dot1 = Dot(point=LEFT, radius=0.08)
                dot2 = Dot(point=ORIGIN)
                dot3 = Dot(point=RIGHT)
                self.add(dot1,dot2,dot3)
    r   r   r   r1   r   r6   stroke_widthfill_opacityre   r!   r:   r   r;   r<   c           	     F     t                      j        d|||||d| d S )N)r   r   r;  r<  re   r?   r@   rA   )rB   r   r   r;  r<  re   r:   rC   s          rD   rA   zDot.__init__%  sM     	 	
%%	
 	
 	
 	
 	
 	
 	
rE   )r   r1   r   r6   r;  r6   r<  r6   re   r!   r:   r   r;   r<   )	r   r   r   r   r   DEFAULT_DOT_RADIUSr    rA   r   r   s   @rD   r
   r
     s^         @ $*!$)
 
 
 
 
 
 
 
 
 
 
rE   r
   c                  4     e Zd ZdZedz  deefd fdZ xZS )r   z<A dot with bigger radius and bold stroke to annotate scenes.g?   r   r6   r;  r^   r!   r]   r:   r   r;   r<   c                D     t                      j        d||||d| d S )N)r   r;  r^   r]   r?   r>  )rB   r   r;  r^   r]   r:   rC   s         rD   rA   zAnnotationDot.__init__;  sJ     	 	
%%!		
 	

 	
 	
 	
 	
 	
rE   )r   r6   r;  r6   r^   r!   r]   r!   r:   r   r;   r<   )	r   r   r   r   r?  r    r   rA   r   r   s   @rD   r   r   8  s[        FF +S0+0)-
 
 
 
 
 
 
 
 
 
 
rE   r   c                  *     e Zd ZdZdefd fdZ xZS )r   a  A :class:`Dot` containing a label in its center.

    Parameters
    ----------
    label
        The label of the :class:`Dot`. This is rendered as :class:`~.MathTex`
        by default (i.e., when passing a :class:`str`), but other classes
        representing rendered strings like :class:`~.Text` or :class:`~.Tex`
        can be passed as well.
    radius
        The radius of the :class:`Dot`. If provided, the ``buff`` is ignored.
        If ``None`` (the default), the radius is calculated based on the size
        of the ``label`` and the ``buff``.

    Examples
    --------
    .. manim:: SeveralLabeledDots
        :save_last_frame:

        class SeveralLabeledDots(Scene):
            def construct(self):
                sq = Square(fill_color=RED, fill_opacity=1)
                self.add(sq)
                dot1 = LabeledDot(Tex("42", color=RED))
                dot2 = LabeledDot(MathTex("a", color=GREEN))
                dot3 = LabeledDot(Text("ii", color=BLUE))
                dot4 = LabeledDot("3")
                dot1.next_to(sq, UL)
                dot2.next_to(sq, UR)
                dot3.next_to(sq, DL)
                dot4.next_to(sq, DR)
                self.add(dot1, dot2, dot3, dot4)
    Nlabel&str | SingleStringMathTex | Text | Texr   rJ   buffr6   r:   r   r;   r<   c                   t          |t                    rddlm}  ||t                    }n|}|>|t          t          j                            |j	        |j
        g          dz            z   } t                      j        dd|i| |                    |                                            |                     |           d S )Nr   )MathTex)re   ri   r   r?   )
isinstancestrmanimrH  r   r6   rs   r   r   r\   r.  r@   rA   move_to
get_centerrS   )rB   rD  r   rF  r:   rH  rendered_labelrC   s          rD   rA   zLabeledDot.__init__o  s     eS!! 	#%%%%%%'.wuE'B'B'BNN"N>E	 4n6KLMMPQQ  F 	111&111t00111     rE   )
rD  rE  r   rJ   rF  r6   r:   r   r;   r<   )r   r   r   r   
SMALL_BUFFrA   r   r   s   @rD   r   r   L  sU           J  $ 	! ! ! ! ! ! ! ! ! ! !rE   r   c                  &     e Zd ZdZdd fdZ xZS )r   a  A circular shape; oval, circle.

    Parameters
    ----------
    width
       The horizontal width of the ellipse.
    height
       The vertical height of the ellipse.
    kwargs
       Additional arguments to be passed to :class:`Circle`.

    Examples
    --------
    .. manim:: EllipseExample
        :save_last_frame:

        class EllipseExample(Scene):
            def construct(self):
                ellipse_1 = Ellipse(width=2.0, height=4.0, color=BLUE_B)
                ellipse_2 = Ellipse(width=4.0, height=1.0, color=BLUE_D)
                ellipse_group = Group(ellipse_1,ellipse_2).arrange(buff=1)
                self.add(ellipse_group)
    ri   rg   r\   r6   r.  r:   r   r;   r<   c                     t                      j        di | |                     |           |                     |           d S r>   )r@   rA   stretch_to_fit_widthstretch_to_fit_height)rB   r\   r.  r:   rC   s       rD   rA   zEllipse.__init__  sN    ""6"""!!%(((""6*****rE   )ri   rg   )r\   r6   r.  r6   r:   r   r;   r<   r  r   s   @rD   r   r     sL         0+ + + + + + + + + + +rE   r   c                  J     e Zd ZdZddedz  dddefd fdZddZddZ xZ	S )r   a  A sector of an annulus.


    Parameters
    ----------
    inner_radius
       The inside radius of the Annular Sector.
    outer_radius
       The outside radius of the Annular Sector.
    angle
       The clockwise angle of the Annular Sector.
    start_angle
       The starting clockwise angle of the Annular Sector.
    fill_opacity
       The opacity of the color filled in the Annular Sector.
    stroke_width
       The stroke width of the Annular Sector.
    color
       The color filled into the Annular Sector.

    Examples
    --------
    .. manim:: AnnularSectorExample
        :save_last_frame:

        class AnnularSectorExample(Scene):
            def construct(self):
                # Changes background color to clearly visualize changes in fill_opacity.
                self.camera.background_color = WHITE

                # The default parameter start_angle is 0, so the AnnularSector starts from the +x-axis.
                s1 = AnnularSector(color=YELLOW).move_to(2 * UL)

                # Different inner_radius and outer_radius than the default.
                s2 = AnnularSector(inner_radius=1.5, outer_radius=2, angle=45 * DEGREES, color=RED).move_to(2 * UR)

                # fill_opacity is typically a number > 0 and <= 1. If fill_opacity=0, the AnnularSector is transparent.
                s3 = AnnularSector(inner_radius=1, outer_radius=1.5, angle=PI, fill_opacity=0.25, color=BLUE).move_to(2 * DL)

                # With a negative value for the angle, the AnnularSector is drawn clockwise from the start value.
                s4 = AnnularSector(inner_radius=1, outer_radius=1.5, angle=-3 * PI / 2, color=GREEN).move_to(2 * DR)

                self.add(s1, s2, s3, s4)
    rg   ri   r   r   inner_radiusr6   outer_radiusr   r   r<  r;  re   r!   r:   r   r;   r<   c           	     b    || _         || _         t                      j        d|||||d| d S )N)r   r   r<  r;  re   r?   )rU  rV  r@   rA   )
rB   rU  rV  r   r   r<  r;  re   r:   rC   s
            rD   rA   zAnnularSector.__init__  s]     )( 	
#%%	
 	
 	
 	
 	
 	
 	
rE   c                R     fd j          j        fD             \  }}|                                                      |j                                        |j        d                                         |j                                        |j        d                    d S )Nc              3  \   K   | ]&}t          j        j        |j                   V  'dS ))r   r   r   r   N)r   r   r   r   )r   r   rB   s     rD   	<genexpr>z0AnnularSector.generate_points.<locals>.<genexpr>  s[        
  
   ,j?	   
  
  
  
  
  
rE   r   )rU  rV  reverse_pointsappend_pointsr   add_line_to)rB   	inner_arc	outer_arcs   `  rD   r   zAnnularSector.generate_points  s     
  
  
  
  ,d.?@ 
  
  
	9 	  """9+,,,)!,---9+,,,)!,-----rE   c                .    |                                   d S r   r   r   s    rD   r   zAnnularSector.init_points      rE   )rU  r6   rV  r6   r   r6   r   r6   r<  r6   r;  r6   re   r!   r:   r   r;   r<   r   )
r   r   r   r   r   r    rA   r   r   r   r   s   @rD   r   r     s        + +^  Qw$)
 
 
 
 
 
 
,. . . .        rE   r   c                  &     e Zd ZdZd
d fd	Z xZS )r   a  A sector of a circle.

    Examples
    --------
    .. manim:: ExampleSector
        :save_last_frame:

        class ExampleSector(Scene):
            def construct(self):
                sector = Sector(radius=2)
                sector2 = Sector(radius=2.5, angle=60*DEGREES).move_to([-3, 0, 0])
                sector.set_color(RED)
                sector2.set_color(PINK)
                self.add(sector, sector2)
    rg   r   r6   r:   r   r;   r<   c                @     t                      j        dd|d| d S )Nr   )rU  rV  r?   r>  )rB   r   r:   rC   s      rD   rA   zSector.__init__  s-    GafGGGGGGGrE   rg   )r   r6   r:   r   r;   r<   r  r   s   @rD   r   r     sW          H H H H H H H H H H HrE   r   c                  B     e Zd ZdZddddedfd fdZddZddZ xZS )r   a  Region between two concentric :class:`Circles <.Circle>`.

    Parameters
    ----------
    inner_radius
        The radius of the inner :class:`Circle`.
    outer_radius
        The radius of the outer :class:`Circle`.
    kwargs
        Additional arguments to be passed to :class:`Annulus`

    Examples
    --------
    .. manim:: AnnulusExample
        :save_last_frame:

        class AnnulusExample(Scene):
            def construct(self):
                annulus_1 = Annulus(inner_radius=0.5, outer_radius=1).shift(UP)
                annulus_2 = Annulus(inner_radius=0.3, outer_radius=0.6, color=RED).next_to(annulus_1, DOWN)
                self.add(annulus_1, annulus_2)
    rg   ri   r   FrU  r6   rV  r<  r;  re   r!   mark_paths_closedrM   r:   r   r;   r<   c                l    || _         || _        || _         t                      j        d|||d| d S )N)r<  r;  re   r?   )rg  rU  rV  r@   rA   )	rB   rU  rV  r<  r;  re   rg  r:   rC   s	           rD   rA   zAnnulus.__init__*  s[     "3(( 	
%L	
 	
QW	
 	
 	
 	
 	
rE   c                6   | j         | _        t          | j                   }t          | j                  }|                                 |                     |j                   |                     |j                   |                     | j                   d S )N)r   )	rV  r   r	   rU  r[  r\  r   rw   r   )rB   outer_circleinner_circles      rD   r   zAnnulus.generate_points;  s    'T%6777T%6777##%%%<.///<.///

4?#####rE   c                .    |                                   d S r   ra  r   s    rD   r   zAnnulus.init_pointsD  rb  rE   )rU  r6   rV  r6   r<  r6   r;  r6   re   r!   rg  rM   r:   r   r;   r<   r   )	r   r   r   r   r    rA   r   r   r   r   s   @rD   r   r     s         2  $)"'
 
 
 
 
 
 
"$ $ $ $       rE   r   c                  $     e Zd ZdZd fdZ xZS )r   u  A cubic Bézier curve.

    Example
    -------
    .. manim:: BezierSplineExample
        :save_last_frame:

        class BezierSplineExample(Scene):
            def construct(self):
                p1 = np.array([-3, 1, 0])
                p1b = p1 + [1, 0, 0]
                d1 = Dot(point=p1).set_color(BLUE)
                l1 = Line(p1, p1b)
                p2 = np.array([3, -1, 0])
                p2b = p2 - [1, 0, 0]
                d2 = Dot(point=p2).set_color(RED)
                l2 = Line(p2, p2b)
                bezier = CubicBezier(p1b, p1b + 3 * RIGHT, p2b - 3 * RIGHT, p2b)
                self.add(l1, d1, l2, d2, bezier)

    start_anchorr1   start_handle
end_handle
end_anchorr:   r   r;   r<   c                j     t                      j        di | |                     ||||           d S r>   )r@   rA   add_cubic_bezier_curve)rB   rn  ro  rp  rq  r:   rC   s         rD   rA   zCubicBezier.__init___  sB     	""6"""##L,
JWWWWWrE   )rn  r1   ro  r1   rp  r1   rq  r1   r:   r   r;   r<   r  r   s   @rD   r   r   H  sQ         ,	X 	X 	X 	X 	X 	X 	X 	X 	X 	XrE   r   c                  4     e Zd ZdZedz  dddd fdZ xZS )r   a  A generalized polygon allowing for points to be connected with arcs.

    This version tries to stick close to the way :class:`Polygon` is used. Points
    can be passed to it directly which are used to generate the according arcs
    (using :class:`ArcBetweenPoints`). An angle or radius can be passed to it to
    use across all arcs, but to configure arcs individually an ``arc_config`` list
    has to be passed with the syntax explained below.

    Parameters
    ----------
    vertices
        A list of vertices, start and end points for the arc segments.
    angle
        The angle used for constructing the arcs. If no other parameters
        are set, this angle is used to construct all arcs.
    radius
        The circle radius used to construct the arcs. If specified,
        overrides the specified ``angle``.
    arc_config
        When passing a ``dict``, its content will be passed as keyword
        arguments to :class:`~.ArcBetweenPoints`. Otherwise, a list
        of dictionaries containing values that are passed as keyword
        arguments for every individual arc can be passed.
    kwargs
        Further keyword arguments that are passed to the constructor of
        :class:`~.VMobject`.

    Attributes
    ----------
    arcs : :class:`list`
        The arcs created from the input parameters::

            >>> from manim import ArcPolygon
            >>> ap = ArcPolygon([0, 0, 0], [2, 0, 0], [0, 2, 0])
            >>> ap.arcs
            [ArcBetweenPoints, ArcBetweenPoints, ArcBetweenPoints]


    .. tip::

        Two instances of :class:`ArcPolygon` can be transformed properly into one
        another as well. Be advised that any arc initialized with ``angle=0``
        will actually be a straight line, so if a straight section should seamlessly
        transform into an arced section or vice versa, initialize the straight section
        with a negligible angle instead (such as ``angle=0.0001``).

    .. note::
        There is an alternative version (:class:`ArcPolygonFromArcs`) that is instantiated
        with pre-defined arcs.

    See Also
    --------
    :class:`ArcPolygonFromArcs`


    Examples
    --------
    .. manim:: SeveralArcPolygons

        class SeveralArcPolygons(Scene):
            def construct(self):
                a = [0, 0, 0]
                b = [2, 0, 0]
                c = [0, 2, 0]
                ap1 = ArcPolygon(a, b, c, radius=2)
                ap2 = ArcPolygon(a, b, c, angle=45*DEGREES)
                ap3 = ArcPolygon(a, b, c, arc_config={'radius': 1.7, 'color': RED})
                ap4 = ArcPolygon(a, b, c, color=RED, fill_opacity=1,
                                            arc_config=[{'radius': 1.7, 'color': RED},
                                            {'angle': 20*DEGREES, 'color': BLUE},
                                            {'radius': 1}])
                ap_group = VGroup(ap1, ap2, ap3, ap4).arrange()
                self.play(*[Create(ap) for ap in [ap1, ap2, ap3, ap4]])
                self.wait()

    For further examples see :class:`ArcPolygonFromArcs`.
    r   N)r   r   
arc_configverticesr1   r   r6   r   rJ   ru  list[dict] | Noner:   r   r;   r<   c               f  
 t                    

fdt          
          D             }|sL|r%t          j        d|it          |                    }ntt          j        d|it          |                    }nOt	          |t
                    r#t          j        |t          |                    }nt          |          
k    sJ |}d t          ||d          D             } t                      j        di |  | j	        |  |D ]}	| 
                    |	j                   || _        d S )Nc                <    g | ]}|         |d z   z           fS re  r?   )r   knrv  s     rD   r   z'ArcPolygon.__init__.<locals>.<listcomp>  s/    NNNXq1uk%:;NNNrE   r   r   c                ,    g | ]\  }}t          |i |S r?   )r   )r   pairconfs      rD   r   z'ArcPolygon.__init__.<locals>.<listcomp>  s9     
 
 
t d+d++
 
 
rE   T)strictr?   )r   range	itertoolsrepeatrI  dictzipr@   rA   rS   r\  r   arcs)rB   r   r   ru  rv  r:   point_pairsall_arc_configsr  arcr{  rC   s       `     @rD   rA   zArcPolygon.__init__  sh    MMNNNNNU1XXNNN 	) W2;2Bv&K(8(83 3 #,"2GU3CSEUEU"V"V
D)) 	)'.z3{;K;KLLOOz??a''''(O
 
 #K N N N
 
 

 	""6""" 	$ 	+ 	+Csz**** 			rE   )rv  r1   r   r6   r   rJ   ru  rw  r:   r   r;   r<   )r   r   r   r   rp   rA   r   r   s   @rD   r   r   k  sc        L Lb Av#(,' ' ' ' ' ' ' ' ' ' ' 'rE   r   c                  $     e Zd ZdZd	 fdZ xZS )
r   a  A generalized polygon allowing for points to be connected with arcs.

    This version takes in pre-defined arcs to generate the arcpolygon and introduces
    little new syntax. However unlike :class:`Polygon` it can't be created with points
    directly.

    For proper appearance the passed arcs should connect seamlessly:
    ``[a,b][b,c][c,a]``

    If there are any gaps between the arcs, those will be filled in
    with straight lines, which can be used deliberately for any straight
    sections. Arcs can also be passed as straight lines such as an arc
    initialized with ``angle=0``.

    Parameters
    ----------
    arcs
        These are the arcs from which the arcpolygon is assembled.
    kwargs
        Keyword arguments that are passed to the constructor of
        :class:`~.VMobject`. Affects how the ArcPolygon itself is drawn,
        but doesn't affect passed arcs.

    Attributes
    ----------
    arcs
        The arcs used to initialize the ArcPolygonFromArcs::

            >>> from manim import ArcPolygonFromArcs, Arc, ArcBetweenPoints
            >>> ap = ArcPolygonFromArcs(Arc(), ArcBetweenPoints([1,0,0], [0,1,0]), Arc())
            >>> ap.arcs
            [Arc, ArcBetweenPoints, Arc]


    .. tip::

        Two instances of :class:`ArcPolygon` can be transformed properly into
        one another as well. Be advised that any arc initialized with ``angle=0``
        will actually be a straight line, so if a straight section should seamlessly
        transform into an arced section or vice versa, initialize the straight
        section with a negligible angle instead (such as ``angle=0.0001``).

    .. note::
        There is an alternative version (:class:`ArcPolygon`) that can be instantiated
        with points.

    .. seealso::
        :class:`ArcPolygon`

    Examples
    --------
    One example of an arcpolygon is the Reuleaux triangle.
    Instead of 3 straight lines connecting the outer points,
    a Reuleaux triangle has 3 arcs connecting those points,
    making a shape with constant width.

    Passed arcs are stored as submobjects in the arcpolygon.
    This means that the arcs are changed along with the arcpolygon,
    for example when it's shifted, and these arcs can be manipulated
    after the arcpolygon has been initialized.

    Also both the arcs contained in an :class:`~.ArcPolygonFromArcs`, as well as the
    arcpolygon itself are drawn, which affects draw time in :class:`~.Create`
    for example. In most cases the arcs themselves don't
    need to be drawn, in which case they can be passed as invisible.

    .. manim:: ArcPolygonExample

        class ArcPolygonExample(Scene):
            def construct(self):
                arc_conf = {"stroke_width": 0}
                poly_conf = {"stroke_width": 10, "stroke_color": BLUE,
                      "fill_opacity": 1, "color": PURPLE}
                a = [-1, 0, 0]
                b = [1, 0, 0]
                c = [0, np.sqrt(3), 0]
                arc0 = ArcBetweenPoints(a, b, radius=2, **arc_conf)
                arc1 = ArcBetweenPoints(b, c, radius=2, **arc_conf)
                arc2 = ArcBetweenPoints(c, a, radius=2, **arc_conf)
                reuleaux_tri = ArcPolygonFromArcs(arc0, arc1, arc2, **poly_conf)
                self.play(FadeIn(reuleaux_tri))
                self.wait(2)

    The arcpolygon itself can also be hidden so that instead only the contained
    arcs are drawn. This can be used to easily debug arcs or to highlight them.

    .. manim:: ArcPolygonExample2

        class ArcPolygonExample2(Scene):
            def construct(self):
                arc_conf = {"stroke_width": 3, "stroke_color": BLUE,
                    "fill_opacity": 0.5, "color": GREEN}
                poly_conf = {"color": None}
                a = [-1, 0, 0]
                b = [1, 0, 0]
                c = [0, np.sqrt(3), 0]
                arc0 = ArcBetweenPoints(a, b, radius=2, **arc_conf)
                arc1 = ArcBetweenPoints(b, c, radius=2, **arc_conf)
                arc2 = ArcBetweenPoints(c, a, radius=2, stroke_color=RED)
                reuleaux_tri = ArcPolygonFromArcs(arc0, arc1, arc2, **poly_conf)
                self.play(FadeIn(reuleaux_tri))
                self.wait(2)
    r  Arc | ArcBetweenPointsr:   r   r;   r<   c                   t          d |D                       st          d           t                      j        di |  | j        |  g || _        ddlm} t          |          D ]\  }}| 	                    |j
                    ||                                |                                          }|                                |                                z  }t          j        |          st          j        |          r|                    t'          |                                |z                       | 	                    |j
                   d S )Nc              3  N   K   | ] }t          |t          t          f          V  !d S r   )rI  r   r   )r   ms     rD   rZ  z.ArcPolygonFromArcs.__init__.<locals>.<genexpr>N  s2      HHa:a#'7!899HHHHHHrE   z?All ArcPolygon submobjects must be of type Arc/ArcBetweenPointsrg   r*   r?   )r   r   r@   rA   rS   r  liner+   r"   r\  r   rn   rk   r}   get_arc_lengthrs   isnanisinfinsert_n_curvesr   get_num_curves)	rB   r  r:   r+   arc1arc2r  	len_ratiorC   s	           rD   rA   zArcPolygonFromArcs.__init__M  sn   HH4HHHHH 	Q   	""6""" 	$ dG	(.. 	, 	,JD$t{+++4(8(899D))D,?,?,A,AAIx	"" bhy&9&9   T%8%8%:%:Y%F!G!GHHHt{++++	, 	,rE   )r  r  r:   r   r;   r<   r  r   s   @rD   r   r     sJ        f fP, , , , , , , , , ,rE   r   )Gr   
__future__r   __all__r  r   typingr   r   r   r   numpyrs   manim.constants)manim.mobject.opengl.opengl_compatibilityr   &manim.mobject.types.vectorized_mobjectr   r   manim.utils.colorr   r   r   r    r!   manim.utils.iterablesr"   manim.utils.space_opsr#   r$   r%   r&   r'   r(   collections.abcr)   r`   r(  geometryr   manim.mobject.geometry.liner+   manim.mobject.mobjectr,   manim.mobject.text.tex_mobjectr-   r.   manim.mobject.text.text_mobjectr/   manim.typingr0   r1   r2   r3   r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r?   rE   rD   <module>r     sZ   . # " " " " "  (      1 1 1 1 1 1 1 1 1 1 1 1         E E E E E E C C C C C C C C I I I I I I I I I I I I I I 0 0 0 0 0 0                 ((((((............000000------GGGGGGGG444444           \2 \2 \2 \2 \2h/ \2 \2 \2 \2~H
 H
 H
 H
 H
/ H
 H
 H
V8% 8% 8% 8% 8%s 8% 8% 8%vYT YT YT YT YT$ YT YT YTx* * * * *" * * *
? 
? 
? 
? 
? 
? 
? 
?X= X= X= X= X=S X= X= X=v/
 /
 /
 /
 /
& /
 /
 /
d
 
 
 
 
C 
 
 
(7! 7! 7! 7! 7! 7! 7! 7!t+ + + + +f + + +>U U U U UC U U UpH H H H H] H H H*3 3 3 3 3f 3 3 3l X  X  X  X  X(o  X  X  X  XFv v v v v_ v v v vr, , , , ,_ , , , , , ,rE   