
    Miq                     h    S r SSKJr  SSKrSSKJr  SSKJr  \R                  " / SQ5      r
S rS	 rg)
z[
comparison.py
----------------

Provide methods for quickly hashing and comparing meshes.
    )sha256N   )util)tol)   
   r      r	      r   c                    U R                   R                  5         U R                      [        R                  " S[        R                  S9nU R
                  nX!S'   U[        R                  :  a  SnU R                  US'   U R                  (       a  US-  S-  U R                  S-  -  US	'   O U R                  nUR
                  nUR                  nX$-  US
'   US:  a  US-  S-  US-  -  US'   U R                  U R                  -
  n[        R                  " US	-  / SQ5      R!                  5       nXr-  US'   SSS5        [#        U R$                  5      S:  Ga  U R&                  nUR)                  5       UR+                  5       -  n	U	S:  a  XR,                     R/                  S5      n
[        R0                  " [        R2                  " XSS2S4   45      SS9n[        R4                  " U5      R7                  SS9nUR/                  S5      U[        R8                  " [#        U5      5      S
-  -      n[        R:                  " UR=                  5       5      WS'   W$ ! [         a    SnSn GNf = f! , (       d  f       GNB= f)a4  
Return a basic identifier for a mesh consisting of
properties that have been hand tuned to be somewhat
robust to rigid transformations and different
tessellations.

Parameters
------------
mesh : trimesh.Trimesh
  Source geometry

Returns
----------
identifier : (7,) float
  Identifying values of the mesh
   )dtyper   g      ?r   g      @g      ?gUUUUUU?r	   r
   g-q=   )r   r   r   r   N2   g      ?)r
   )axisr      )_cacheverifynpzerosfloat64arear   mergeeuler_number	is_volumevolumeconvex_hullBaseExceptionverticescentroiddotmaxlenfacesedges_unique_lengthstdmeanedges_unique_inversereshapediffcolumn_stackabsargminarangesignsum)mesh
identifier	mesh_areahull	hull_areahull_volumer   R2edges_lengthvariancenormsstackpick_idxpicks                 l/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/trimesh/comparison.pyidentifier_simpler?      s6   $ 	KK
 
 XXarzz2
II	 "1syy I ))
1 >> (#o9=	*JqM"'' II	"kk &1JqMU""+c/y!AI.!
1 }}t}}4H1y1557BNJqM_ 
j 4:: //##%(9(9(;;d? !:!:;CCGLEGGBOOU!Q$K,@AJEvve}+++3H==$X3x=1IA1M%NODGGDHHJ/JqMK ! "	!"A 
s1   BI5.$I A(I5 I2.I51I22I55
Jc                 R   [         R                  " U [        5      u  pUS:  R                  5       (       a'  U[        R
                  " UR                  5       5      -  nUSU-  -  R                  [        R                  5      n[        UR                  5       5      R                  5       $ )a	  
Hash an identifier array in a way that is hand-tuned to be
somewhat robust to likely changes.

Parameters
------------
identifier : (n,) float
  Vector of properties

Returns
----------
hash : (64,) str
  A SHA256 of the identifier vector at hand-tuned precision.
r   r   )r   
sigfig_int	id_sigfiganyr   r,   minastypeint64r   tobytes	hexdigest)r2   as_int
multiplierdatas       r>   identifier_hashrL   }   s}    " Y?F 	QbffZ^^-..
b*n%--bhh7D$,,.!++--    )__doc__hashlibr   numpyr    r   	constantsr   arrayrB   r?   rL    rM   r>   <module>rU      s9        HH
	\~.rM   