资源简介
nurbs曲线绘制程序,matlan程序代码,内含详细注释说明
代码片段和文件信息
function [N] = basisfunction(n npts u t)
% Evaluate basis function at specified u.
%
% Input arguments:
% n:
% NURBS order (2 for linear 3 for quadratic 4 for cubic etc.)
% npts:
% number of control points
% u:
% point to evaluate
% t:
% knot vector
%
% Output arguments:
% N:
% vector with size npts containing value of the basis function at u
%Written by Graziano Fuccio email: g.fuccio359@gmail.com
nplusc = npts + n;
N = zeros(npts);
for i = 1: nplusc - 1
if u >= t(i) && u <= t(i+1)
N(i) = 1;
else
N(i) = 0;
end
end
%application of the formula that you can find on the NURBS book
for k = 2 : n
for i = 1 : nplusc - k
if N(i) ~= 0
d = ((u - t(i)) * N(i)) / (t(i + k - 1) - t(i));
else
d = 0;
end
if(N(i + 1) ~= 0)
e = ((t(i + k) - u) * N(i + 1)) / (t(i + k) - t(i + 1));
else
e = 0;
end
N(i) = d + e;
end
end
N = N(: 1);
N = N‘;
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1056 2016-11-29 21:37 basisfunction.m
文件 2770 2016-11-29 21:39 nurbsfun.m
文件 577 2016-11-29 21:44 nurbs_example.m
文件 1315 2016-11-29 09:16 license.txt
- 上一篇:simuli
nk车速模型 - 下一篇:MATLAB mexopts配置文件.zip
评论
共有 条评论