资源简介

NURBS曲线、曲面拟合的matlab工具箱,加载到path中,可以随时调用,对机床的刀具补偿曲线拟合具有十分大的帮助

资源截图

代码片段和文件信息

function N = basisfun(iupU)                 
% BASISFUN  Basis function for B-Spline 
% ------------------------------------------------------------------------- 
% ADAPTATION of BASISFUN from C Routine 
% ------------------------------------------------------------------------- 

% Calling Sequence: 
%  
%   N = basisfun(iupU) 
%    
%    INPUT: 
%    
%      i - knot span  ( from FindSpan() ) 
%      u - parametric point 
%      p - spline degree 
%      U - knot sequence 
%    
%    OUTPUT: 
%    
%      N - Basis functions vector[p+1] 
%    
%    Algorithm A2.2 from ‘The NURBS BOOK‘ pg70. 
                                                 
                                                  %   void basisfun(int i double u int p double *U double *N) { 
                                                  %   int jr; 
                                                  %   double saved temp; 
i = i + 1; 
                                                  %   // work space 
left = zeros(p+11);                              %   double *left  = (double*) mxMalloc((p+1)*sizeof(double)); 
right = zeros(p+11);                             %   double *right = (double*) mxMalloc((p+1)*sizeof(double)); 
                                                
N(1) = 1;                                         %   N[0] = 1.0; 
for j=1:p                                         %   for (j = 1; j <= p; j++) { 
    left(j+1) = u - U(i+1-j);                     %   left[j]  = u - U[i+1-j]; 
    right(j+1) = U(i+j) - u;                      %   right[j] = U[i+j] - u; 
    saved = 0;                                    %   saved = 0.0; 
 
    for r=0:j-1                                   %   for (r = 0; r < j; r++) { 
        temp = N(r+1)/(right(r+2) + left(j-r+1)); %   temp = N[r] / (right[r+1] + left[j-r]); 
        N(r+1) = saved + right(r+2)*temp;         %   N[r] = saved + right[r+1] * temp; 
        saved = left(j-r+1)*temp;                 %   saved = left[j-r] * temp; 
    end                                           %   } 
 
    N(j+1) = saved;                               %   N[j] = saved; 
end                                               %   } 
   
                                                  %   mxFree(left); 
                                                  %   mxFree(right); 
                                                  %   } 


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1331  2010-01-16 08:12  nurbs_toolbox\license.txt

     文件       2430  2010-01-16 22:24  nurbs_toolbox\nurbs_toolbox\basisfun.m

     文件      20521  2010-01-16 22:33  nurbs_toolbox\nurbs_toolbox\bspdegelev.m

     文件       2947  2010-01-16 22:33  nurbs_toolbox\nurbs_toolbox\bspderiv.m

     文件       3314  2010-01-16 22:32  nurbs_toolbox\nurbs_toolbox\bspeval.m

     文件       5698  2010-01-16 22:32  nurbs_toolbox\nurbs_toolbox\bspkntins.m

     文件       2019  2010-01-16 22:32  nurbs_toolbox\nurbs_toolbox\Contents.m

     文件        594  2010-01-16 22:32  nurbs_toolbox\nurbs_toolbox\deg2rad.m

     文件        259  2010-01-16 22:31  nurbs_toolbox\nurbs_toolbox\demo4surf.m

     文件        311  2010-01-16 22:31  nurbs_toolbox\nurbs_toolbox\democirc.m

     文件        966  2010-01-16 22:31  nurbs_toolbox\nurbs_toolbox\democoons.m

     文件        629  2018-03-29 10:43  nurbs_toolbox\nurbs_toolbox\democurve.m

     文件        282  2010-01-16 22:31  nurbs_toolbox\nurbs_toolbox\democylind.m

     文件        526  2010-01-16 22:31  nurbs_toolbox\nurbs_toolbox\demodegelev.m

     文件        770  2018-04-04 22:00  nurbs_toolbox\nurbs_toolbox\demodercrv.m

     文件        857  2010-01-16 22:30  nurbs_toolbox\nurbs_toolbox\demodersrf.m

     文件        404  2010-01-16 22:30  nurbs_toolbox\nurbs_toolbox\demoellip.m

     文件        763  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demogeom.m

     文件        637  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demohelix.m

     文件        577  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demokntins.m

     文件        216  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demoline.m

     文件        245  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demorect.m

     文件        917  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demorevolve.m

     文件        427  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demoruled.m

     文件       1347  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demos.m

     文件        518  2010-01-16 22:40  nurbs_toolbox\nurbs_toolbox\demotorus.m

     文件       2163  2018-03-26 15:25  nurbs_toolbox\nurbs_toolbox\findspan.m

     文件       1374  2010-01-16 22:39  nurbs_toolbox\nurbs_toolbox\nrb4surf.m

     文件       2350  2010-01-16 22:39  nurbs_toolbox\nurbs_toolbox\nrbcirc.m

     文件       4072  2018-03-29 10:23  nurbs_toolbox\nurbs_toolbox\nrbcoons.m

............此处省略35个文件信息

评论

共有 条评论