function [bx_max,S] = tiangle_detector(segment)

ax=1;
ay=segment(ax);
cx=length(segment);
cy=segment(cx);

S=zeros(length(segment),1);

for k=1:length(segment) % od A do C
    bx=k; % x-koordinát vrcholu B
    by=segment(k); % y-koordinát vrcholu B
    S(k)=0.5*abs((cx-ax)*(by-ay)-(cy-ay)*(bx-ax)); % plocha
end
[~,bx_max]=max(S);


end

