function main()

jmeno  = 'fce_01';
%------------------------------------------------------------------------------
XX     = [-1, 1]; DXX = (XX(2)-XX(1))/100;   % rozsahy os
YY     = [-1, 1]; DYY = (YY(2)-YY(1))/100;
ZZ     = [0, 1.5];

krok   = 5;  % krok pro vyber mesh car

[x, y] = meshgrid(XX(1) : DXX : XX(2), YY(1) : DYY : YY(2));   % mesh pro 3D plot

z      = sqrt(abs(x.*y));
%------------------------------------------------------------------------------

disp(sprintf('min f(x, y) = %f', min(min(z)) ));
disp(sprintf('max f(x, y) = %f', max(max(z)) ));
%==============================================================================
fff = figure(1); clf, hold on, set(fff, 'Visible', 'on');

axis equal

surfl(x, y, z)

shading interp
material dull
colormap summer

%------------------------------------------------------------------------------ mesh mrizka
mrizka(x , y , z , krok)
mrizka(x', y', z', krok)
%------------------------------------------------------------------------------ osy
ox1=XX(1); ox2=XX(2);
oy1=YY(1); oy2=YY(2);
oz1=ZZ(1); oz2=ZZ(2);

plot3([ox1,ox2],     [0,0],     [0,0], 'k-', 'linewidth', 2);
plot3(    [0,0], [oy1,oy2],     [0,0], 'k-', 'linewidth', 2);
plot3(    [0,0],     [0,0], [oz1,oz2], 'k-', 'linewidth', 2);
%------------------------------------------------------------------------------ popisky
pozadi = [255, 255, 255]./255;

set(gca, 'Color', pozadi);
set(gca, 'XTick', [], 'YTick', [], 'ZTick', []);

text(ox2, 0,   0,      'x', 'HorizontalAlignment', 'Left', 'VerticalAlignment', 'Middle', 'FontName', 'Courier', 'FontSize', 12);
text(0, oy2,   0,      'y', 'HorizontalAlignment', 'Left', 'VerticalAlignment', 'Middle', 'FontName', 'Courier', 'FontSize', 12);
text(0,   0, oz2, 'f(x,y)', 'HorizontalAlignment', 'Left', 'FontName', 'Courier', 'FontSize', 12);
%------------------------------------------------------------------------------

[az, el] = view;
view(az + 90, el);

camlight

axis([XX(1), XX(2), YY(1), YY(2), ZZ(1), ZZ(2)]);
axis off
grid off

set(fff, 'Color', pozadi, 'InvertHardcopy', 'off');

drawnow

figure(fff); set(fff, 'Visible', 'on')

anaglyph;

%==============================================================================
function mrizka(x, y, z, krok)

pom = waterfall(x, y, z);
set(pom, 'Visible', 'off');
ppp = get(pom);
px = ppp.XData(2 : end - 2, 1 : krok : end);
py = ppp.YData(2 : end - 2, 1 : krok : end);
pz = ppp.ZData(2 : end - 2, 1 : krok : end);
line(px, py, pz, 'Color', 0*[1 1 1], 'LineWidth', 0.5)
%==============================================================================



