
    h              	      F   S SK Jr  S SKJrJr  S SKrS SKrS SKJ	r	J
r
JrJr  S SKJr  S SKJrJrJrJrJr  S SKJrJr  SS	KJr  SS
KJr  SSKJrJrJr  SSK J!r!  \(       a  S SK"J#r#  S/r$\" S\" SS S9\" SSS9S.5      r%\" \%5      r&\" \\&5      r'\! " S S\5      5       r(g)    )annotations)TYPE_CHECKINGIteratorN)Vec3Matrix44ConstructionArcarc_angle_span_deg)OCSTransform)DXFAttrDXFAttributesDefSubclassgroup_code_mappingmerge_group_code_mappings)DXF12SUBCLASS_MARKER   )
base_class)acdb_entity)acdb_circleCirclemerged_circle_group_codes)register_entity)AbstractTagWriterArcAcDbArc2   )default3   h  )start_angle	end_anglec                     ^  \ rS rSrSrSr\" \\\	\
5      r\rSU 4S jjr\SS j5       r\SS j5       rSS jrSS jrSU 4S	 jjrSS
 jrSS jrSrU =r$ )r   0   zDXF ARC entityARCc                   > [         TU ]  U5        UR                  [        :  a$  UR	                  [
        [        R                  5        U R                  R                  USS/5        g)z(Export entity specific data as DXF tags.r    r!   N)
superexport_entity
dxfversionr   
write_tag2r   acdb_arcnamedxfexport_dxf_attribs)self	tagwriter	__class__s     D/var/www/html/env/lib/python3.13/site-packages/ezdxf/entities/arc.pyr'   Arc.export_entity8   sM    i( %'  (--@##I{/KL    c                j    [        U R                  U R                  R                  /5      5      nUS   $ )zUReturns the start point of the arc in :ref:`WCS`, takes the :ref:`OCS` into
account.
r   )listverticesr,   r    r.   vs     r1   start_pointArc.start_pointA   s-    
  4 4567tr3   c                j    [        U R                  U R                  R                  /5      5      nUS   $ )zSReturns the end point of the arc in :ref:`WCS`, takes the :ref:`OCS` into
account.
r   )r5   r6   r,   r!   r7   s     r1   	end_pointArc.end_pointI   s-    
  2 2345tr3   c              #     #    US:  a  [        S5      eU R                  R                  S-  nU R                  R                  S-  nX2::  a  US-  n[        R
                  " X#USS9 H
  nUS-  v   M     g7f)zYields `num` angles from start- to end angle in degrees in counter-clockwise
orientation. All angles are normalized in the range from [0, 360).
   znum >= 2r   T)numendpointN)
ValueErrorr,   r    r!   nplinspace)r.   r@   startstopangles        r1   angles
Arc.anglesQ   sq      7Z(($$s*xx!!C'=CKD[[#EE#+ Fs   A3A5c              #  R  ^#    U R                  5       nU R                  5       n[        U R                  R                  5      R
                  mUR                  (       a  UR                  nO[        R                  nU" U4S jUR                  U5       5       5       Sh  vN   g N7f)zApproximate the arc by vertices in :ref:`WCS`, the argument `sagitta`_
defines the maximum distance from the center of an arc segment to the center of
its chord.

.. _sagitta: https://en.wikipedia.org/wiki/Sagitta_(geometry)
c              3  f   >#    U  H&  n[        UR                  UR                  T5      v   M(     g 7f)N)r   xy).0p	elevations     r1   	<genexpr>!Arc.flattening.<locals>.<genexpr>m   s'     U=T$qssACC33=Ts   .1N)
construction_toolocsr   r,   centerz	transformpoints_to_wcsgenerate
flattening)r.   sagittaarcrT   to_wcsrP   s        @r1   rZ   Arc.flattening^   sq      $$&hhj)++	==&&F]]FUS^^G=TUUUUs   BB'B% B'c                  > [        U R                  R                  U5      n[        TU ]  U5        U R                  R
                  nU R                  R                  n[        R                  " [        X45      S5      (       d2  UR                  X45      u  U R                  l        U R                  l        U R                  U5        U $ )zxTransform ARC entity by transformation matrix `m` inplace.
Raises ``NonUniformScalingError()`` for non-uniform scaling.
g     v@)r
   r,   	extrusionr&   
_transformr    r!   mathiscloser	   transform_ccw_arc_angles_degpost_transform)r.   mrT   ser0   s        r1   rW   Arc.transformo   s     488--q1388''88%%||.q4e<< 006$"Ar3   c                    U R                   n[        UR                  UR                  UR                  UR
                  5      $ )zjReturns the 2D construction tool :class:`ezdxf.math.ConstructionArc` but the
extrusion vector is ignored.
)r,   r   rU   radiusr    r!   )r.   r,   s     r1   rS   Arc.construction_tool   s6     hhJJJJOOMM	
 	
r3   c                    U R                   n[        UR                  5      Ul        UR                  Ul        UR                  Ul        UR
                  Ul        U $ )zqSet ARC data from the construction tool :class:`ezdxf.math.ConstructionArc`
but the extrusion vector is ignored.
)r,   r   rU   rk   r    r!   )r.   r\   r,   s      r1   apply_construction_toolArc.apply_construction_tool   sC     hh#**%
ZZ
//r3    )r/   r   returnNone)rq   r   )r@   intrq   zIterator[float])r[   floatrq   zIterator[Vec3])rf   r   rq   r   )rq   r   )r\   r   rq   r   )__name__
__module____qualname____firstlineno____doc__DXFTYPEr   r   r   r   r*   
DXFATTRIBSmerged_arc_group_codesMERGED_GROUP_CODESr'   propertyr9   r<   rH   rZ   rW   rS   rn   __static_attributes____classcell__)r0   s   @r1   r   r   0   sn    Gz;XNJ/M    V" 

	 	r3   ))
__future__r   typingr   r   rb   numpyrC   
ezdxf.mathr   r   r   r	   ezdxf.math.transformtoolsr
   ezdxf.lldxf.attributesr   r   r   r   r   ezdxf.lldxf.constr   r   	dxfentityr   dxfgfxr   circler   r   r   factoryr   ezdxf.lldxf.tagwriterr   __all__r*   acdb_arc_group_codesr|   r   rp   r3   r1   <module>r      s    # *    3  5 !  B B $7'r1-R- *(3 23 
 c& c cr3   