
    h                        S SK Jr  S SKJrJrJrJr  S SKrS SKJ	r	J
r
Jr  S SKJrJr  \(       a  S SKJr  SrSr\S	S	S
.           SS jjrSSS.         SS jjrSS jrSS jrg)    )annotations)SequenceTYPE_CHECKINGIterableAnyN)UVecVec2has_clockwise_orientation)
LWPolyline	DXFEntity)
BaseLayoutRevcloudPropsgc/;|?        )bulgestart_width	end_widthc          	        US:  a  [        S5      e[        U 5      n/ n[        XUSS 5       H  u  pxUR                  UR                  UR
                  X4U45        X-
  n	U	R                  n
X::  a  ME  [        R                  " X-  5      nX-  nU	R                  U5      n[        US-
  5       H0  nX}-  nUR                  UR                  UR
                  X4U45        M2     M     U$ )a  Returns the points for a :class:`~ezdxf.entities.LWPolyline` entity to render a
revision cloud, similar to the REVCLOUD command in CAD applications.

Args:
    vertices: corner points of a polygon
    segment_length: approximate segment length
    bulge: LWPOLYLINE bulge value
    start_width: start width of the segment arc
    end_width: end width of the segment arc, CAD applications use 0.1 * segment_length
        for a calligraphy effect

gư>zsegment length too small.   N)
ValueError_to_vec2_listzipappendxy	magnitudemathceil	normalizerange)verticessegment_lengthr   r   r   	_vertices	lw_pointssedifflengthcount_segment_lengthoffset_s                  @/var/www/html/env/lib/python3.13/site-packages/ezdxf/revcloud.pypointsr-      s    ( 455h'I')II}-!##qssKEBCu#		&12 .0uqy!AKAacc133FG " .     T)calligraphy
dxfattribsc               x   [        U5      n[        n[        U5      (       a  U* nU(       a  US-  OSn[        XRXgS9nU R	                  USUS9n	U	R                  [        SSU4/5        U R                  n
U
bC  U
R                  R                  [        5      (       d  U
R                  R                  [        5        U	$ )a]  Adds a revision cloud as :class:`~ezdxf.entities.LWPolyline` entity to `layout`,
similar to the REVCLOUD command in CAD applications.

Args:
    layout: target layout
    vertices: corner points of a polygon
    segment_length: approximate segment length
    calligraphy: ``True`` for a calligraphy effect
    dxfattribs: additional DXF attributes

g?r   )r   r   T)closer0   )i.  r   i  )r   REQUIRED_BULGEr
   r-   add_lwpolyline	set_xdataREVCLOUD_PROPSdocappids	has_entryadd)layoutr    r!   r/   r0   r"   r   r   r#   lwpr7   s              r,   
add_entityr=   :   s    & h'IE ++(3$IySI


	*

MCMM.9t^.D"EF
**C
szz33NCC

~&Jr.   c                    [        U [        5      (       d  gU nUR                  (       d  gUR                  [        5      (       d  g[        S UR                  SS9 5       5      $ )zCReturns ``True`` when the given entity represents a revision cloud.Fc              3  d   #    U  H&  n[        [        [        US    5      -
  5      S:  v   M(     g7f)r   g{Gz?N)absr3   ).0ps     r,   	<genexpr>is_revcloud.<locals>.<genexpr>e   s.      2A 	NS1Y&'$.2s   .0b)format)
isinstancer   	is_closed	has_xdatar6   all
get_points)entity
lwpolylines     r,   is_revcloudrN   \   s_    fj))#J// &&c&2  r.   c                    [         R                  " U 5      n[        U5      S:  a  [        S5      eUS   R	                  US   5      (       d  UR                  US   5        [        U5      S:  a  [        S5      eU$ )N   z3 or more points required.r      )r	   listlenr   iscloser   )r    r"   s     r,   r   r   k   sq     IIh/I
9~566Q<	"..1&
9~566r.   )r    Iterable[UVec]r!   floatr   rW   r   rW   r   rW   returnzlist[Sequence[float]])
r;   r   r    rV   r!   rW   r0   r   rX   r   )rL   r   rX   bool)r    rV   rX   z
list[Vec2])
__future__r   typingr   r   r   r   r   
ezdxf.mathr   r	   r
   ezdxf.entitiesr   r   ezdxf.layoutsr   r6   r3   r-   r=   rN   r    r.   r,   <module>r`      s    # 9 9  < < 0( ! "&&& 	&
 & & &\    Dr.   