function [ ] = DrawLine( X1, Y1, X2,Y2, lineColor )
%UNTITLED Summary of this function goes here
%   Detailed explanation goes here

global M

H=abs(X2-X1); V=abs(Y2-Y1);
sy=zeros(size(1));
sx=zeros(size(1));
reverse=zeros(size(1));
if X2<X1 
     sx=true; else sx=false; end
if Y2<Y1 
     sy=true; else sy=false; end
if H<V 
    reverse=true ;x=H ; H=V ; V=x;  else reverse=false; end;
if sum(H)==0 
     M(X1,Y1)=lineColor; end;

slope=V/H;
counter=zeros(size(1));
while counter<=H 
    x=counter;
    y=floor(slope*x+0.5);
    if reverse
        z=x;x=y;y=z; end;
    if sx 
         x=-x; end;
    if sy 
         y=-y; end;
   M(x+X1,y+Y1)=lineColor;
   counter=counter+1;
end;

end

