관리-도구
편집 파일: shapes.cpython-311.pyc
� �܋f� � �: � d Z ddlZd d�Zdd�Zd� 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.)� ValueError�math�sin�pi�range�cos)�num_corners�edge_length�radius�rotation�delta�angle�_s �k/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/svgwrite/extensions/shapes.py�ngonr s� � � � � �Q����K�L�L�L����q��4�8�D�G�k�,A�#B�#B�B��� � ��R�<�<��J�K�K�K� � �G�H�H�H� ���K�+�%�E��E� �;� � � � ��������'��$�(�5�/�/�)A�B�B�B�B� ������ � 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)�spikes�r1�r2r �corners1�corners2�s1�s2s r �starr ( s� � � � � ��z�z��F�G�G�G� �R�x�x��B�C�C�C� �R�x�x��B�C�C�C��F�2��9�9�9�H��F�2�����x�0G�H�H�H�H��h��)�)� � ���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� )�vertices�delta_x�delta_y�x�ys r � translater( F �A � � � � � )� )���1��7�{�A��K�(�(�(�(�(�)� )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"