What you are looking for is Bresenhams algorithm for drawing a line. I don't know of an implementation of it for Perl, as most drawing in Perl is done on a higher level by using OpenGL or SVG though. The concept of Bresenhams algorithm is relatively easy - you step down the longer distance and keep a counter for when you have to move one column in the other direction. The fun thing is to understand how and why the algorithm works without requiring floating point math.
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
In reply to Re: Plotting A Line
by Corion
in thread Plotting A Line
by mdog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |