
    jI                         d dl mZ d dlZddlmZmZmZ e G d d             Ze G d d             Z	e G d	 d
             Z
 e       Z e	       Z e
       Zd Zy)    )	dataclassN   )decimal_to_digitslognowc                       e Zd ZU dZ ej
                  ej                        j                  dz  Ze	e
d<   dZe	e
d<   dZe	e
d<   dZee
d	<   d
Zee
d<   y)ToleranceMesha  
    ToleranceMesh objects hold tolerance information about meshes.

    Parameters
    ----------------
    tol.zero : float
      Floating point numbers smaller than this are considered zero
    tol.merge : float
      When merging vertices, consider vertices closer than this
      to be the same vertex. Here we use the same value (1e-8)
      as SolidWorks uses, according to their documentation.
    tol.planar : float
      The maximum distance from a plane a point can be and
      still be considered to be on the plane
    tol.facet_threshold : float
      Threshold for two facets to be considered coplanar
    tol.strict : bool
      If True, run additional in- process checks (slower)
    d   zerog:0yE>mergeh㈵>planari  facet_thresholdFstrictN)__name__
__module____qualname____doc__npfinfofloat64
resolutionr   float__annotations__r   r   r   intr   bool     >/DATA/.local/lib/python3.12/site-packages/trimesh/constants.pyr	   r	      s]    , "((2::&11C7D%7 E5 FE  OS FDr   r	   c                   b   e Zd ZU dZdZeed<   dZeed<   dZeed<   dZ	eed<    e e
j                  d	            Zeed
<    e e
j                  d            Zeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZeed<    e e
j                  d            Zeed<   dZeed<   edefd       Zy)TolerancePatha_  
    TolerancePath objects contain tolerance information used in
    Path objects.

    Parameters
    ---------------
    tol.zero : float
      Floating point numbers smaller than this are considered zero
    tol.merge : float
      When merging vertices, consider vertices closer than this
      to be the same vertex. Here we use the same value (1e-8)
      as SolidWorks uses, according to their documentation.
    tol.planar : float
      The maximum distance from a plane a point can be and
      still be considered to be on the plane
    tol.seg_frac : float
      When simplifying line segments what percentage of the drawing
       scale can a segment be and have a curve fitted
    tol.seg_angle : float
      When simplifying line segments to arcs, what angle
      can a segment span to be acceptable.
    tol.aspect_frac : float
      When simplifying line segments to closed arcs (circles)
      what percentage can the aspect ratio differfrom 1:1
      before escaping the fit early
    tol.radius_frac : float
      When simplifying line segments to arcs, what percentage
      of the fit radius can vertices deviate to be acceptable
    tol.radius_min :
       When simplifying line segments to arcs, what is the minimum
       radius multiplied by document scale for an acceptable fit
    tol.radius_max :
       When simplifying line segments to arcs, what is the maximum
       radius multiplied by document scale for an acceptable fit
    tol.tangent :
       When simplifying line segments to curves, what is the maximum
       angle the end sections can deviate from tangent that is
       acceptable.
    g-q=r   r   r   r   g      ?seg_frac2   	seg_angler   seg_angle_ming      ?seg_angle_fracg?aspect_fracg{Gz?radius_fracg-C6?
radius_ming      I@
radius_max   tangentFr   returnc                 ,    t        | j                        S )N)r   r   )selfs    r   merge_digitszTolerancePath.merge_digitsh   s     ,,r   N)r   r   r   r   r   r   r   r   r   r"   r   radiansr$   r%   r&   r'   r(   r)   r*   r,   r   r   propertyr   r0   r   r   r   r!   r!   /   s    &P D%E5FEHeZRZZ^,Iu, A/M5/NEKKJJ:2::b>*GU*FD-c - -r   r!   c                   X    e Zd ZU dZdZeed<   dZeed<   dZeed<   dZ	eed	<   d
Z
eed<   y)ResolutionPatha8  
    res.seg_frac : float
      When discretizing curves, what percentage of the drawing
      scale should we aim to make a single segment
    res.seg_angle : float
      When discretizing curves, what angle should a section span
    res.max_sections : int
      When discretizing splines, what is the maximum number
      of segments per control point
    res.min_sections : int
      When discretizing splines, what is the minimum number
      of segments per control point
    res.export : str
      Format string to use when exporting floating point vertices
    g?r"   g{Gz?r$   g     @@max_sectionsg      4@min_sectionsz0.10fexportN)r   r   r   r   r"   r   r   r$   r5   r6   r7   strr   r   r   r4   r4   m   s;      HeIuL%L%FCr   r4   c                 V      fd} j                   |_          j                  |_        |S )z
    A decorator for methods which will time the method
    and then emit a log.debug message with the method name
    and how long it took to execute.
    c                      t               } | i |}t        j                  dj                  t               |z
         |S )Nz%s executed in %.4f seconds.)r   r   debugr   )argskwargsticresultmethods       r   timedzlog_time.<locals>.timed   s9    e((		0&//353;Or   )r   r   )r@   rA   s   ` r   log_timerB      s%     __ENNNEMLr   )dataclassesr   numpyr   utilr   r   r   r	   r!   r4   toltol_pathres_pathrB   r   r   r   <module>rI      s}    !  - - # # #L :- :- :-z   2 o ?r   