in reply to Check if line is straight
If you really want to check colinearity of three points, you can just multiply vectors:
sub isCorrectPath () { my ($x1, $y1, $x2, $y2, $x, $y) = @_; return !(($x2-$x1)*($y-$y1)-($x-$x1)*($y2-$y1)); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Check if line is straight
by Anonymous Monk on May 16, 2011 at 20:14 UTC | |
by lidden (Curate) on May 16, 2011 at 23:13 UTC | |
by pajout (Curate) on May 17, 2011 at 11:30 UTC |
In Section
Seekers of Perl Wisdom