
    j[                     h    d dl ZddlmZmZmZ ddlmZmZ ej                  	 ddedee
   fd       Zy)	    N   )bounds	constantsutil)	ArrayLikeOptionalpointscheck_directionc                    t        j                  |t         j                        }t        j                  |d      st        d      t        j                  t        |      t              }t        j                  | j                  j                  |      }|j                         s|S t        j                  g d      }|'t        j                  ||j                         df      }nHt        j                  t        j                  |      j!                  d      |j                         df      }| j#                  t        j$                  ||   ||   f      t        j$                  || f      d      \  }}}	t        |      d	k(  r|S t        j&                  |t        |      d
z        j!                  d      }
t        j(                  |
d
      dk(  }t        j*                  | }|j-                         }|||<   |d	   |   ||<   |
d	k(  j                  d	      }t        j.                  t        j0                  |      t        j0                  |            }|j                         s|S |t        j2                  t         j4                  j5                  d      dz
        }|j-                         }|||<   t7        | ||   |   |      ||<   t8        j:                  j=                  d|j                                |S )aR  
    Check if a mesh contains a set of points, using ray tests.

    If the point is on the surface of the mesh, behavior is
    undefined.

    Parameters
    ---------
    mesh: Trimesh object
    points: (n,3) points in space

    Returns
    ---------
    contains : (n) bool
                  Whether point is inside mesh or not
    )dtype)   zpoints must be (n,3))gos ?g03^?g?   r   T)multiple_hitsr   r   )	minlength)r   r   )axisg      ?)r
   z2detected %d broken contains test, attempted to fix)np
asanyarrayfloat64r   is_shape
ValueErrorzeroslenboolr   containsmeshanyarraytilesumreshapeintersects_locationvstackbincountmodequalcopylogical_andlogical_notunitizerandomcontains_pointsr   logdebug)intersectorr	   r
   r   inside_aabbdefault_directionray_directions	_location	index_ray_cbi_hitsbi_containsagreemaskone_freespacebrokennew_directions                    A/DATA/.local/lib/python3.12/site-packages/trimesh/ray/ray_util.pyr,   r,      s   * ]]64F==)/00 xxF40H //+"2"2"9"96BK ?? !OP !2[__5F4JK HH_%--a0;??3Da2H
  +>>
		6+&{(;<=
		>N?34  ?  Iy" 9~ kk)s>/BQ/FGOOPWXG&&!$)K HHk"E DDJ !^E*HTN \&&A&.M ^^BNN512>>-3PQF ::<
 RYY%5%5a%83%>?!T
(,V4m
 	@&**,	
 O    )N)numpyr    r   r   r   typedr   r   log_timer   r,    r>   r=   <module>rD      sF     & & ' FJr"r5=d^r rr>   