
    CPc	                         d Z ddlZddlZ G d dej                  Zedk    r e                                             dS dS )z"Whirl path extension (modify path)    Nc                   4    e Zd ZdZd Zd Zed             ZdS )Whirlz2Modify a path by twisting the nodes around a pointc                     |                     ddt          dd           |                     ddt          j        dd	           d S )
Nz-tz--whirlg      @zamount of whirl)typedefaulthelpz-rz
--rotationTzdirection of rotation)add_argumentfloatinkexBoolean)selfparss     '/usr/share/inkscape/extensions/whirl.pyadd_argumentszWhirl.add_arguments   se    )%;L 	 	
 	
 	
 	( 	 	
 	
 	
 	
 	
    c                     | j         j        j        }| j        j        rdnd}| j        j        dz  }| j         j                            t          j	                  D ]}| 
                    ||||           d S )N   i  )svg	namedviewcenteroptionsrotationwhirl	selectionfilterr   PathElement
whirl_node)r   view_centerr   r   nodes        r   effectzWhirl.effect)   s    h(/-5112"T)H&--e.?@@ 	@ 	@DOOK5$????	@ 	@r   c                 2   |j                                         }|D ]}|D ]}|D ]}|dxx         | d         z  cc<   |dxx         | d         z  cc<   t          j        |d         dz  |d         dz  z             }|dk    r`||z  |z  }	t          j        |d         |d                   |	z   }
|t          j        |
          z  |d<   |t          j        |
          z  |d<   |dxx         | d         z  cc<   |dxx         | d         z  cc<   ||_         dS )z>Apply a whirl to a path given the center, direction and amountr   r      N)pathto_superpathmathsqrtatan2cossin)r   	directionammountr    r$   subcsppointdistartthetas              r   r   zWhirl.whirl_node0   sK    y%%'' 	* 	*C * *  
* 
*E!HHHq	)HHH!HHHq	)HHH9eAh!maA%FGGDqyy'$.8 $
58U1X > > D#'$(5//#9a#'$(5//#9a!HHHq	)HHH!HHHq	)HHHH
** 			r   N)__name__
__module____qualname____doc__r   r!   staticmethodr    r   r   r   r      sV        <<

 

 

@ @ @   \  r   r   __main__)r6   r&   r   EffectExtensionr   r3   runr8   r   r   <module>r<      sy   ( ) (  ' ' ' ' 'E! ' ' 'T z	EGGKKMMMMM r   