谢谢!

解决方案 »

  1.   

    B样条曲线用deBoor递推,计算曲线上的点,然后用小线段连接起来。
    你可以下载我的程序看看 Bezier曲线编辑与绘制   Bspline曲面绘制
    ============================================================================
    提问题时要在标题中简明扼要的说明                    给我发信息请附带原帖地址
    http://www.betajin.com/alphasun/index.htm           
    http://alphasun.18en.com/                    http://shakingtoolkit.9126.com/
    DocWizard C++程序文档自动生成工具 | Wave OpenGL | HttpProxy | AjaxParser词法分析
      

  2.   

    用matlab编的:::%%%%%plot the wave of spline function%set the environment
    %clf reset
    close all   %close all figure
    clear       %clear all var
    clc         %clear the screen
    format long;%set the parameters
    D = 4;   % set the dimension of spline function///////////////////
    step = 0.01;   %set the step of plot
    multiplot = 1;   %plot m figures(1) or only the m-th figure(0)%build the 1-D spline function
    m = 1;
    for x = 0:step:m - step
        n(1,round(x/step + 1)) = 1;
    end%plot the 1-D spline function
    figure(m);
    x = 0:step:m - step;
    plot(x,n(m,:))
    xlabel('m')
    ylabel('N1(x)')
    title('1-D spline function')m = m + 1;   %init the next m
    p(1,:) = [1 0];tic      %set the timer%loop the m-D spline function count
    while(m <= D)
        %count the m-D 
        for x = 0:step:m - step
            %count = fix(x/step + 1);
            count = round(x/step + 1);   %convert count to integer
            temp = count;
            %count1 = fix(x/step - (1/step - 1));
            count1 = round(x/step - (1/step - 1));  %convert count to integer
            
            if count > ( m - 1 ) / step 
                temp2 = 0;
            else
                temp2 = n(m-1,count);
            end
            if count1 < 1 
                temp1 = 0;
            else
                temp1 = n(m-1,count1);
            end
            n(m,temp) = x * temp2/(m-1) + (m-x) * temp1/(m-1);   %formula
        end    %sprint the standard value and max value
        %sprintf('The standard value(p) of %d-D spline function:',m)
        disp(['The standard value(p) of ' int2str(m) '-D spline function:'])
        p(m,1) = 0;
        for t=1:1:m-1
            p(m,t+1) = n(m,t/step + 1);
        end
        p(m,m+1) = 0;
        standardvalue = p(m,:)
        %MAX = sprintf('The Max value(Max) of %d-D spline function:',m)
        disp(['The Max value(Max) of ' int2str(m) '-D spline function:'])
        c = m/step/2 + 1;
        Max = n(m,c)
        
        %%plot the m-th figure;
        if m==D
            multiplot = 1;
        end
        if multiplot
            %plot the m-D  
            figure(m);
            x = 0:step:m - step;
            plot(x,n(m,:),'r')
            xlabel('m')
            ylabel(['N' int2str(m) '(x)'])
            title([int2str(m) '-D spline function'])
            
            %set the tick of axes-x,axes-y
            t = 1:1:m;
            set(gca,'xtick',t)
            t = 0:0.04:1;
            set(gca,'ytick',t)
            grid on
       
            toc      %kill the timer after any count
        end
        
        %next m
        m=m+1;
    end%%toc      %kill the timer