
    Mi/                     Z    S SK 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\S	\	4S
 jrg)    N   )res_path)tol_path)IntegerListc           
      F   [         R                  " U [         R                  S9n Uc  [         R                  R	                  [         R
                  " U SS9SS9R                  5       n[         R                  " U[        R                  U-  -  5      n[        [         R                  " U[        R                  [        U 5      -  [        R                  [        U 5      -  5      5      n[        U5      n[         R                  " SSU5      nSU-
  n[        U 5      S-
  n[!        [#        U5      [         R$                  " [        U 5      5      U 5      nU VV	V
s/ s H'  u  poU	-  XVU	-
  -  -  R'                  S5      U
-  U-  PM)     nn	nn
[         R                  " USS9n[(        R*                  (       a^  [         R                  " USS/   U SS/   -
  S	-  SS9nU[(        R,                  :  R/                  5       (       d   e[        U5      S	:  d   eU SS/   USS/'   U$ s  sn
n	nf )
a3  
Parameters
----------
points : (order, dimension) float
  Control points of the bezier curve
  For a 2D cubic bezier, order=3, dimension=2
count : int, or None
  Number of segments
scale : float
  Scale of curve
Returns
----------
discrete: (n, dimension) float
 Points forming a a polyline representation
dtyper   axis   g              ?)r   r   r   )np
asanyarrayfloat64linalgnormdiffsumceilresseg_fracintclipmin_sectionslenmax_sectionslinspacezipbinomialarangereshapetolstrictmergeall)pointscountscaler   tt_dniterablecipstackedresulttests                 l/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/trimesh/path/curve.pydiscretize_bezierr6      s   " ]]64F} yy~~bggf15A~>BBDu 456GGE3++c&k93;K;KcRXk;YZ
 JE 	Ce$A
'CFaA8A;		#f+ 6?H MULTqQ$3q5>	"++G4q81<H   VVG!$F zzvvvq"gB8Q>QGsyy %%''''6{a aWoFAr7OMs   .Hc           
      t   SSK Jn  [        R                  " U [        R                  S9n [        U5      [        U 5      -
  S-
  nUc  [        R                  R                  [        R                  " U SS9SS9R                  5       n[        [        R                  " U[        R                  U-  -  [        R                  [        U 5      -  [        R                  [        U 5      -  5      5      n[        R                   " US   US   U5      nU" XqU R"                  U/5      n[        R$                  " U5      nU$ )a  
Given a B-Splines control points and knot vector, return
a sampled version of the curve.

Parameters
----------
control : (o, d) float
  Control points of the b- spline
knots : (j,) float
  B-spline knots
count : int
  Number of line segments to discretize the spline
  If not specified will be calculated as something reasonable

Returns
----------
discrete : (count, dimension) float
   Points on a polyline version of the B-spline
r   )splevr	   r   r   r   )scipy.interpolater8   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Tcolumn_stack)	controlknotsr)   r*   r8   degreer   ipldiscretes	            r5   discretize_bsplinerA   ?   s    , ( mmG2::6GZ#g,&*F}yy~~bgggA6Q~?CCEGGu,-  3w</  3w</
 ++eAhb	5
1CS'))V45Hx(HO    r-   returnc                     U S:X  a  SS/$ U S:X  a  / SQ$ U S:X  a  / SQ$ U S:X  a  / SQ$ U S:X  a  / S	Q$ S
SK Jn  U" U [        R                  " U S-   5      5      $ )z
Return all binomial coefficients for a given order.

For n > 5, scipy.special.binom is used, below we hardcode.

Parameters
--------------
n : int
  Order of binomial

Returns
---------------
binom : (n + 1,) int
  Binomial coefficients of a given order
r   r   )r   r   r      )r   rE   rE   r      )r   rF      rF   r      )r   rH   
   rI   rH   r   r   )binom)scipy.specialrJ   r   r"   )r-   rJ   s     r5   r!   r!   k   se      	Av1v	
a	
a	
a	
a##'Q		!a%())rB   )Nr   )numpyr   	constantsr   r   r   r$   typedr   r   r6   rA   r!    rB   r5   <module>rP      s0     ' ' !4n)X* *D *rB   