+
    f7i  c                   s    R t ^ RIHtHtHtHtHt ^ RIHt R t	R t
R tRt]! R],          4      tR t ! R R	4      tR
 tR# )z=Helpers for manipulating 2D points and vectors in COLR table.)copysigncoshypotisclosepiotRoundc                 s^    V^ ,          V ^ ,          ,
          V^,          V ^,          ,
          3#      )ZoriginZtarget   &&B/usr/lib64/python3.14/site-packages/fontTools/colorLib/geometry.py_vector_betweenr      s'    1Iq	!6!9vay#899    c                 sJ    \        V ^ ,          4      \        V ^,          4      3# r   r   )Zpt   &r   _round_pointr      s    BqENGBqEN++r   c                 sf    \        V !  pV^ 8X  d   R# V ^ ,          V,          V ^,          V,          3# r   N)r   )ZvecZlengths   & r   _unit_vectorr      s0    C[F{FVOSVf_--r   g-C6?c                 s    \        V 4      pV'       g   R# . pV FL  p\        ) Tu;8:  d   \        8  d   M MVP                  ^ 4       K1  VP                  \        RV4      4       KN  	  \	        V4      # )r         ?)r   r   )r   _UNIT_VECTOR_THRESHOLDZappendr    Ztuple)	directionZuvZresultZuv_components   &   r   _rounding_offsetr      se     
i	 BF""lK5KK MM! MM(356  =r   c                   sJ   a  ] tR t^6t o R tR tR t]3R ltR t	R t
RtV tR# )	Circlec                s    Wn         W n        R # Ncentreradius)selfr   r      &&&r   __init__ZCircle.__init__7   s    r   c                s<    R V P                    RV P                   R2# )zCircle(centre=z	, radius=Z)r   r   r   r   __repr__ZCircle.__repr__;   s    }Idkk]!DDr   c                sf    \        \        V P                  4      \        V P                  4      4      # r   )r   r   r   r   r   r   r   r   roundZCircle.round>   s!    l4;;/1EFFr   c                s    V P                   \        \        V P                  VP                  4      !  ,           p\	        VP                   V\
        R 7      ;'       g    VP                   V8  # ))Zrel_tol)r   r   r   r   r   _CIRCLE_INSIDE_TOLERANCE)r   Zouter_circleZ	toleranceZdists   &&& r   insideZCircle.insideA   sV    {{UODKKATAT$UVVL''7OP * *""T)	
r   c                s4    V P                   VP                   8H  # r   r   )r   Zotherr
   r   
concentricZCircle.concentricH   s    {{ell**r   c                sx    V P                   ^ ,          V,           V P                   ^,          V,           3V n         R# r   r#   )r   dxdyr   r   moveZCircle.moveK   s(    {{1~*DKKNR,?@r   r   N)Z__name__Z
__module__Z__qualname__Z__firstlineno__r   r   r    r!   r"   r$   r'   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   6   s2     EG .F 
+A Ar   r   c                s   \        W4      \        W#4      rTVP                  V4      pVP                  4       pVP                  4       pVP                  V4      p	Wi8X  d   V# V	'       d$   \        VP                  VP                  4      p
RpM"\        VP                  VP                  4      p
Rp\        V
4      w  r^p\        V4       F]  pVP                  V4      '       d   V;P                  V,          un        MVP                  W4       WgP                  V4      8X  g   K\   V# 	  \        RT RV'       d   RMR RV RV R2	4      h)	a  Round start circle so that it stays inside/outside end circle after rounding.

The rounding of circle coordinates to integers may cause an abrupt change
if the start circle c0 is so close to the end circle c1's perimiter that
it ends up falling outside (or inside) as a result of the rounding.
To keep the gradient unchanged, we nudge it in the right direction.

See:
https://github.com/googlefonts/colr-gradients-spec/issues/204
https://github.com/googlefonts/picosvg/issues/158
r   zRounding circle Z r"   Zoutsidez failed after z
 attempts!g      )r   r"   r    r   r   r   Zranger$   r   r'   ZAssertionError)Zc0Zr0Zc1Zr1ZstartZendZinside_before_roundZround_startZ	round_endZinside_after_roundr   Zradius_deltar%   r&   Zmax_attemptsZ_s   &&&&            r   %round_start_circle_stable_containmentr(   O   s:    3,,s+++-K		I$++I60	#I$4$4k6H6HI	 $K$6$6	8H8HI	i(FB" L< !!),,,. R$"4"4Y"?? ! ! ugQ.xI>ae>,z;
 	
r   Ng      ?)Z__doc__Zmathr    r   r   r   r   ZfontTools.misc.roundToolsr   r   r   r   r!   r   r   r   r(   r	   r   r   <module>r)      sO    C 2 2 -:,.    URZ .A A2@r   