
    Mi
                     f    S r SSKrSSKJrJrJr  S\S\\   S\\   4S jrSS	\S
\S\\   4S jjr	g)zk
interval.py
--------------

Deal with 1D intervals which are defined by:
  [start position, end position]
    N   )	ArrayLikeNDArrayfloat64abreturnc                    [         R                  " U [         R                  S9n [         R                  " U[         R                  S9nU R                  S:H  nU R	                  S5      n UR	                  S5      nU R                  SS9  UR                  SS9  U R                  u  p4UR                  u  pV[         R                  " [         R                  " XT:  X6:  5      5      n[         R                  " U R                  [         R                  S9n[         R                  " [         R                  " X7   XW   /5      R                  SS9[         R                  " XG   Xg   /5      R                  SS945      X'   U(       a  US   $ U$ )aR  
Given pairs of ranges merge them in to
one range if they overlap.

Parameters
--------------
a : (2, ) or (n, 2)
  Start and end of a 1D interval
b : (2, ) float
  Start and end of a 1D interval

Returns
--------------
inter : (2, ) or (2, 2) float
  The unioned range from the two inputs,
  if not np.ptp(`inter, axis=1)` will be zero.
)dtype)   )r   r   axisr   )nparrayr   shapereshapesortTlogical_not
logical_orzeroscolumn_stackmaxmin)	r   r   is_1Da_lowa_highb_lowb_highcheckoverlaps	            j/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/trimesh/interval.pyintersectionr$      s/   $ 	"**%A
"**%A GGtOE			'A			'A FFFNFFFNCCMECCME NN2==%/JKEhhqwwbjj1G__HHelEL1266A6>HHfmV]3488a8@	
GN qzN    	intervalsr   c                    [        U 5      S:X  a  [        R                  " S5      $ U(       a.  [        R                  " U SS9n X SS2S4   R	                  5          n U S   R                  5       /nU SS  H=  u  p4US   S   U:  a  [        US   S   U5      US   S'   M+  UR                  X4/5        M?     [        R                  " U5      $ )a  
For array of multiple intervals union them all into
the subset of intervals.

For example:
`intervals = [[1,2], [2,3]] -> [[1, 3]]`
`intervals = [[1,2], [2.5,3]] -> [[1, 2], [2.5, 3]]`


Parameters
------------
intervals : (n, 2)
  Pairs of `(min, max)` values.
sort
  If the array is already ordered into (min, max) pairs
  and then pairs sorted by minimum value you can skip the
  sorting in this function.

Returns
----------
unioned : (m, 2)
  New intervals where `m <= n`
r   r   r   Nr   )	lenr   r   r   argsorttolistr   appendr   )r&   r   unionsbeginends        r#   unionr/   >   s    0 9~xx{ GGIA.	1o5578	 l!!#$Fm
":a=E!r
1s3F2JqMMM5,'	 $ 88Fr%   )T)
__doc__numpyr   typedr   r   r   r$   boolr/    r%   r#   <module>r5      sY     . .-I -''"2 -ww7G -`,Y ,d ,gg6F ,r%   