Ë
    :vžjg  ã                   óÈ   — d Z ddlZ	 ddlmZmZmZ ddlmZmZ 	 	 	 	 	 dddd	eez  dz  d
edz  fd„Zy# e$ r(Zddl	m
Z
  e
j                  e«      ZeZeZeZY dZ[ŒJdZ[ww xY w)zP
raster.py
------------

Turn 2D vector paths into raster images using `pillow`
é    N)ÚImageÚ
ImageChopsÚ	ImageDrawé   )Ú
exceptions)Ú	ArrayLikeÚFloatingÚpathztrimesh.path.Path2DÚpitchÚoriginc                 óX  — |€e|�Ft        j                  |t         j                  ¬«      }| j                  |dz   z  j	                  «       }n| j                  j	                  «       dz  }|€| j
                  d   |dz  z
  }t        j                  |t         j                  ¬«      }t        j                  |t         j                  ¬«      }|€Qt        j                  t        j                  | j
                  |f«      d¬«      }t        j                  ||z  «      dz   }t        j                  |t         j                  ¬«      }t        |j                  «       «      }| j                  D �cg c]5  }||z
  |z  j                  «       j                  t         j                  «      ‘Œ7 }}| j                   }	| j"                  }
t%        j&                  d|¬«      }t)        j*                  |«      }|�Ft-        |«      }|D ]2  }|j/                  |j1                  «       j                  «       d	|¬
«       Œ4 |s|S |	D ]p  }|j3                  ||   j1                  «       j                  «       d	¬«       |
|   D ]4  }|j3                  ||   j1                  «       j                  «       d¬«       Œ6 Œr |S c c}w )aI  
    Rasterize a Path2D object into a boolean image ("mode 1").

    Parameters
    ------------
    path : Path2D
      Original geometry
    pitch : float or (2,) float
      Length(s) in model space of pixel edges
    origin : (2,) float
      Origin position in model space
    resolution : (2,) int
      Resolution in pixel space
    fill :  bool
      If True will return closed regions as filled
    width : int
      If not None will draw outline this wide in pixels

    Returns
    ------------
    raster : PIL.Image
      Rasterized version of input as `mode 1` image
    )Údtyper   i   r   g       @)ÚaxisÚ1)ÚmodeÚsizeé   )ÚfillÚwidth)r   )ÚnpÚarrayÚint64ÚextentsÚmaxÚboundsÚ
asanyarrayÚfloat64ÚptpÚvstackÚceilÚtupleÚtolistÚdiscreteÚroundÚastypeÚrootÚenclosure_directedr   Únewr   ÚDrawÚintÚlineÚflattenÚpolygon)r
   r   r   Ú
resolutionr   r   ÚspanÚir#   ÚrootsÚ	enclosureÚresultÚdrawÚcoordsr&   Úchilds                   úd/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/trimesh/path/raster.pyÚ	rasterizer8      s0  € ð@ €}ØÐ!ÜŸ™ *´B·H±HÔ=ˆJà—\‘\ Z°!¡^Ñ4×9Ñ9Ó;‰Eà—L‘L×$Ñ$Ó&¨Ñ-ˆEà€~Ø—‘˜Q‘ 5¨3¡;Ñ/ˆô �M‰M˜%¤r§z¡zÔ2€EÜ�]‰]˜6¬¯©Ô4€Fð ÐÜ�v‰v”b—i‘i §¡¨fÐ 5Ó6¸QÔ?ˆÜ—W‘W˜T E™\Ó*¨QÑ.ˆ
ä—‘˜z´·±Ô:€JÜ�z×(Ñ(Ó*Ó+€Jð JNÏÊÓWÉÀA�!�f‘* Ñ%×,Ñ,Ó.×5Ñ5´b·h±hÕ?È€HÐWð �I‰I€EØ×'Ñ'€Iô �Y‰Y˜C jÔ1€FÜ�>‰>˜&Ó!€Dð ÐÜ�E“
ˆÛˆFØ�I‰I�f—n‘nÓ&×-Ñ-Ó/°a¸uˆIÕEð ñ ØˆMó
 ˆà�‰�X˜d‘^×+Ñ+Ó-×4Ñ4Ó6¸QˆÔ?à˜t”_ˆEØ�L‰L˜ %™×0Ñ0Ó2×9Ñ9Ó;À!ˆLÕDñ %ð	 ð €Mùò= Xs   Å(:J')NNNTN)Ú__doc__Únumpyr   ÚPILr   r   r   ÚBaseExceptionÚEÚ r   ÚExceptionWrapperÚ_handleÚtypedr   r	   r8   © ó    r7   Ú<module>rD      sš   ðñó ð
ç0Ñ0÷ (ð
 *.Ø#ØØ	Ø
ñVØ
ðVà�iÑ $Ñ&ðVð ˜ÑôVøð ò Ýð *ˆj×)Ñ)¨!Ó,€GØ€EØ€IØ…Jûðús   ˆ
4 ´A!¹AÁA!