Ë
    £èh‘'  ã                  óh  — d dl mZ d dlZd dlmZmZmZmZmZ d dl	m
Z
 ddlmZ ddlmZ g d¢Zd ej                   ddf	 	 	 	 	 	 	 	 	 dd	„Z	 	 d	 	 	 	 	 	 	 	 	 dd
„Z	 	 	 	 d	 	 	 	 	 	 	 	 	 dd„Z	 d	 	 	 	 	 	 	 dd„Z	 	 	 d	 	 	 	 	 	 	 	 	 dd„Zddd„Z	 d	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z	 	 d	 	 	 	 	 	 	 	 	 dd„Zy)é    )ÚannotationsN)Úcubic_bezier_arc_parametersÚMatrix44ÚUVecÚbasic_transformationÚVec3)Úformsé   )ÚPath)Ú	converter)Úunit_circleÚelliptic_transformationÚrectÚngonÚwedgeÚstarÚgearÚhelixc                ó®   — t        «       }d}t        | ||«      D ]%  \  }}}}	|r	||_        d}|j                  |	||«       Œ' |€|S |j	                  |«      S )ui  Returns a unit circle as a :class:`Path` object, with the center at
    (0, 0, 0) and the radius of 1 drawing unit.

    The arc spans from the start- to the end angle in counter-clockwise
    orientation. The end angle has to be greater than the start angle and the
    angle span has to be greater than 0.

    Args:
        start_angle: start angle in radians
        end_angle: end angle in radians (end_angle > start_angle!)
        segments: count of BÃ¨zier-curve segments, default is one segment for
            each arc quarter (Ï€/2)
        transform: transformation Matrix applied to the unit circle

    TF)r   r   ÚstartÚ	curve4_toÚ	transform©
Ústart_angleÚ	end_angleÚsegmentsr   ÚpathÚ
start_flagr   Úctrl1Úctrl2Úends
             ú1lib/python3.12/site-packages/ezdxf/path/shapes.pyr   r      sl   € ô* ‹6€DØ€JÜ$?Ø�Y ö%Ñ ˆˆu�e˜Sñ ØˆDŒJØˆJØ�‰�s˜E 5Õ)ð%ð ÐØˆà�~‰~˜iÓ(Ð(ó    c                óä   — t        «       }d}t        | ||«      D ]/  \  }}}}	|r|j                  |«       d}|j                  |	||«       Œ1 |j                  d«       |€|S |j	                  |«      S )u]  Returns a wedge as a :class:`Path` object, with the center at
    (0, 0, 0) and the radius of 1 drawing unit.

    The arc spans from the start- to the end angle in counter-clockwise
    orientation. The end angle has to be greater than the start angle and the
    angle span has to be greater than 0.

    Args:
        start_angle: start angle in radians
        end_angle: end angle in radians (end_angle > start_angle!)
        segments: count of BÃ¨zier-curve segments, default is one segment for
            each arc quarter (Ï€/2)
        transform: transformation Matrix applied to the wedge

    TF©r   r   r   )r   r   Úline_tor   r   r   s
             r"   r   r   @   s}   € ô* ‹6€DØ€JÜ$?Ø�Y ö%Ñ ˆˆu�e˜Sñ Ø�L‰L˜ÔØˆJØ�‰�s˜E 5Õ)ð%ð 	‡L�L�ÔØÐØˆà�~‰~˜iÓ(Ð(r#   c                ó|   — |dk  rt        d|› �«      ‚|dk  rt        d|› �«      ‚|}||z  }t        | ||df|«      S )uF  Returns the transformation matrix to transform a unit circle into
    an arbitrary circular- or elliptic arc.

    Example how to create an ellipse with a major axis length of 3, a minor
    axis length 1.5 and rotated about 90Â°::

        m = elliptic_transformation(radius=3, ratio=0.5, rotation=math.pi / 2)
        ellipse = shapes.unit_circle(transform=m)

    Args:
        center: curve center in WCS
        radius: radius of the major axis in drawing units
        ratio: ratio of minor axis to major axis
        rotation: rotation angle about the z-axis in radians

    ç�íµ ÷Æ°>zinvalid radius: zinvalid ratio: r
   )Ú
ValueErrorr   )ÚcenterÚradiusÚratioÚrotationÚscale_xÚscale_ys         r"   r   r   e   s[   € ð, �‚}ÜÐ+¨F¨8Ð4Ó5Ð5Øˆt‚|Ü˜?¨5¨'Ð2Ó3Ð3Ø€GØ�u‰n€GÜ ¨°'¸1Ð(=¸xÓHÐHr#   c                óþ   — | dk  rt        d| › �«      ‚|dk  rt        d|› �«      ‚t        | «      dz  }t        |«      dz  }t        j                  ||f| |f| | f|| fgd¬«      }|€|S |j	                  |«      S )ae  Returns a closed rectangle as a :class:`Path` object, with the center at
    (0, 0, 0) and the given `width` and `height` in drawing units.

    Args:
        width: width of the rectangle in drawing units, width > 0
        height: height of the rectangle in drawing units, height > 0
        transform: transformation Matrix applied to the rectangle

    g•Ö&è.>zinvalid width: zinvalid height: g       @T©Úclose)r)   Úfloatr   Úfrom_verticesr   )ÚwidthÚheightr   Úw2Úh2r   s         r"   r   r   „   s¥   € ð ˆt‚|Ü˜?¨5¨'Ð2Ó3Ð3Ø�‚}ÜÐ+¨F¨8Ð4Ó5Ð5ä	ˆu‹˜Ñ	€BÜ	ˆv‹˜Ñ	€BÜ×"Ñ"Ø
ˆbˆ�R�C˜�9 ˜s R C˜j¨2°¨s¨)Ð4¸Dô€Dð ÐØˆà�~‰~˜iÓ(Ð(r#   c                ó†   — t        j                  | ||¬«      }|�|j                  |«      }t        j                  |d¬«      S )aŒ  Returns a `regular polygon <https://en.wikipedia.org/wiki/Regular_polygon>`_
    a :class:`Path` object, with the center at (0, 0, 0).
    The polygon size is determined by the edge `length` or the circum `radius`
    argument. If both are given `length` has higher priority. Default size is
    a `radius` of 1. The ngon starts with the first vertex is on the x-axis!
    The base geometry is created by function :func:`ezdxf.render.forms.ngon`.

    Args:
        count: count of polygon corners >= 3
        length: length of polygon side
        radius: circum radius, default is 1
        transform: transformation Matrix applied to the ngon

    )Úlengthr+   Tr1   )r	   r   Útransform_verticesr   r4   )Úcountr:   r+   r   Úverticess        r"   r   r       s?   € ô( �z‰z˜%¨°vÔ>€HØÐØ×/Ñ/°Ó9ˆÜ×"Ñ" 8°4Ô8Ð8r#   c                ó†   — t        j                  | ||¬«      }|�|j                  |«      }t        j                  |d¬«      S )aŒ  Returns a `star shape <https://en.wikipedia.org/wiki/Star_polygon>`_ as
    a :class:`Path` object, with the center at (0, 0, 0).

    Argument `count` defines the count of star spikes, `r1` defines the radius
    of the "outer" vertices and `r2` defines the radius of the "inner" vertices,
    but this does not mean that `r1` has to be greater than `r2`.
    The star shape starts with the first vertex is on the x-axis!
    The base geometry is created by function :func:`ezdxf.render.forms.star`.

    Args:
        count: spike count >= 3
        r1: radius 1
        r2: radius 2
        transform: transformation Matrix applied to the star

    )Úr1Úr2Tr1   )r	   r   r;   r   r4   )r<   r?   r@   r   r=   s        r"   r   r   º   s?   € ô" �z‰z˜% B¨2Ô.€HØÐØ×/Ñ/°Ó9ˆÜ×"Ñ" 8°4Ô8Ð8r#   c                óˆ   — t        j                  | ||||«      }|�|j                  |«      }t        j                  |d¬«      S )a{  
    Returns a `gear <https://en.wikipedia.org/wiki/Gear>`_ (cogwheel) shape as
    a :class:`Path` object, with the center at (0, 0, 0).
    The base geometry is created by function :func:`ezdxf.render.forms.gear`.

    .. warning::

        This function does not create correct gears for mechanical engineering!

    Args:
        count: teeth count >= 3
        top_width: teeth width at outside radius
        bottom_width: teeth width at base radius
        height: teeth height; base radius = outside radius - height
        outside_radius: outside radius
        transform: transformation Matrix applied to the gear shape

    Tr1   )r	   r   r;   r   r4   )r<   Ú	top_widthÚbottom_widthr6   Úoutside_radiusr   r=   s          r"   r   r   Ñ   sC   € ô4 �z‰z˜% ¨L¸&À.ÓQ€HØÐØ×/Ñ/°Ó9ˆÜ×"Ñ" 8°4Ô8Ð8r#   c                ó$  ‡‡‡— ˆˆˆfd„}dˆfd„}| Š| Š|s‰ Št        | ddf¬«      }|t        j                  z  Š |t        j                  |z  «      }t	        t        j
                  |«      «      }	|	dkD  ryt         ||t        j                  |«      «      }
t        |	«      D ]J  }t        dd|j                  j                  «      }|
D ]"  \  }}}|j                  ||z   ||z   ||z   «       Œ$ ŒL ||	z
  }|dkD  r•t        j                  |dz  «      } ||t        j                  z  |z  «      }t        dd|j                  j                  «      } ||t        j                  |z  |«      D ]"  \  }}}|j                  ||z   ||z   ||z   «       Œ$ |S )aõ  
    Returns a `helix <https://en.wikipedia.org/wiki/Helix>`_ as
    a :class:`Path` object.
    The center of the helix is always (0, 0, 0), a positive `pitch` value
    creates a helix along the +z-axis, a negative value along the -z-axis.

    Args:
        radius: helix radius
        pitch: the height of one complete helix turn
        turns: count of turns
        ccw: creates a counter-clockwise turning (right-handed) helix if ``True``
        segments: cubic Bezier segments per turn

    c           	   3  ón  •K  — d}||z  ‰
z  }|dz  }t        d||«      D ]‘  \  }}}}	t        |j                  ‰z  |j                  ‰z  ||z   | z
  «      t        |j                  ‰z  |j                  ‰z  ||z   | z   «      t        |	j                  ‰z  |	j                  ‰z  ||z   «      f–— ||z  }Œ“ y ­w)Ng        g      à?r   )r   r   ÚxÚy)ÚbÚangler   ÚzzÚz_stepÚz_step_2Ú_Úv1Úv2Úv3ÚpÚrxÚrys             €€€r"   Úbezier_ctrl_pointsz!helix.<locals>.bezier_ctrl_points  s¿   øè ø€ ØˆØ˜Ñ! AÑ%ˆØ˜C‘<ˆÜ8¸¸EÀ8ÖL‰MˆAˆr�2�rä�R—T‘T˜B‘Y §¡ r¡	¨2°©=¸1Ñ+<Ó=Ü�R—T‘T˜B‘Y §¡ r¡	¨2°©=¸1Ñ+<Ó=Ü�R—T‘T˜B‘Y §¡ r¡	¨2°©;Ó7ðò ð
 �&‰L‰Bñ Mùs   ƒB2B5c                ó¼   •— t        j                  | «      }d|z
  d|z
  z  | z  ‰z  }t        j                  | «      d|z
  z  t        j                  | «      z  }||z  S )Nç      ð?g      @g      @)ÚmathÚcosÚsinÚtan)ÚalphaÚcos_aÚb_1Úb_2rR   s       €r"   Úparam_bzhelix.<locals>.param_b  sY   ø€ Ü—‘˜“ˆØ�U‰{˜s U™{Ñ+¨eÑ3°aÑ7ˆÜ�h‰h�u‹o  u¡Ñ-´·±¸³Ñ?ˆØ�S‰yÐr#   r   )r   r(   é   )r\   r3   Úreturnr3   )r   rX   ÚtauÚpiÚintÚfloorÚlistÚranger   r!   Úzr   Úceil)r+   ÚpitchÚturnsÚccwr   rU   r`   r   rI   Ú
full_turnsÚcurve_paramsrN   ri   rO   rP   rQ   ÚreminderrR   rS   rT   s                    @@@r"   r   r   ñ   sp  ú€ ö.
õð 
€BØ	€BÙØˆSˆÜ�v˜q !�nÔ%€Dà”—‘Ñ€AÙ”—‘˜(Ñ"Ó#€AÜ”T—Z‘Z Ó&Ó'€JØ�A‚~ÜÑ.¨q´$·(±(¸HÓEÓFˆÜ�zÖ"ˆAÜ�Q˜˜4Ÿ8™8Ÿ:™:Ó&ˆAÛ*‘
��B˜Ø—‘˜q 2™v q¨2¡v¨q°2©vÕ6ñ +ð #ð
 �zÑ!€HØ�$‚Ü—9‘9˜X¨™\Ó*ˆÙ�HœtŸw™wÑ&¨Ñ1Ó2ˆÜ��A�t—x‘x—z‘zÓ"ˆÙ,¨Q´·±¸8Ñ0CÀXÖN‰JˆB��BØ�N‰N˜1˜r™6 1 r¡6¨1¨r©6Õ2ð Oð €Kr#   )
r   r3   r   r3   r   re   r   úMatrix44 | Nonerb   r   )r
   N)r%   r
   r
   r   )
r*   r   r+   r3   r,   r3   r-   r3   rb   r   )r
   r
   N)r5   r3   r6   r3   r   rq   rb   r   )NrW   N)
r<   re   r:   zfloat | Noner+   r3   r   rq   rb   r   )N)
r<   re   r?   r3   r@   r3   r   rq   rb   r   )r<   re   rB   r3   rC   r3   r6   r3   rD   r3   r   rq   rb   r   )Tra   )
r+   r3   rk   r3   rl   r3   r   re   rb   r   )Ú
__future__r   rX   Ú
ezdxf.mathr   r   r   r   r   Úezdxf.renderr	   r   r   Ú r   Ú__all__rc   r   r   r   r   r   r   r   r   © r#   r"   Ú<module>rx      sð  ðõ #Û ÷õ õ Ý Ý ò	€ð Ø—x‘xØØ!%ð	!)Øð!)àð!)ð ð!)ð ð	!)ð
 
ó!)ðN Ø!%ð	")Øð")àð")ð ð")ð ð	")ð
 
ó")ðL ØØØð	IØðIàðIð ðIð ð	Ið
 óIð@ GKð)Øð)Ø#ð)Ø4Cð)à	ó)ð<  ØØ!%ð	9Øð9àð9ð ð9ð ð	9ð
 
ó9ô49ð: "&ð9Øð9àð9ð ð9ð ð	9ð
 ð9ð ð9ð 
ó9ðH 	ØðAØðAàðAð ðAð
 ðAð 
ôAr#   