
    Mii!                         S SK rSSKJrJr  SSKJr  SSKJr  SSKJ	r	J
r
   SS jrSS	 jrS
 rSS jr      SS jrg)    N   )transformationsutil)plane_transform   )arc)ArcLinec           	         SSK Jn  Uc0  [        R                  " S[        R                  S-  US-   5      SS nOM[        U[        5      (       d  [        U[        5      (       a  [        R                  " SXB5      nO[        S5      eUc  SS/n[        R                  " [        R                  " U5      [        R                  " U5      45      U -  n/ n	/ n
U Hr  n[        R                  " S[        R                  /XS	9nU
R                  [        [        R                   " S
5      [#        U	5      -   SS95        U	R%                  U5        Mt     [        R&                  " U	5      U-   n	U" SXS.UD6nU$ )a  
Create a Path2D representing a circle pattern.

Parameters
------------
pattern_radius : float
  Radius of circle centers
circle_radius : float
  The radius of each circle
count : int
  Number of circles in the pattern
center : (2,) float
  Center of pattern
angle :  float
  If defined pattern will span this angle
  If None, pattern will be evenly spaced

Returns
-------------
pattern : trimesh.path.Path2D
  Path containing circular pattern
r   Path2DN               @zangle must be float or int!r   anglescenterradius   Tpointsclosedentitiesvertices )pathr   nplinspacepi
isinstancefloatint
ValueErrorcolumn_stackcossinr   to_threepointappendr	   arangelenextendarray)pattern_radiuscircle_radiuscountr   anglekwargsr   r   centersvertentscircle_centerthreepatterns                 o/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/trimesh/path/creation.pycircle_patternr:   	   s,   2 }S"%%#+uqy9#2>	E5	!	!Zs%;%;S%/677~s oorvvf~rvvf~>?.PGDD !!ruu:m
 	Cryy|c$i7EFE ! 88D>F"D<d<V<GN    c                    SSK Jn  Uc  SS/nO#[        R                  " U[        R                  S9n[        U 5      n [        R                  " S[        R                  /XS9nU" S[        [        R                  " S5      SS	9/US
.UD6nU$ )aP  
Create a Path2D containing circle with the specified
radius.

Parameters
--------------
radius : float
  The radius of the circle
center : None or (2,) float
  Center of the circle, origin by default
** kwargs : dict
  Passed to trimesh.path.Path2D constructor

Returns
-------------
circle : Path2D
  Path containing specified circle
r   r   r   dtyper   r   r   Tr   r   r   )r   r   r   
asanyarrayfloat64r"   r   r(   r    r	   r*   )r   r   r2   r   r7   results         r9   circlerB   C   s    & ~svRZZ86]F aZNE RYYq\$785LRF Mr;   c           	      r   SSK Jn  [        R                  " U [        R                  S9n U R
                  S:X  a2  [        R                  " U 5      S-  n[        R                  " U* U/5      n [        R                  " U S5      (       d'  [        R                  " U S5      (       d  [        S5      e/ n/ nU R                  S5       He  u  pgUR                  [        [        R                  " S	5      S
-  [        U5      -   5      5        UR!                  XgS   US   /XvS   US   //5        Mg     U" SXES.UD6nU$ )a  
Create a Path2D containing a single or multiple rectangles
with the specified bounds.

Parameters
--------------
bounds : (2, 2) float, or (m, 2, 2) float
  Minimum XY, Maximum XY

Returns
-------------
rect : Path2D
  Path containing specified rectangles
r   r   r=   )r   r   )r   r   )r   r   r   z"bounds must be (m, 2, 2) or (2, 2)      r   r   r   )r   r   r   r?   r@   shapeabsr-   r   is_shaper$   reshaper)   r
   r*   r+   r,   )	boundsr2   r   halflinesr   lowerupperrects	            r9   	rectanglerP   i   s     ]]64F ||tvvf~#D5$-( MM&&))T]]6:-N-N=>> EH z2T299Q<!+s8}<=>q58 4eAha=QRS 3
 >5>v>DKr;   c                 b   SSK Jn  / SQn[        R                  " US[        R                  S9R                  S5      nUS-  nU bB  [        R                  " U [        R                  S9n U R                  S	:w  a  [        S
5      eX@-  nUb  [        R                  " XA5      n/ SQnU" XE   5      nU$ )a  
Return a cuboid.

Parameters
------------
extents : float, or (3,) float
  Edge lengths
transform: (4, 4) float
  Transformation matrix
**kwargs:
    passed to Trimesh to create box

Returns
------------
geometry : trimesh.Path3D
  Path outline of a cuboid geometry
r   )	load_path)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   C)orderr>   )r   r   g      ?r=   )r   zExtents must be (3,)!)r   r   r   r   r   rE   rD         rE   r   r   rV   rU   r   r   rD   )exchange.loadrR   r   r-   r@   rI   r?   rF   r$   r   transform_points)extents	transformr2   rR   r   indicesoutlines          r9   box_outliner]      s    $ ) XHxx2::>FFwOHOH --rzz:==D 455 "33HH BG)*GNr;   c                 ~   SSK Jn  [        U 5      n [        U5      n[        R
                  " SXS-   5      SS nUS   n	Sn
/ n/ nU GHZ  nU(       a  [        XS   -  U-  5      n[        R
                  " S[        R                  S-  U5      n[        R                  " [        R                  " U5      [        R                  " U5      45      U-  nUR                  U5        UR                  [        [        R                  " [        U5      5      U
-   S95        U
[        U5      -  n
UR                  U	* U/X/U	* U* /X* /X* /X/U* U	* /U* U	//5        S	 H5  nUR                  [        [        R                  " S5      U
-   U-   S95        M7     U
[        US   5      -  n
GM]     UR                  SU	/SU	* /U	* S/U	S//5        UR                  [        [        R                  " S5      U
-   S95        UR                  [        [        R                  " S5      U
-   S-   S95        [        R                  " U5      nUc,  Ub)  Ub&  [        R                  R!                  [#        X4S
95      n[        R                  " U[        R$                  " [        U5      5      45      nUb  [&        R(                  " XS9nU" XS9nU$ )a  
Create a Path3D for a grid visualization of a plane.

Parameters
-----------
side : float
  Length of half of a grid side
count : int
  Number of grid lines per grid half
transform : None or (4, 4) float
  Transformation matrix to move grid location.
  Takes precedence over plane_origin if both are passed.
plane_origin : None or (3,) float
  Plane origin
plane_normal : None or (3,) float
  Unit normal vector
include_circle : bool
  Include a circular pattern inside the grid
sections_circle : int
  How many sections should the smallest circle have

Returns
----------
grid : trimesh.path.Path3D
  Path containing grid plane visualization
r   )Path3Dr   Nr   r   r   )r   )r   r   rE   rV   )originnormal)matrixr   )r   r_   r"   r#   r   r   r    r%   r&   r'   r)   r
   r*   r+   vstacklinalginvr   zerosr   rX   )sider0   rZ   plane_originplane_normalinclude_circlesections_circler_   radiirmaxcurrentr   r   r
circle_resthetarB   i	grid_paths                      r9   gridrt      ss   F  ;DJEKKT19-ab1E9D GHHa(lo=>JKKRUUQY
;E__bffUmRVVE]%CDqHFOOF#OOD		#f+(>(HIJs6{"G
	r
E
	dUT
		
 AOOD		!w(>(BCD 3x|$$9 > OOaYTE
dUAJq	BCOOD		!w 678OOD		!w 6 :;<yy"H \5,:RIIMM<E
	
 "((3x=*ABCH"33HO<Ir;   )NN)N)rD   NNNT    )numpyr    r   r   geometryr   r   r   r	   r
   r:   rB   rP   r]   rt   r   r;   r9   <module>ry      sL     $ &   >B7t#L*Z(Z er;   