From 2bd4d95492f6b513439b819459a056db886e7363 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 19 May 2010 18:35:20 +0200 Subject: [PATCH] draw dashes over the spline --- Makefile.PL | 1 + trace-path.pl | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile.PL b/Makefile.PL index 3ce7503..7b7f128 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -10,6 +10,7 @@ requires 'SDL'; requires 'Carp'; requires 'Data::Dump'; requires 'Math::CatmullRom'; +requires 'Algorithm::Line::Bresenham'; #requires ''; auto_include; diff --git a/trace-path.pl b/trace-path.pl index 02be19c..258206d 100755 --- a/trace-path.pl +++ b/trace-path.pl @@ -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; } -- 2.20.1