17 lines
461 B
Text
17 lines
461 B
Text
width = 512;
|
|
height = 512;
|
|
img=scf();
|
|
set(img,'figure_size',[width,height]);
|
|
|
|
function drawTree(x1, y1, angle, depth)
|
|
if depth ~= 0 then
|
|
x2 = x1 + cos(angle * %pi/180) * depth * 10;
|
|
y2 = y1 + sin(angle * %pi/180) * depth * 10;
|
|
plot2d([x1 x2],[y1 y2],14);
|
|
drawTree(x2, y2, angle - 20, depth - 1);
|
|
drawTree(x2, y2, angle + 20, depth - 1);
|
|
end
|
|
endfunction
|
|
|
|
drawTree(width/2,height,90,10);
|
|
set(gca(),'isoview','on');
|