
    h#                       S SK Jr  S SKJrJrJrJr  S SKrS SK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JrJrJrJrJrJr  S SKJrJrJ r   S	S
K!J"r"J#r#  S	SK$J%r%J&r&J'r'J(r(J)r)J*r*  S	SK+J,r,  \(       a  S SK-J.r.  S SK/J0r0  S SK-J1r1J2r2  S/r3\" S\" S\Rh                  \S9\" SS	S9\" SS SS9\" SS SS9\" S\Rh                  \S\Rj                  \S9S.5      r6\" \65      r7\" \*\75      r8\, " S S\%5      5       r9g)    )annotations)TYPE_CHECKINGIterableOptionalIteratorN)	validator)Vec3Matrix44NULLVECZ_AXISarc_segment_count)OCSTransformNonUniformScalingError)DXFAttrDXFAttributesDefSubclassXTypeRETURN_DEFAULTgroup_code_mappingmerge_group_code_mappings)DXF12SUBCLASS_MARKERDXFValueError   )
base_classSubclassProcessor)
DXFGraphicacdb_entity
add_entityreplace_entityelevation_to_z_axisacdb_entity_group_codes)register_entity)DXFNamespace)AbstractTagWriter)EllipseSplineCircle
AcDbCircle
   )xtypedefault(   )r,   &   T)r,   optional'      )r+   r,   r/   r   fixer)centerradius	elevation	thickness	extrusionc                     ^  \ rS rSrSrSr\" \\\	5      r
\r S   SU 4S jjjrSU 4S jjrSS jrSS jrSS jrSS	 jrSS
 jrSSS jjrSSS jjrSrU =r$ )r(   I   zDXF CIRCLE entityCIRCLEc                   > [         [        U ]  U5      nU(       a8  UR                  X R                  5        UR
                  (       a  [        US5        U$ )z!Loading interface. (internal API))r3   )superr   load_dxf_attribssimple_dxfattribs_loaderMERGED_GROUP_CODESr12r!   )self	processordxf	__class__s      G/var/www/html/env/lib/python3.13/site-packages/ezdxf/entities/circle.pyr=   Circle.load_dxf_attribsQ   sC    
 J6yA..s4K4KL}}#C5
    c                   > [         TU ]  U5        UR                  [        :  a$  UR	                  [
        [        R                  5        U R                  R                  U/ SQ5        g)z(Export entity specific data as DXF tags.)r3   r4   r6   r7   N)
r<   export_entity
dxfversionr   
write_tag2r   acdb_circlenamerC   export_dxf_attribs)rA   	tagwriterrD   s     rE   rI   Circle.export_entity^   sL    i(%'  +2B2BC##E	
rG   c              #    #    U R                  5       n[        U R                  R                  5      n[	        U R                  R
                  5      nU H-  nUR                  [        R                  " XS5      U-   5      v   M/     g7f)a  Yields the vertices of the circle of all given `angles` as
:class:`~ezdxf.math.Vec3` instances in :ref:`WCS`.

Args:
    angles: iterable of angles in :ref:`OCS` as degrees, angle goes
        counter-clockwise around the extrusion vector, and the OCS x-axis
        defines 0-degree.

N)ocsabsrC   r4   r	   r3   to_wcsfrom_deg_angle)rA   anglesrR   r4   r3   angles         rE   verticesCircle.verticesg   s_      hhjDHHOO,dhhoo&E**T00?&HII s   BBc              #     #    [        U R                  R                  5      nUS:  aN  [        U[        R
                  U5      nU R                  [        R                  " SSUS-   5      5       Sh  vN   gg N7f)aR  Approximate the circle by vertices in :ref:`WCS` as :class:`~ezdxf.math.Vec3`
instances. The argument `sagitta`_ is the maximum distance from the center of an
arc segment to the center of its chord. Yields a closed polygon where the start
vertex is equal to the end  vertex!

.. _sagitta: https://en.wikipedia.org/wiki/Sagitta_(geometry)
g        g     v@r   N)	rS   rC   r4   r   mathtaurX   nplinspace)rA   sagittar4   counts       rE   
flatteningCircle.flatteningw   s]      TXX__%C<%fdhh@E}}R[[eUQY%GHHH Hs   A.A90A71A9c                    U R                  [        U R                  R                  U5      5      nU R	                  U5        U$ )zTransform the CIRCLE entity by transformation matrix `m` inplace.
Raises ``NonUniformScalingError()`` for non-uniform scaling.
)
_transformr   rC   r7   post_transform)rA   mcircles      rE   	transformCircle.transform   s6     dhh.@.@!!DEArG   c                j   U R                   nUR                  (       a  UR                  Ul        UR	                  UR
                  5      Ul        UR                  UR                  SS45      Ul        UR                  S5      (       a   UR                  UR                  5      Ul
        U $ [        S5      e)Nr   r6   z/CIRCLE/ARC does not support non uniform scaling)rC   scale_uniformnew_extrusionr7   transform_vertexr3   transform_lengthr4   hasattrtransform_thicknessr6   r   )rA   rR   rC   s      rE   rd   Circle._transform   s    hh--CM--cjj9CJ --szz1a.@ACJ{{;'' !$ 7 7 F 	 )A rG   c                4   U R                  5       nUR                  [        XU5      UR                  U R                  R
                  5      -   5      U R                  l        U R                  (       a&  U R                  [        R                  " XU5      5        U $ )zOptimized CIRCLE/ARC translation about `dx` in x-axis, `dy` in
y-axis and `dz` in z-axis, returns `self` (floating interface).
)
rR   from_wcsr	   rT   rC   r3   is_post_transform_requiredre   r
   	translate)rA   dxdydzrR   s        rE   ru   Circle.translate   si     hhj,,tBB'7#**TXX__:U'UV** 2 222 >?rG   c                    SSK Jn  U R                  5       nUc  [        S5      eUR                  " U 5      nU(       a  [        XU5        U$ [        XC5        U$ )a   Convert the CIRCLE/ARC entity to an :class:`~ezdxf.entities.Ellipse` entity.

Adds the new ELLIPSE entity to the entity database and to the same layout as
the source entity.

Args:
    replace: replace (delete) source entity by ELLIPSE entity if ``True``

r   )r&   valid layout required)ezdxf.entitiesr&   
get_layoutr   from_arcr    r   )rA   replacer&   layoutellipses        rE   
to_ellipseCircle.to_ellipse   sW     	+"> 788""4(4&1  w'rG   c                    SSK Jn  U R                  5       nUc  [        S5      eUR                  " U 5      nU(       a  [        XU5        U$ [        XC5        U$ )zConvert the CIRCLE/ARC entity to a :class:`~ezdxf.entities.Spline` entity.

Adds the new SPLINE entity to the entity database and to the same layout as the
source entity.

Args:
    replace: replace (delete) source entity by SPLINE entity if ``True``

r   )r'   r{   )r|   r'   r}   r   r~   r    r   )rA   r   r'   r   splines        rE   	to_splineCircle.to_spline   sU     	*"> 788&40  v&rG    )N)rB   zOptional[SubclassProcessor]returnr$   )rO   r%   r   None)rV   zIterable[float]r   Iterator[Vec3])r_   floatr   r   )rf   r
   r   r(   )rR   r   r   r(   )rv   r   rw   r   rx   r   r   r(   )T)r   r&   )r   r'   )__name__
__module____qualname____firstlineno____doc__DXFTYPEr   r   r   rL   
DXFATTRIBSmerged_circle_group_codesr?   r=   rI   rX   ra   rh   rd   ru   r   r   __static_attributes____classcell__)rD   s   @rE   r(   r(   I   sm    Gz;DJ2 8<4	 
J I*	, rG   ):
__future__r   typingr   r   r   r   r[   numpyr]   ezdxf.lldxfr   
ezdxf.mathr	   r
   r   r   r   ezdxf.math.transformtoolsr   r   ezdxf.lldxf.attributesr   r   r   r   r   r   r   ezdxf.lldxf.constr   r   r   	dxfentityr   r   dxfgfxr   r   r   r    r!   r"   factoryr#   r|   r$   ezdxf.lldxf.tagwriterr%   r&   r'   __all__point3dis_not_null_vectorrL   acdb_circle_group_codesr   r(   r   rG   rE   <module>r      s   # > >   !  K   D C 4  %+7.*"EMM7C"a( RT:RT:--22 
, -[9 54 
 LZ L LrG   