<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Hi Everyone,<br>I managed to write up the line drawing function using the following links - <br><span><a target="_blank" href="http://www.cs.helsinki.fi/group/goa/mallinnus/lines/bresenh.html">http://www.cs.helsinki.fi/group/goa/mallinnus/lines/bresenh.html</a></span><br><span><a target="_blank" href="http://rosettacode.org/wiki/Bresenham%27s_line_algorithm#Haskell">http://rosettacode.org/wiki/Bresenham%27s_line_algorithm#Haskell</a></span><br><br>line :: Point -&gt; Point -&gt; [Point]<br>line (xa,ya) (xb,yb) = line' (x1,y1) (x2,y2) deltax deltay ystep isSteep 0<br>&nbsp; where <br>&nbsp;&nbsp;&nbsp; isSteep = abs (yb - ya) &gt; abs (xb - xa)<br>&nbsp;&nbsp;&nbsp; (xa',ya',xb',yb') = if isSteep<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then (ya,xa,yb,xb)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else
 (xa,ya,xb,yb)<br>&nbsp;&nbsp;&nbsp; (x1,y1,x2,y2) = if xa' &gt; xb'<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then (xb',yb',xa',ya')<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else (xa',ya',xb',yb')<br>&nbsp;&nbsp;&nbsp; deltax = x2 - x1<br>&nbsp;&nbsp;&nbsp; deltay = abs (y2 - y1)<br>&nbsp;&nbsp;&nbsp; ystep = if y1 &lt; y2 then 1 else -1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br><br>line' :: Point -&gt; Point -&gt; Integer -&gt; Integer -&gt; Integer -&gt; Bool -&gt; Integer -&gt; [Point]<br>line' (x1,y1) (x2,y2) deltax deltay ystep isSteep error =<br>&nbsp; if x1 == x2<br>&nbsp; then if isSteep then [(y1,x1)] else [(x1,y1)]<br>&nbsp; else<br>&nbsp;&nbsp;&nbsp; if isSteep<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then [(y1,x1)] ++ line' (newX,newY) (x2,y2) deltax deltay ystep isSteep newError <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else [(x1,y1)] ++ line' (newX,newY) (x2,y2) deltax deltay ystep isSteep newError<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 where<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newX = x1 + 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tempError = error + deltay<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (newY, newError) = if (2*tempError) &gt;= deltax then (y1+ystep,tempError-deltax) else (y1,tempError)<br><br><br>Can someone please provide feedback on this? In terms of, how do I get more Haskell'ism into it.<br><br>Regards,<br>Kashyap<br></div></div><br>



      </body></html>