H'O : d Z ddlZd dZddZd Zd Zd Zd ZdS )z+ Extension to create and manipulate shapes N c # K | dk rt d |(|dz t j t j | z z }n'||dk rt d nt d dt j z | z }|}t | D ]7}|t j | z |t j | z fV ||z }8dS )a Returns the corners of a regular polygon as iterable of (x, y) tuples. The polygon size is determined by the `edge_length` or the `radius` argument. If both are given `edge_length` will be taken. Args: num_corners: count of polygon corners edge_length: length of polygon side radius: circum radius rotation: rotation angle in radians Returns: iterable of (x, y) tuples z0Argument `num_corners` has to be greater than 2.N r z+Argument `radius` has to be greater than 0.z,Argument `edge_length` or `radius` required.) ValueErrormathsinpirangecos)num_cornersedge_lengthradiusrotationdeltaangle_s l/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/svgwrite/extensions/shapes.pyngonr s QKLLLq48DGk,A#B#BB R<<JKKK GHHH K+%EE ; '$(5//)ABBBB c # , K | dk rt d |dk rt d |dk rt d t | || }t | |t j | z |z }t || D ] \ }}|V |V dS )a Create a star shape as iterable of (x, y) vertices. Argument `spikes` 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 greater than `r2`. Args: spikes: spike count r1: radius 1 r2: radius 2 rotation: rotation angle in radians Returns: iterable of (x, y) tuples r z+Argument `spikes` has to be greater than 2.r z'Argument `r1` has to be greater than 0.z'Argument `r2` has to be greater than 0.)r r N)r r r r zip)spikesr1r2r corners1corners2s1s2s r starr ( s zzFGGG RxxBCCC RxxBCCCF2999HF2x0GHHHHh)) B r c # 2 K | D ]\ }}||z ||z fV dS )z Translates `vertices` about `delta_x` and `delta_y` Args: vertices: iterable of (x, y) tuples delta_x: translation in x axis delta_y: translation in y axis Returns: iterable of (x, y) tuples N )verticesdelta_xdelta_yxys r translater( F A ) )17{AK((((() )r c # 2 K | D ]\ }}||z ||z fV dS )a Scales `vertices` about `scale_x` and `scale_y` Args: vertices: iterable of (x, y) tuples scale_x: scaling factor in x axis direction scale_y: scaling factor in y axis direction Returns: iterable of (x, y) tuples Nr" )r# scale_xscale_yr&