Algorithm-Line-Lerp

 view release on metacpan or  search on metacpan

eg/bench  view on Meta::CPAN

    join ' ', map { "$_->[0],$_->[1]" } @{ $_[0] };
}

my $first = [ 0, 0 ];
my $last  = [ 2, 11 ];

# are the results sane for each? (there may be slight variance if lround
# does something different than Bresenham does? for a game board of a
# particular size you might check all the different possible lines and
# look for any differences between the algos)
say "Bc ", points_of( bline( $first, $last ) );
say "Bp ", points_of( Bresenham::line( $first, $last ) );
say "Lc ", points_of( line( $first, $last ) );
say "Lp ", points_of( ppline( $first, $last ) );

cmpthese(
    -10,
    {   bres_c  => sub { bline( $first, $last ) },
        bres_pp => sub { Bresenham::line( $first, $last ) },
        lerp_c  => sub { line( $first, $last ) },
        lerp_pp => sub { ppline( $first, $last ) },
    }
);



( run in 1.296 second using v1.01-cache-2.11-cpan-483215c6ad5 )