
    Ti[                     l    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dS )	    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	        |          }|                                s|S t          j        g d          }|*t          j        ||                                df          }nNt          j        t          j        |                              d          |                                df          }|                     t          j        ||         ||         f          t          j        || f          d	          \  }}}	t          |          d
k    r|S t          j        |t          |          dz                                d          }
t          j        |
d          dk    }t          j        | }|                                }|||<   |d
         |         ||<   |
d
k                        d
          }t          j        t          j        |          t          j        |                    }|                                s|S |t          j        t           j                            d          dz
            }|                                }|||<   t7          | ||         |         |          ||<   t8          j                            d|                                           |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?N   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                    N/DATA/AppData/hermes/venv/lib/python3.11/site-packages/trimesh/ray/ray_util.pyr,   r,      s   * ]6444F=)) 1/000 xF4000H /+"2"96BBK ??  !O!O!OPP !2[__5F5F4JKK H_%%--a00;??3D3Da2H
 
  +>>
	6+&{(;<==
	>N?344  ?    Iy" 9~~ k)s>/B/BQ/FGGGOOPWXXG&!$$)K Hk"E DDJ !^E*HTN \&&A&..M ^BN5112>-3P3PQQF ::<< 
 RY%5%5a%8%83%>??!!T
(,V4m
 
 
 	@&**,,	
 	
 	
 O    )N)numpyr    r   r   r   typedr   r   log_timer   r,    r>   r=   <module>rD      s        & & & & & & & & & & ' ' ' ' ' ' ' ' FJr r"r5=d^r r r r r rr>   