
    j                     ,    d dl ZddlmZ ddlmZ ddZy)    N   )util)tol_pathc                    t        j                  | d      \  } }t        j                  |d      \  }}|t        j                  |      j                  d      z  }t	        j
                  t	        j                  t	        j                  |d                  t        j                  k  ry| \  }}|\  }}||z
  }|8t	        j                  ||      }|t        j                  j                  |      z  }t	        j                  ||      }	|	t        j                  j                  |	      z  }	t        j                  j                  |      }
|
t        j                  kD  r4t        t	        j                  |||
z              t        j                  kD  ryt	        j                  |	 |      t	        j                  |	|      z  }|||z  z   }d|dd|z
   fS )	a  
    Find the intersection between two lines.
    Uses terminology from:
    http://geomalgorithms.com/a05-_intersect-1.html

    line 1:    P(s) = p_0 + sU
    line 2:    Q(t) = q_0 + tV

    Parameters
    ---------
    origins : (2, d) float
      Points on lines (d in [2,3])
    directions : (2, d) float
      Direction vectors
    plane_normal : (3, ) float
      If not passed computed from cross

    Returns
    ---------
    intersects : bool
      Whether the lines intersect.
        In 2D, false if the lines are parallel
        In 3D, false if lines are not coplanar
    intersection : (d,) float or None
      Point of intersection
    T)	return_2D)   r   )axis)FNN   )r   stack_3Drow_normreshapenpsumabsdifftolzerocrosslinalgnormdot)origins
directionsplane_normalis_2Dq_0p_0vuwv_perpw_norms_Iintersections                G/DATA/.local/lib/python3.12/site-packages/trimesh/path/intersections.py	line_liner'      sx   8 ]]7d;NGUjDAJ $--
+33G<<J 
vvbffRWWZa012SXX= HCDAqc	A xx1~		|44 XXa&F
biinnV$$F
 YY^^AFSa&j!ABSXXM &&&!
rvvfa0
0Cq=LmU,,,    )N)numpyr    r   	constantsr   r   r'    r(   r&   <module>r-      s      'B-r(   