📄 bezierall.m
字号:
%Bezier general function
%plot in 51 points
function [base,all]=Bezierall(P,N)
%number of plotting points
pointsize=size(P); %get the points decides the number of bases 4=5-1 and dimension;
length=pointsize(1); %the group of control points 5
dimension=pointsize(2); %the dimension of points 2D or 3D
n=length-1;
all=zeros(1,N,dimension);
base=zeros(length,N);
temp=zeros(length,N,dimension);
for k=0:n %the number of bases
for u=0:N-1 %draw N points
base(k+1,u+1)=nchoosek(n,k).*(u/(N-1))^k.*(1-(u/(N-1)))^(n-k);
end
for u=0:N-1
temp(k+1,u+1,:)=P(k+1,:).*base(k+1,u+1);
end
all(1,:,:)=all(1,:,:)+temp(k+1,:,:);
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -