
    h_&                       S SK Jr  S SKrS SKJrJrJrJrJr  S SK	J
r
  SSKJr  SSKJr  / SQrS \R                   SS4         SS	 jjr  S         SS
 jjr    S         SS jjr S       SS jjr   S         SS jjrSSS jjr S             SS jjr  S         SS jjrg)    )annotationsN)cubic_bezier_arc_parametersMatrix44UVecbasic_transformationVec3)forms   )Path)	converter)unit_circleelliptic_transformationrectngonwedgestargearhelixc                    [        5       nSn[        XU5       H'  u  pgpU(       a  Xdl        SnUR                  XU5        M)     Uc  U$ UR	                  U5      $ )u=  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
             C/var/www/html/env/lib/python3.13/site-packages/ezdxf/path/shapes.pyr   r      sb    * 6DJ$?% e JJs5)% ~~i((    c                    [        5       nSn[        XU5       H2  u  pgpU(       a  UR                  U5        SnUR                  XU5        M4     UR                  S5        Uc  U$ UR	                  U5      $ )u1  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   @   su    * 6DJ$?% e LLJs5)% 	LL~~i((r#   c                |    US:  a  [        SU 35      eUS:  a  [        SU 35      eUnX-  n[        XUS4U5      $ )u  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   sW    , }+F8455t|?5'233GnG'1(=xHHr#   c                    U S:  a  [        SU  35      eUS:  a  [        SU 35      e[        U 5      S-  n[        U5      S-  n[        R                  " X44U* U4U* U* 4X4* 4/SS9nUc  U$ UR	                  U5      $ )aM  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}+F8455	u	B	v	B""
RC9sRCj2s)4DD ~~i((r#   c                ~    [         R                  " XUS9nUb  UR                  U5      n[        R                  " USS9$ )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=    ( zz%v>H//9""8488r#   c                ~    [         R                  " XUS9nUb  UR                  U5      n[        R                  " USS9$ )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=    " zz%2.H//9""8488r#   c                    [         R                  " XX#U5      nUb  UR                  U5      n[        R                  " USS9$ )aG  
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      s?    4 zz%L.QH//9""8488r#   c                0  ^^^ UUU4S jnSU4S jjnU mU mU(       d  T* m[        U SS4S9nU[        R                  -  mU" [        R                  U-  5      n[	        [        R
                  " U5      5      n	U	S:  ay  [        U" U[        R                  U5      5      n
[        U	5       HI  n[        SSUR                  R                  5      nU
 H  u  pnUR                  X-   X-   X-   5        M!     MK     X)-
  nUS:  a  [        R                  " US-  5      nU" U[        R                  -  U-  5      n[        SSUR                  R                  5      nU" U[        R                  U-  U5       H  u  pnUR                  X-   X-   X-   5        M!     U$ )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  b  >#    SnX-  T
-  nUS-  n[        SX5       H  u  pgp[        UR                  T-  UR                  T-  X5-   U -
  5      [        UR                  T-  UR                  T-  X5-   U -   5      [        U	R                  T-  U	R                  T-  X4-   5      4v   X4-  nM     g 7f)Ng        g      ?r   )r   r   xy)bangler   zzz_stepz_step_2_v1v2v3prxrys             r"   bezier_ctrl_points!helix.<locals>.bezier_ctrl_points  s     !A%C<8ELMA2RTTBYr	2=1+<=RTTBYr	2=1+<=RTTBYr	2;7 
 LB Ms   B,B/c                   > [         R                  " U 5      nSU-
  SU-
  -  U -  T-  n[         R                  " U 5      SU-
  -  [         R                  " U 5      -  nX#-  $ )N      ?g      @g      @)mathcossintan)alphacos_ab_1b_2rR   s       r"   param_bhelix.<locals>.param_b  sW    U{sU{+e3a7hhuou-?yr#   r   )r   r(      )r]   r3   returnr3   )r   rY   taupiintfloorlistranger   r!   zr   ceil)r+   pitchturnsccwr   rU   ra   r   rI   
full_turnscurve_paramsrN   rk   rO   rP   rQ   reminderrR   rS   rT   s                    @@@r"   r   r      s^   .
 
B	BSvq!n%DA("#ATZZ&'JA~.q$((HEFz"AQ488::&A*
qvqvqv6 + #
 !H$99X\*Htww&12Atxxzz",Q80CXNJBBNN1616162 O Kr#   )
r   r3   r   r3   r   rg   r   Matrix44 | Nonerd   r   )r
   N)r%   r
   r
   r   )
r*   r   r+   r3   r,   r3   r-   r3   rd   r   )r
   r
   N)r5   r3   r6   r3   r   rs   rd   r   )NrX   N)
r<   rg   r:   zfloat | Noner+   r3   r   rs   rd   r   )N)
r<   rg   r?   r3   r@   r3   r   rs   rd   r   )r<   rg   rB   r3   rC   r3   r6   r3   rD   r3   r   rs   rd   r   )Trc   )
r+   r3   rm   r3   rn   r3   r   rg   rd   r   )
__future__r   rY   
ezdxf.mathr   r   r   r   r   ezdxf.renderr	   r   r    r   __all__re   r   r   r   r   r   r   r   r    r#   r"   <module>rz      s   #     	 xx!%	!)!)!) !) 	!)
 
!)N !%	")")") ") 	")
 
")L 	III I 	I
 I@ GK))#)4C)	)<  !%	999 9 	9
 
949: "&999 9 	9
 9 9 
9H 	AAA A
 A 
Ar#   