
    Mi                        % S r SSKrSSKJr  SSKJr  SSKJr  SSK	J
r
JrJrJrJr   SSKJrJr    SS	\S
\
S\4S jjr  SS	\S
\
S\4S jjr  SS	\S
\
S\4S jjr SS	\S\S\4S jjr0 r\\\4   \S'   \" \\5      (       a  \\S'   O\\S'   \R:                  R<                  (       a  \R:                  R>                  \S'   O\" \ " S5      5      \S'   \!" S \RE                  5        5       \" \ " S5      5      5      \S'   \RG                  5        V Vs1 s H  u  p\" U\5      (       a  M  U iM     snn r$g! \ a  r\" \5      r\" \5      r SrCGN%SrCff = fs  snn f )z]
boolean.py
-------------

Do boolean operations on meshes using either Blender or Manifold.
    N   )
interfaces)ExceptionWrapper)reduce_cascade)BooleanEngineTypeBooleanOperationTypeCallableDictSequence)ManifoldMeshmeshesenginecheck_volumec                 (    [         U   " U 4SUS.UD6$ )a  
Compute the boolean difference between a mesh an n other meshes.

Parameters
----------
meshes : sequence of trimesh.Trimesh
  Meshes to be processed.
engine
  Which backend to use, i.e. 'blender' or 'manifold'
check_volume
  Raise an error if not all meshes are watertight
  positive volumes. Advanced users may want to ignore
  this check as it is expensive.
kwargs
  Passed through to the `engine`.

Returns
----------
difference
  A `Trimesh` that contains `meshes[0] - meshes[1:]`

difference	operationr   _enginesr   r   r   kwargss       i/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/trimesh/boolean.pyr   r      s+    8 F&\EK     c                 (    [         U   " U 4SUS.UD6$ )a  
Compute the boolean union between a mesh an n other meshes.

Parameters
----------
meshes : list of trimesh.Trimesh
  Meshes to be processed
engine : str
  Which backend to use, i.e. 'blender' or 'manifold'
check_volume
  Raise an error if not all meshes are watertight
  positive volumes. Advanced users may want to ignore
  this check as it is expensive.
kwargs
  Passed through to the `engine`.

Returns
----------
union
  A `Trimesh` that contains the union of all passed meshes.
unionr   r   r   s       r   r   r   7   s+    6 F!@F r   c                 (    [         U   " U 4SUS.UD6$ )a  
Compute the boolean intersection between a mesh and other meshes.

Parameters
----------
meshes : list of trimesh.Trimesh
  Meshes to be processed
engine : str
  Which backend to use, i.e. 'blender' or 'manifold'
check_volume
  Raise an error if not all meshes are watertight
  positive volumes. Advanced users may want to ignore
  this check as it is expensive.
kwargs
  Passed through to the `engine`.

Returns
----------
intersection
  A `Trimesh` that contains the intersection geometry.
intersectionr   r   r   s       r   r   r   W   s+    6 F(|GM r   r   c                    U(       a"  [        S U  5       5      (       d  [        S5      eU  Vs/ s Hj  n[        [        [        R
                  " UR                  [        R                  S9[        R
                  " UR                  [        R                  S9S9S9PMl     nnUS:X  a]  [        U 5      S:  a  [        S5      e[        U 5      S:X  a  US	   US
   -
  nO_[        U 5      S:  a  [        S US
S 5      nUS	   U-
  nO7US:X  a  [        S U5      nO#US:X  a  [        S U5      nO[        SU S35      eS
SKJn  WR                  5       n	U" U	R                  U	R                   SS9$ s  snf )a{  
Run an operation on a set of meshes using the Manifold engine.

Parameters
----------
meshes : list of trimesh.Trimesh
  Meshes to be processed
operation
  Which boolean operation to do.
check_volume
  Raise an error if not all meshes are watertight
  positive volumes. Advanced users may want to ignore
  this check as it is expensive.
kwargs
  Passed through to the `engine`.
c              3   8   #    U  H  oR                   v   M     g 7fN)	is_volume).0ms     r   	<genexpr>#boolean_manifold.<locals>.<genexpr>   s     <VVs   zNot all meshes are volumes!)dtype)vert_properties	tri_verts)meshr      z(Difference only defined over two meshes.r   r   c                 
    X-   $ r!    abs     r   <lambda>"boolean_manifold.<locals>.<lambda>   s    !%r   Nr   c                 
    X-   $ r!   r-   r.   s     r   r1   r2          aer   r   c                 
    X-  $ r!   r-   r.   s     r   r1   r2      r4   r   zInvalid boolean operation: '')TrimeshF)verticesfacesprocess)all
ValueErrorr   r   nparrayr8   float32r9   uint32lenr    r7   to_meshr(   r)   )
r   r   r   r   r*   	manifoldsresult_manifoldunionedr7   result_meshs
             r   boolean_manifoldrH   w   sg   , C<V<<<677  D 	 "bjj I((4::RYY?	
    L v;?GHH[A'lYq\9O[1_$%712GG'lW4O	g	();YG	n	$();YG7	{!DEE !))+K,,K4I4ISX Es   A1E-r   manifoldblenderz`blender` is not in `PATH`c              #   T   #    U  H  n[        U[        5      (       a  M  Uv   M      g 7fr!   )
isinstancer   )r#   vs     r   r%   r%      s     I!1A7G)HQQ!s   (	(zANo boolean backend: `pip install manifold3d` or install `blender`)NT)T)%__doc__numpyr=   rB   r   
exceptionsr   	iterationr   typedr   r   r	   r
   r   
manifold3dr   r   BaseExceptionEboolr   r   r   rH   r   str__annotations__rL   rJ   existsbooleanImportErrornextvaluesitemsengines_available)krM   s   00r   <module>ra      s     ( % T T#) !% F !% D !% F >>#> >D !#$sH}
 "h())#HZ ,HZ $,,44HY +;7S+TUHY I!IWX ..""$!*Q8H*IA" C  #AD"H#Bs#   D: E/E:E EE