draw dashes over the spline
authorDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 19 May 2010 16:35:20 +0000 (18:35 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 19 May 2010 16:35:20 +0000 (18:35 +0200)
Makefile.PL
trace-path.pl

index 3ce7503..7b7f128 100644 (file)
@@ -10,6 +10,7 @@ requires 'SDL';
 requires 'Carp';
 requires 'Data::Dump';
 requires 'Math::CatmullRom';
+requires 'Algorithm::Line::Bresenham';
 #requires '';
 
 auto_include;
index 02be19c..258206d 100755 (executable)
@@ -9,7 +9,7 @@ use SDL::Color;
 use SDL::Constants;
 use SDL::Event;
 use Math::CatmullRom;
-#use Algorithm::Line::Bresenham;
+use Algorithm::Line::Bresenham qw(line);
 
 use Carp qw(cluck);
 use Data::Dump qw(dump);
@@ -54,7 +54,17 @@ sub curve {
 
        my $i = 0;
        while ( $i < $#curve ) {
-               $app->pixel( int($curve[$i++]), int($curve[$i++]), $red );
+               my $from_x = int($curve[$i++]);
+               my $from_y = int($curve[$i++]);
+               my $to_x   = int($curve[$i++]);
+               my $to_y   = int($curve[$i++]);
+               line(
+                       int($curve[$i++]),
+                       int($curve[$i++]),
+                       int($curve[$i++]),
+                       int($curve[$i++]),
+                       sub { $app->pixel( @_, $red ) }
+               );
        }
        $app->sync;
 }