
function plot_linear_blending(A1,B1,C1,A2,B2,C2,alpha,beta)

% The parameters A1,B1,C1,A2,B2,C2 are row vectors "1 x 2".
% 0<beta-alpha<=2*pi.

theta=linspace(alpha,beta,400); theta=theta';

% Plot first arc.
P=bsxfun(@times,A1,cos(theta))+bsxfun(@times,B1,sin(theta))+...
    bsxfun(@times,C1,ones(size(theta)));

Q=bsxfun(@times,A2,cos(theta))+bsxfun(@times,B2,sin(theta))+...
    bsxfun(@times,C2,ones(size(theta)));

t=linspace(0,1,400); t=t';
S=[];
for k=1:size(P,1)
    SLOC=bsxfun(@times,P(k,:),t)+bsxfun(@times,Q(k,:),1-t);
    S=[S; SLOC];
end

% Plot
gray_color=[211, 211, 211]/256;
plot(S(:,1),S(:,2),'.','color',gray_color,'LineWidth',4);
hold on;
if (norm(A1) == 0) & (norm(B1) == 0)
    plot([P(1,1) Q(1,1)] ,[P(1,2) Q(1,2)],'r-','LineWidth',4);
    hold on;
    plot([P(1,1) Q(end,1)] ,[P(1,2) Q(end,2)],'r-','LineWidth',4);
    plot([P(1,1)] ,[P(1,2)],'ro','MarkerSize',6);
else
    plot(P(:,1),P(:,2),'r-','LineWidth',4);
end

if (norm(A2) == 0) & (norm(B2) == 0)
    plot(Q(:,1),Q(:,2),'bo','MarkerSize',4);
else
    plot(Q(:,1),Q(:,2),'b-','LineWidth',4);
end

axis equal
%axis tight
hold off;