Ë
    £èhTK  ã                  ó(  — d dl mZ d dlmZmZmZmZmZ d dlZd dl	Z
d dlmZmZ ddlmZ ddlmZ ddlmZ dd	lmZmZ dd
lmZ erd dlmZ d dlmZ g d¢Zd ej<                  dz  ej<                  ej<                  dz  gZ G d„ d«      Z dd„Z!dd„Z"y)é    )Úannotations)ÚTYPE_CHECKINGÚIterableÚSequenceÚIteratorÚOptionalN)ÚVec2ÚUVecé   )ÚBoundingBox2d)Úenclosing_angles)ÚConstructionCircle)ÚConstructionRayÚConstructionLine)ÚUCS)ÚArc)Ú
BaseLayout)ÚConstructionArcÚarc_chord_lengthÚarc_segment_countç      à?g      ø?c                  ó  — e Zd ZdZ	 	 	 	 	 d	 	 	 	 	 	 	 	 	 dd„Zed d„«       Zed d„«       Zed!d„«       Zed"d„«       Z	ed#d„«       Z
d$d„Zed%d	„«       Zd&d
„Zd'd„Zd&d„Zd(d„Zd)d„Zd*d„Zd+d„Zed%d„«       Zed%d„«       Ze	 	 	 	 	 	 d,d„«       Ze	 d-	 	 	 	 	 	 	 	 	 d.d„«       Ze	 	 d/	 	 	 	 	 	 	 	 	 	 	 d0d„«       Ze	 d-	 	 	 	 	 	 	 	 	 d1d„«       Z	 d2	 	 	 	 	 d3d„Z	 d4	 	 	 	 	 d5d„Z	 d4	 	 	 	 	 d6d„Z	 d4	 	 	 	 	 d7d„Z	 d4	 	 	 	 	 d8d„Z d9d„Z!y):r   aP  Construction tool for 2D arcs.

    :class:`ConstructionArc` represents a 2D arc in the xy-plane, use an
    :class:`UCS` to place a DXF :class:`~ezdxf.entities.Arc` entity in 3D space,
    see method :meth:`add_to_layout`.

    Implements the 2D transformation tools: :meth:`translate`,
    :meth:`scale_uniform` and :meth:`rotate_z`

    Args:
        center: center point as :class:`Vec2` compatible object
        radius: radius
        start_angle: start angle in degrees
        end_angle: end angle in degrees
        is_counter_clockwise: swaps start- and end angle if ``False``

    c                óp   — t        |«      | _        || _        |r|| _        || _        y || _        || _        y ©N)r	   ÚcenterÚradiusÚstart_angleÚ	end_angle)Úselfr   r   r   r   Úis_counter_clockwises         ú.lib/python3.12/site-packages/ezdxf/math/arc.pyÚ__init__zConstructionArc.__init__+   s7   € ô ˜6“lˆŒØˆŒÙØ*ˆDÔØ&ˆD�Nà(ˆDÔØ(ˆD�Nó    c                óp   — | j                   t        j                  | j                  | j                  «      z   S )z$start point of arc as :class:`Vec2`.)r   r	   Úfrom_deg_angler   r   ©r   s    r!   Ústart_pointzConstructionArc.start_point=   s*   € ð �{‰{œT×0Ñ0°×1AÑ1AÀ4Ç;Á;ÓOÑOÐOr#   c                óp   — | j                   t        j                  | j                  | j                  «      z   S )z"end point of arc as :class:`Vec2`.)r   r	   r%   r   r   r&   s    r!   Ú	end_pointzConstructionArc.end_pointB   s(   € ð �{‰{œT×0Ñ0°·±ÀÇÁÓMÑMÐMr#   c                ó4   — | j                   | j                  kD  S )z<Returns ``True`` if the arc passes the x-axis (== 0 degree).©r   r   r&   s    r!   Úis_passing_zerozConstructionArc.is_passing_zeroG   s   € ð ×Ñ $§.¡.Ñ0Ð0r#   c                óB   — t        | j                  | j                  «      S r   )r   r   r   r&   s    r!   ÚcirclezConstructionArc.circleL   s   € ä! $§+¡+¨t¯{©{Ó;Ð;r#   c                ó†   — t        | j                  | j                  f«      }|j                  | j	                  «       «       |S )z.bounding box of arc as :class:`BoundingBox2d`.)r   r'   r)   ÚextendÚmain_axis_points)r   Úbboxs     r!   Úbounding_boxzConstructionArc.bounding_boxP   s7   € ô ˜d×.Ñ.°·±Ð?Ó@ˆØ�‰�D×)Ñ)Ó+Ô,Øˆr#   c              #  óÆ   K  — |dk  rt        d«      ‚| j                  dz  }| j                  dz  }||k  r|dz  }t        j                  |||d¬«      D ]	  }|dz  –— Œ y­w)z¥Returns `num` angles from start- to end angle in degrees in
        counter-clockwise order.

        All angles are normalized in the range from [0, 360).

        é   znum >= 2éh  T)ÚnumÚendpointN)Ú
ValueErrorr   r   ÚnpÚlinspace)r   r7   ÚstartÚstopÚangles        r!   ÚangleszConstructionArc.anglesW   sl   è ø€ ð �Š7Ü˜ZÓ(Ð(Ø×'Ñ'¨#Ñ-ˆØ—n‘n sÑ*ˆØ�5Š=Ø�C‰KˆDÜ—[‘[ ¨°#À×EˆEØ˜#‘+Óñ Fùs   ‚AA!c                ó`   — | j                   }|| j                  k  r|dz  }|| j                  z
  S )z3Returns angle span of arc from start- to end param.ç     €v@)r   r   )r   Úends     r!   Ú
angle_spanzConstructionArc.angle_spang   s5   € ð —^‘^ˆØ�×!Ñ!Ò!Ø�5‰LˆCØ�T×%Ñ%Ñ%Ð%r#   c              #  ó€   K  — | j                   }| j                  }|D ]  }|t        j                  ||«      z   –— Œ y­w)zýYields vertices on arc for angles in iterable `a` in WCS as location
        vectors.

        Args:
            a: angles in the range from 0 to 360 in degrees, arc goes
                counter clockwise around the z-axis, WCS x-axis = 0 deg.

        N)r   r   r	   r%   )r   Úar   r   r>   s        r!   ÚverticeszConstructionArc.verticeso   s<   è ø€ ð —‘ˆØ—‘ˆãˆEØœ4×.Ñ.¨u°fÓ=Ñ=Ó=ñ ùs   ‚<>c              #  óx  K  — t        | j                  «      }|dkD  rš| j                  }| j                  }t	        j
                  ||«      ry|dz  }|dz  }||k  r|dz  }t	        j                  ||z
  «      }t        |||«      }| j                  t        j                  |||dz   «      «      E d{  –—†  yy7 Œ­w)z§Approximate the arc by vertices in WCS, argument `sagitta` is the
        max. distance from the center of an arc segment to the center of its
        chord.

        r   Nr6   r   )Úabsr   r   r   ÚmathÚiscloseÚradiansr   rF   r:   r;   )r   Úsagittar   r<   r=   rC   Úcounts          r!   Ú
flatteningzConstructionArc.flattening~   s²   è ø€ ô ˜DŸK™KÓ(ˆØ�AŠ:Ø×+Ñ+ˆEØŸ.™.ˆDÜ�|‰|˜E 4Ô(ØØ�S‰LˆEØ�C‰KˆDØ�uŠ}Ø˜‘�Ü $§¡¨T°E©\Ó :ˆJÜ% f¨j¸'ÓBˆEØ—}‘}¤R§[¡[°¸¸eÀa¹iÓ%HÓI×IÑIð ð Jús   ‚B/B:Â1B8Â2B:c              #  ó°   K  — |D ]M  }t        j                  |«      }t        t        j                  |«       t        j                  |«      f«      –— ŒO y­w)zþYields tangents on arc for angles in iterable `a` in WCS as
        direction vectors.

        Args:
            a: angles in the range from 0 to 360 in degrees, arc goes
                counter-clockwise around the z-axis, WCS x-axis = 0 deg.

        N)rI   rK   r	   ÚsinÚcos)r   rE   r>   Úrs       r!   ÚtangentszConstructionArc.tangents’   sB   è ø€ ó ˆEÜ—|‘| EÓ*ˆAÜœŸ™ !›˜¤d§h¡h¨q£kÐ2Ó3Ó3ñ ùs   ‚AAc              #  ó   K  — | j                   }| j                  }t        j                  | j                  «      }t        j                  | j
                  «      }t        D ]+  }t        |||«      sŒ|t        j                  ||«      z   –— Œ- y ­wr   )
r   r   rI   rK   r   r   ÚQUARTER_ANGLESr   r	   Ú
from_angle)r   r   r   r<   rB   r>   s         r!   r1   z ConstructionArc.main_axis_pointsŸ   sj   è ø€ Ø—{‘{ˆØŸ™ˆÜ—|‘| D×$4Ñ$4Ó5ˆÜ—\‘\ $§.¡.Ó1ˆß#ˆEÜ  u¨cÕ2ØœtŸ™¨u°fÓ=Ñ=Ó=ñ $ùs   ‚A-BÁ0Bc                óD   — | xj                   t        ||«      z  c_         | S )zÉMove arc about `dx` in x-axis and about `dy` in y-axis, returns
        `self` (floating interface).

        Args:
            dx: translation in x-axis
            dy: translation in y-axis

        )r   r	   )r   ÚdxÚdys      r!   Ú	translatezConstructionArc.translate¨   s   € ð 	�Š”t˜B “|Ñ#�Øˆr#   c                óB   — | xj                   t        |«      z  c_         | S )zkScale arc inplace uniform about `s` in x- and y-axis, returns
        `self` (floating interface).
        )r   Úfloat)r   Úss     r!   Úscale_uniformzConstructionArc.scale_uniform´   s   € ð 	�Š”u˜Q“xÑ�Øˆr#   c                óZ   — | xj                   |z  c_         | xj                  |z  c_        | S )z“Rotate arc inplace about z-axis, returns `self`
        (floating interface).

        Args:
            angle: rotation angle in degrees

        r+   )r   r>   s     r!   Úrotate_zzConstructionArc.rotate_z»   s(   € ð 	×Ò˜EÑ!ÕØ�Š˜%Ñ�Øˆr#   c                ó@   — t        j                  | j                  «      S )z#Returns the start angle in radians.)rI   rK   r   r&   s    r!   Ústart_angle_radzConstructionArc.start_angle_radÇ   s   € ô �|‰|˜D×,Ñ,Ó-Ð-r#   c                ó@   — t        j                  | j                  «      S )z!Returns the end angle in radians.)rI   rK   r   r&   s    r!   Úend_angle_radzConstructionArc.end_angle_radÌ   s   € ô �|‰|˜DŸN™NÓ+Ð+r#   c                óV   — t        | «      } t        |«      }| |k(  rt        d«      ‚| |fS )Nz1Start- and end point have to be different points.)r	   r9   )r'   r)   s     r!   Úvalidate_start_and_end_pointz,ConstructionArc.validate_start_and_end_pointÑ   s6   € ô ˜;Ó'ˆÜ˜“Oˆ	Ø˜)Ò#ÜÐPÓQÐQØ˜IÐ%Ð%r#   c                óè  — | j                  ||«      \  }}t        j                  |«      }|dk(  rt        d«      ‚|du r||}}|dz  }|j	                  |«      }|dz  }	|	t        j
                  |«      z  }
|	t        j                  |«      z  }|j                  |d¬«      }||z
  }|j                  «       j                  |«      }||z   }t        ||
||z
  j                  ||z
  j                  d¬«      S )	aá  Create arc from two points and enclosing angle. Additional
        precondition: arc goes by default in counter-clockwise orientation from
        `start_point` to `end_point`, can be changed by `ccw` = ``False``.

        Args:
            start_point: start point as :class:`Vec2` compatible object
            end_point: end point as :class:`Vec2` compatible object
            angle: enclosing angle in degrees
            ccw: counter-clockwise direction if ``True``

        r   zAngle can not be 0.Fç       @r   ©ÚfactorT©r   r   r   r   r    )rf   rI   rK   r9   ÚdistancerP   ÚtanÚlerpÚ
orthogonalÚ	normalizer   Ú	angle_deg)Úclsr'   r)   r>   ÚccwÚ_start_pointÚ
_end_pointÚalpha2rl   Ú	distance2r   ÚheightÚ	mid_pointÚdistance_vectorÚheight_vectorr   s                   r!   Úfrom_2p_anglezConstructionArc.from_2p_angleÛ   s
  € ð& $'×#CÑ#CØ˜ó$
Ñ ˆ�jô —‘˜UÓ#ˆØ�AŠ:ÜÐ2Ó3Ð3Ø�%‰<Ø'1°<˜*ˆLØ ™ˆØ$×-Ñ-¨lÓ;ˆØ# c™>ˆ	Ø!¤D§H¡H¨VÓ$4Ñ4ˆØ!¤D§H¡H¨VÓ$4Ñ4ˆØ$Ÿ/™/¨,¸s˜/ÓCˆ	à *¨\Ñ 9ˆØ-×8Ñ8Ó:×DÑDÀVÓLˆØ  =Ñ0ˆäØØØ%¨Ñ.×9Ñ9Ø! FÑ*×5Ñ5Ø!%ô
ð 	
r#   c                ó¢  — | j                  ||«      \  }}t        |«      }|dk  rt        d«      ‚|du r||}}|j                  |d¬«      }|j	                  |«      }	|	dz  }
t        j                  |dz  |
dz  z
  «      }|||z
  j                  |¬«      j                  |«      z   }t        ||||z
  j                  ||z
  j                  d	¬
«      S )aX  Create arc from two points and arc radius.
        Additional precondition: arc goes by default in counter-clockwise
        orientation from `start_point` to `end_point` can be changed
        by `ccw` = ``False``.

        The parameter `center_is_left` defines if the center of the arc is
        left or right of the line from `start_point` to `end_point`.
        Parameter `ccw` = ``False`` swaps start- and end point, which also
        inverts the meaning of ``center_is_left``.

        Args:
            start_point: start point as :class:`Vec2` compatible object
            end_point: end point as :class:`Vec2` compatible object
            radius: arc radius
            ccw: counter-clockwise direction if ``True``
            center_is_left: center point of arc is left of line from start- to
                end point if ``True``

        r   zRadius has to be > 0.Fr   ri   rh   r5   )rs   Trk   )rf   r\   r9   rn   rl   rI   Úsqrtro   rp   r   rq   )rr   r'   r)   r   rs   Úcenter_is_leftrt   ru   ry   rl   rw   rx   r   s                r!   Úfrom_2p_radiuszConstructionArc.from_2p_radius	  sõ   € ð8 $'×#CÑ#CØ˜ó$
Ñ ˆ�jô �v“ˆØ�QŠ;ÜÐ4Ó5Ð5Ø�%‰<Ø'1°<˜*ˆLà$Ÿ/™/¨,¸s˜/ÓCˆ	Ø$×-Ñ-¨lÓ;ˆØ# c™>ˆ	ÜŸ	™	 &¨!¡)¨i¸©lÑ":Ó;ˆØ  J°Ñ$=×#IÑ#IØð $Jó $
ç
‰)�FÓ
ñˆô ØØØ%¨Ñ.×9Ñ9Ø! FÑ*×5Ñ5Ø!%ô
ð 	
r#   c                ó,  — | j                  ||«      \  }}t        |«      }||k(  s||k(  rt        d«      ‚t        j                  |||«      }t        |j
                  «      }t        ||j                  ||z
  j                  ||z
  j                  |¬«      S )a×  Create arc from three points.
        Additional precondition: arc goes in counter-clockwise
        orientation from `start_point` to `end_point`.

        Args:
            start_point: start point as :class:`Vec2` compatible object
            end_point: end point as :class:`Vec2` compatible object
            def_point: additional definition point as :class:`Vec2` compatible
                object
            ccw: counter-clockwise direction if ``True``

        z5def_point has to be different to start- and end pointrk   )	rf   r	   r9   r   Úfrom_3pr   r   r   rq   )rr   r'   r)   Ú	def_pointrs   r.   r   s          r!   r‚   zConstructionArc.from_3p>  sœ   € ð( "%×!AÑ!AØ˜ó"
Ñˆ�Yô ˜“Oˆ	Ø˜Ò# y°IÒ'=ÜÐTÓUÐUä#×+Ñ+¨K¸ÀIÓNˆÜ�f—m‘mÓ$ˆÜØØ—=‘=Ø$ vÑ-×8Ñ8Ø  6Ñ)×4Ñ4Ø!$ô
ð 	
r#   Nc                ó¼   — |j                  | j                  | j                  | j                  | j                  |¬«      }|€|S |j                  |j                  «      S )a9  Add arc as DXF :class:`~ezdxf.entities.Arc` entity to a layout.

        Supports 3D arcs by using an :ref:`UCS`. An :class:`ConstructionArc` is
        always defined in the xy-plane, but by using an arbitrary UCS, the arc
        can be placed in 3D space, automatically OCS transformation included.

        Args:
            layout: destination layout as :class:`~ezdxf.layouts.BaseLayout`
                object
            ucs: place arc in 3D space by :class:`~ezdxf.math.UCS` object
            dxfattribs: additional DXF attributes for the ARC entity

        )r   r   r   r   Ú
dxfattribs)Úadd_arcr   r   r   r   Ú	transformÚmatrix)r   ÚlayoutÚucsr…   Úarcs        r!   Úadd_to_layoutzConstructionArc.add_to_layoutc  sV   € ð  �n‰nØ—;‘;Ø—;‘;Ø×(Ñ(Ø—n‘nØ!ð ó 
ˆð �kˆsÐ@ s§}¡}°S·Z±ZÓ'@Ð@r#   c                ó¦   — t        |t        «      sJ ‚| j                  j                  ||«      D �cg c]  }| j	                  |«      r|‘Œ c}S c c}w )a¡  Returns intersection points of arc and `ray` as sequence of
        :class:`Vec2` objects.

        Args:
            ray: intersection ray
            abs_tol: absolute tolerance for tests (e.g. test for tangents)

        Returns:
            tuple of :class:`Vec2` objects

            =========== ==================================
            tuple size  Description
            =========== ==================================
            0           no intersection
            1           line intersects or touches the arc at one point
            2           line intersects the arc at two points
            =========== ==================================

        )Ú
isinstancer   r.   Úintersect_rayÚ_is_point_in_arc_range)r   ÚrayÚabs_tolÚpoints       r!   r�   zConstructionArc.intersect_ray|  sZ   € ô, ˜#œÔ/Ð/Ð/ð Ÿ™×2Ñ2°3¸Ô@ó
á@�Ø×*Ñ*¨5Ô1ò Ø@ñ
ð 	
ùò 
ó   ±Ac                ó¦   — t        |t        «      sJ ‚| j                  j                  ||«      D �cg c]  }| j	                  |«      r|‘Œ c}S c c}w )a¤  Returns intersection points of arc and `line` as sequence of
        :class:`Vec2` objects.

        Args:
            line: intersection line
            abs_tol: absolute tolerance for tests (e.g. test for tangents)

        Returns:
            tuple of :class:`Vec2` objects

            =========== ==================================
            tuple size  Description
            =========== ==================================
            0           no intersection
            1           line intersects or touches the arc at one point
            2           line intersects the arc at two points
            =========== ==================================

        )rŽ   r   r.   Úintersect_liner�   )r   Úliner’   r“   s       r!   r–   zConstructionArc.intersect_line™  s[   € ô, ˜$Ô 0Ô1Ð1Ð1ð Ÿ™×3Ñ3°D¸'ÔBó
áB�Ø×*Ñ*¨5Ô1ò ØBñ
ð 	
ùò 
r”   c                ó¦   — t        |t        «      sJ ‚| j                  j                  ||«      D �cg c]  }| j	                  |«      r|‘Œ c}S c c}w )a•  Returns intersection points of arc and `circle` as sequence of
        :class:`Vec2` objects.

        Args:
            circle: intersection circle
            abs_tol: absolute tolerance for tests

        Returns:
            tuple of :class:`Vec2` objects

            =========== ==================================
            tuple size  Description
            =========== ==================================
            0           no intersection
            1           circle intersects or touches the arc at one point
            2           circle intersects the arc at two points
            =========== ==================================

        )rŽ   r   r.   Úintersect_circler�   )r   r.   r’   r“   s       r!   r™   z ConstructionArc.intersect_circle¶  s[   € ô, ˜&Ô"4Ô5Ð5Ð5ð Ÿ™×5Ñ5°f¸gÔFó
áF�Ø×*Ñ*¨5Ô1ò ØFñ
ð 	
ùò 
r”   c                óÜ   — t        |t        «      sJ ‚| j                  j                  |j                  |«      D �cg c]&  }| j	                  |«      r|j	                  |«      r|‘Œ( c}S c c}w )a•  Returns intersection points of two arcs as sequence of
        :class:`Vec2` objects.

        Args:
            other: other intersection arc
            abs_tol: absolute tolerance for tests

        Returns:
            tuple of :class:`Vec2` objects

            =========== ==================================
            tuple size  Description
            =========== ==================================
            0           no intersection
            1           other arc intersects or touches the arc at one point
            2           other arc intersects the arc at two points
            =========== ==================================

        )rŽ   r   r.   r™   r�   )r   Úotherr’   r“   s       r!   Úintersect_arczConstructionArc.intersect_arcÓ  sl   € ô, ˜%¤Ô1Ð1Ð1ð Ÿ™×5Ñ5°e·l±lÀGÔLó
áL�Ø×*Ñ*¨5Ô1Ø×,Ñ,¨UÔ3ò ØLñ
ð 	
ùò 
s   »+A)c                ó¸   — | j                   dz  }| j                  dz  }|| j                  z
  j                  dz  }||kD  r||k\  xs ||k  S ||cxk  xr |k  S c S )NrA   )r   r   r   rq   )r   r“   r<   rB   r>   s        r!   r�   z&ConstructionArc._is_point_in_arc_rangeñ  sk   € ð ×'Ñ'¨%Ñ/ˆØ—^‘^ eÑ+ˆØ §¡Ñ+×6Ñ6¸Ñ>ˆØ�3Š;Ø˜E‘>Ò1 U¨c¡\Ð1Ø˜Ö$ Ñ$Ð$Ñ$Ð$r#   ))r   r   g      ð?ç        rA   T)
r   r
   r   r\   r   r\   r   r\   r    zOptional[bool])Úreturnr	   )rŸ   Úbool)rŸ   r   )rŸ   r   )r7   ÚintrŸ   úIterable[float])rŸ   r\   )rE   r¢   rŸ   úIterable[Vec2])rL   r\   rŸ   r£   )rŸ   zIterator[Vec2])rX   r\   rY   r\   rŸ   r   )r]   r\   rŸ   r   )r>   r\   rŸ   r   )r'   r
   r)   r
   rŸ   ztuple[Vec2, Vec2])T)
r'   r
   r)   r
   r>   r\   rs   r    rŸ   r   )TT)r'   r
   r)   r
   r   r\   rs   r    r   r    rŸ   r   )
r'   r
   r)   r
   rƒ   r
   rs   r    rŸ   r   )NN)r‰   r   rŠ   zOptional[UCS]rŸ   r   )g»½×Ùß|Û=)r‘   r   r’   r\   rŸ   úSequence[Vec2])r—   r   r’   r\   rŸ   r¤   )r.   r   r’   r\   rŸ   r¤   )r›   r   r’   r\   rŸ   r¤   )r“   r	   rŸ   r    )"Ú__name__Ú
__module__Ú__qualname__Ú__doc__r"   Úpropertyr'   r)   r,   r.   r3   r?   rC   rF   rN   rS   r1   rZ   r^   r`   rb   rd   Ústaticmethodrf   Úclassmethodr|   r€   r‚   rŒ   r�   r–   r™   rœ   r�   © r#   r!   r   r      sç  „ ñð( ØØ Ø Ø/3ð)àð)ð ð)ð ð	)ð
 ð)ð -ó)ð$ òPó ðPð òNó ðNð ò1ó ð1ð ò<ó ð<ð òó ðóð  ò&ó ð&ó>óJó(4ó>ó
óó
ð ò.ó ð.ð ò,ó ð,ð ð&Øð&Ø&*ð&à	ò&ó ð&ð ð ð+
àð+
ð ð+
ð ð	+
ð
 ð+
ð 
ò+
ó ð+
ðZ ð Ø#ð2
àð2
ð ð2
ð ð	2
ð
 ð2
ð ð2
ð 
ò2
ó ð2
ðh ð ð"
àð"
ð ð"
ð ð	"
ð
 ð"
ð 
ò"
ó ð"
ðJ IMðAØ ðAØ'4ðAà	óAð4 6;ð
Ø"ð
Ø-2ð
à	ó
ð< 8=ð
Ø$ð
Ø/4ð
à	ó
ð< <Að
Ø(ð
Ø38ð
à	ó
ð< 8=ð
Ø$ð
Ø/4ð
à	ó
ô<%r#   r   c                ój   — 	 dt        j                  d| z  |z  ||z  z
  «      z  S # t        $ r Y yw xY w)zÊReturns the chord length for an arc defined by `radius` and
    the `sagitta`_.

    Args:
        radius: arc radius
        sagitta: distance from the center of the arc to the center of its base

    rh   rž   )rI   r~   r9   )r   rL   s     r!   r   r   ü  s@   € ðØ”T—Y‘Y˜s V™|¨gÑ5¸À'Ñ8IÑIÓJÑJÐJøÜò Ùðús   ‚#& ¦	2±2c                ó²   — 	 t        | |«      }t        j                  |dz  | z  «      dz  }t        j                  ||z  «      S # t        t
        f$ r Y yw xY w)a.  Returns the count of required segments for the approximation
    of an arc for a given maximum `sagitta`_.

    Args:
        radius: arc radius
        angle: angle span of the arc in radians
        sagitta: max. distance from the center of an arc segment to the
            center of its chord

    rh   r   )r   rI   ÚasinÚceilr9   ÚZeroDivisionError)r   r>   rL   Úchord_lengthÚalphas        r!   r   r     s[   € ðÜ.¨v°wÓ?ˆÜ—y‘y °Ñ!3°fÑ!<Ó=ÀÑCˆÜ�y‰y˜ ™Ó'Ð'øÜÔ)Ð*ò Ùðús   ‚AA ÁAÁA)r   r\   rL   r\   rŸ   r\   )r   r\   r>   r\   rL   r\   rŸ   r¡   )#Ú
__future__r   Útypingr   r   r   r   r   rI   Únumpyr:   Ú
ezdxf.mathr	   r
   r2   r   Úconstruct2dr   r.   r   r—   r   r   rŠ   r   Úezdxf.entitiesr   Úezdxf.layoutsr   Ú__all__ÚpirU   r   r   r   r¬   r#   r!   Ú<module>r½      so   ðõ #ß HÕ HÛ Û ç !Ý Ý )Ý &ß 3Ý áÝ"Ý(â
F€à�T—W‘W˜s‘] D§G¡G¨T¯W©W°s©]Ð;€÷a%ñ a%óHôr#   