bezier.m

来自「Bezier Curve, I haven t yet opened. I go」· M 代码 · 共 37 行

M
37
字号
function bezier(n)% function bezier(n)%% Plots the Bezier-curve of n control-points.% The control points can be chosen by clicking% with the mouse on the figure.%% COMMAND:  bezier(n)% INPUT:    n  Number of Control-Points%% Date:     2007-11-15% Author:   Stefan H黣berclose all;nplot = 100;figure(1);hold on; box on;set(gca,'Fontsize',16);title('Choose 1 st control points');t = linspace(0,1,nplot);	for i = 1:n		title(['Choose ',num2str(i),' th. control point']);	p(i,:) = ginput(1);	hold off;	plot(p(:,1),p(:,2),'k-','LineWidth',2);	axis([0 1 0 1]);	hold on; box on;	[X,Y,p_bez] = CASTELJAU(0,1,p,t);	plot(p_bez(:,1),p_bez(:,2),'b-','LineWidth',4);	plot(p(:,1),p(:,2),'ro','MarkerSize',10,'MarkerFaceColor','r');endtitle(['Bezier-curve with ',num2str(n),' control points']);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?