function FlaecheTrapez

% http://geometrie.hs-nb.de/MATLAB-Programme/FlaecheTrapez.m   Bearbeitungsstand: 5.9.2004
% (C) Martin Nitschke, nitschke@hs-nb.de

clc;
close('all')
global ax
ax=[inf -inf inf -inf];
a=[11;0];
b=[-3;7];
c=[-4;0];
n=[-a(2);a(1)]/norm(a);
h=n*n'*b;
A=[0;0];
drawPolygon(@fill,[A A+a A+a+b A+a+b+c A],0.875*[1 1 1],'EdgeColor','none')
hold('on')
drawPolygon(@fill,[A+a A+a-c A+2*a+b A+a+b],0.75*[1 1 1],'EdgeColor','none')
drawPolygon(@plot,[A A+a A+a+b A+a+b+c A],'k','linewidth',2.0)
drawPolygon(@plot,[A+a A+a-c A+2*a+b A+a+b],'k')
qH=1.1;
drawPolygon(@plot,[A+qH*a+b+c A+qH*a+b+c-h],'k','linewidth',0.25)
hold('off')
Schrift(A+a/2,'\ita','HorizontalAlignment','center','VerticalAlignment','top');
Schrift(A+a+b+c/2,'\itc','HorizontalAlignment','center','VerticalAlignment','bottom');
Schrift(A+1.5*a+b,'\ita','HorizontalAlignment','center','VerticalAlignment','bottom');
Schrift(A+a-c/2,'\itc','HorizontalAlignment','center','VerticalAlignment','top');
Schrift(A+qH*a+b+c-h/2,'\ith','HorizontalAlignment','left','VerticalAlignment','middle');
axis('equal')
axis(ax)
axis('off')
print('-depsc','FlaecheTrapez');

function drawPolygon(draw,P,varargin);
global ax
feval(draw,P(1,:),P(2,:),varargin{:})
if min(P(1,:))<ax(1)
  ax(1)=min(P(1,:));
end
if max(P(1,:))>ax(2)
  ax(2)=max(P(1,:));
end
if min(P(2,:))<ax(3)
  ax(3)=min(P(2,:));
end
if max(P(2,:))>ax(4)
  ax(4)=max(P(2,:));
end

function Schrift(P,txt,varargin)
text(P(1),P(2),txt,'FontName','TimesNewRoman','FontSize',40,varargin{:});
