function parallelepip(P,M,col)
% parallelepip([a;b;c],'g')   plot parallelepiped with vertex (0,0,0), vectors a,b,c in green
% parallelepip(P,[a;b;c],'g') plot parallelepiped with vertex P, vectors a,b,c in green
if nargin==2
  col = M; M = P;
  P = [0,0,0];
end
a = M(1,:); b = M(2,:); c = M(3,:); 
holdstatus = ishold;
fillpts([P;P+a;P+a+b;P+b],col); hold on
fillpts([P;P+b;P+b+c;P+c],col); 
fillpts([P;P+a;P+a+c;P+c],col);
fillpts([P+a;P+a+b;P+a+b+c;P+a+c],col);
fillpts([P+b;P+b+a;P+b+a+c;P+b+c],col);
fillpts([P+c;P+c+a;P+c+a+b;P+c+b],col); 
if holdstatus==0
  hold off
end

