function parallelogrammesv10(A,u,v,x,n,varargin)
% Version avec arguments optionnels utilisant inputParser
%  parallelogrammesv10([-1;2],[-1;3],[1;3],0.1,25)
%  parallelogrammesv10([-1;2],[-1;3],[1;3],0.1,25, 'color1','b','color2','r')
%  parallelogrammesv10([-1;2],[-1;3],[1;3],0.1,25, 'color1','g')
%  parallelogrammesv10([-1;2],[-1;3],[1;3],0.1,25, 'color2','m')
  ip = inputParser;
  ip.PartialMatching=false;
  ip.addParameter('color1','k');
  ip.addParameter('color2','b');
  ip.parse(varargin{:});
  clf;hold on;axis equal
  plot_para(A,u,v,ip.Results.color1)
  for i=1:n
    [A,u,v]=calcul(A,u,v,x);
    plot_para(A,u,v,ip.Results.color2)
  end
end

function plot_para(A,u,v,color)
  X=[A,A+u,A+u+v,A+v,A];
  plot(X(1,:),X(2,:),color)
end

function [Ap,up,vp]=calcul(A,u,v,x)
  Ap=A+x*u;
  up=u+x*(v-u);
  vp=v-x*(u+v);
end
