1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
//
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
//
// This file is distributed under the same license as the Scilab package.
//
// Bezier curve approximating a circle
function gammatest (N)
[lhs,rhs] =argn(0);
if rhs < 1 then
N=[10,20,50,100];
end
x = linspace(0,1,100);
my_handle = scf(100001);
clf(my_handle,"reset");
plot2d(cos(2*%pi*x),sin(2*%pi*x));
ax = gca();
ax.isoview = "on";
title("Bezier curve approximating a circle","fontsize",3);
icol=2;
for n=N ;
t = sqrt(linspace(0,1,n));
p = [cos(2*%pi*t);sin(2*%pi*t)];
y = bezier(p,x);
plot2d(y(1,:),y(2,:),icol);
icol=icol+1;
end
demo_viewCode("gammatest.sce");
endfunction
gammatest();
clear gammatest;
|