-
大小: 90KB文件类型: .gz金币: 1下载: 0 次发布日期: 2021-05-05
- 语言: Matlab
- 标签: MATLAB 工具箱 nurbstoolbox
资源简介
The NURBS toolbox is collection of routines for the creation, and manipulation of Non-Uniform Rational B-Splines (NURBS).
代码片段和文件信息
function B = basisfun (iv uv p U)
% BASISFUN: Basis function for B-Spline
%
% Calling Sequence:
%
% N = basisfun(ivuvpU)
%
% INPUT:
%
% iv - knot span ( from FindSpan() )
% uv - parametric points
% p - spline degree
% U - knot sequence
%
% OUTPUT:
%
% N - Basis functions vector(numel(uv)*(p+1))
%
% Adapted from Algorithm A2.2 from ‘The NURBS BOOK‘ pg70.
%
% See also:
%
% numbasisfun basisfunder findspan
%
% Copyright (C) 2000 Mark Spink
% Copyright (C) 2007 Daniel Claxton
% Copyright (C) 2009 Carlo de Falco
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation either version 3 of the License or
% (at your option) any later version.
% This program is distributed in the hope that it will be useful
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not see .
B = zeros(numel(uv) p+1);
for jj = 1:numel(uv)
i = iv(jj) + 1; %% findspan uses 0-based numbering
u = uv(jj);
left = zeros(p+11);
right = zeros(p+11);
N(1) = 1;
for j=1:p
left(j+1) = u - U(i+1-j);
right(j+1) = U(i+j) - u;
saved = 0;
for r=0:j-1
temp = N(r+1)/(right(r+2) + left(j-r+1));
N(r+1) = saved + right(r+2)*temp;
saved = left(j-r+1)*temp;
end
N(j+1) = saved;
end
B (jj :) = N;
end
end
%!test
%! n = 3;
%! U = [0 0 0 1/2 1 1 1];
%! p = 2;
%! u = linspace (0 1 10);
%! s = findspan (n p u U);
%! Bref = [1.00000 0.00000 0.00000
%! 0.60494 0.37037 0.02469
%! 0.30864 0.59259 0.09877
%! 0.11111 0.66667 0.22222
%! 0.01235 0.59259 0.39506
%! 0.39506 0.59259 0.01235
%! 0.22222 0.66667 0.11111
%! 0.09877 0.59259 0.30864
%! 0.02469 0.37037 0.60494
%! 0.00000 0.00000 1.00000];
%! B = basisfun (s u p U);
%! assert (B Bref 1e-5);
- 上一篇:互信息matlab
- 下一篇:α-β滤波仿真程序MATLAB
相关资源
- 线结构光中心提取算法matlab
- 基线解算的matlab源码
- 基于相位相关的图像平移检测算法m
- 指静脉处理代码
- SIMPLE算法Matlab代码
- 《无人驾驶车辆模型预测控制》书中
- 基于SIFT特征的图像配准MATLAB代码
- 多目标遗传算法matlab程序
- 布谷鸟算法的matlab代码
- MATLAB+背景减除目标检测+鱼头截取
- matlab实现文件读写波形处理,小波变
- RBF神经网络的训练 MATLAB源程序代码
- SMO_matlabfunction.rar
- agent蜂拥的实现matlab
- 如何自定义一个神经网络
- 万有引力搜索算法(Matlab)
- 标准差分进化算法多目标线性规划的
- matlab完整GUI 源程序免费
- matlab神经网络资料
- matlab,深度图转换三维点云,depthma
- matlab生成ply程序
- 测井曲线的MATLAB绘制
- 最大后验实现图像盲复原
- 小波变换 matlab程序
- SVM用于故障诊断的实现
- 基于遗传算法的投影寻踪模型Matlab源
- labview matlab 小波去噪
- 自适应控制算法-matlab编程实现
- 油位计仪表盘识别matlab代码实现
- 罚函数matlab实现
评论
共有 条评论