Algorithm::Line::BresenhamAlgorithm::Line::Bresenham is a Perl module that contains a simple pixellated line-drawing algorithm. | |
Download |
Algorithm::Line::Bresenham Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- osfameron
- Publisher web site:
- http://search.cpan.org/~osfameron/Crypt-OTP26-0.02/lib/Crypt/OTP26.pm
Algorithm::Line::Bresenham Tags
Algorithm::Line::Bresenham Description
Algorithm::Line::Bresenham is a Perl module that contains a simple pixellated line-drawing algorithm. Algorithm::Line::Bresenham is a Perl module that contains a simple pixellated line-drawing algorithm.SYNOPSIS use Algorithm::Line::Bresenham qw/line/; my @points = line(3,3 => 5,0); # returns the list: , , , line(3,3 => 5,0, &draw_line); # calls draw_line on each point in turnBresenham is one of the canonical line drawing algorithms for pixellated grids. Given a start and an end-point, Bresenham calculates which points on the grid need to be filled to generate the line between them.Googling for 'Bresenham', and 'line drawing algorithms' gives some good overview. The code here takes its starting point from Mark Feldman's Pascal code in his article Bresenham's Line and Circle Algorithms at http://www.gamedev.net/reference/articles/article767.asp.FUNCTIONSline line ($from_y, $from_x => $to_y, $to_x);Generates a list of all the intermediate points. This is returned as a list of array references. line ($from_y, $from_x => $to_y, $to_x, &callback);Calls the referenced function on each point in turn. The callback could be used to actually draw the point. Returns the collated return values from the callback.circle my @points = circle ($y, $x, $radius)Returns the points to draw a circle with Requirements: · Perl
Algorithm::Line::Bresenham Related Software