Lines in 2d space
PhilipRBrenan@yahoo.com, 2004, Perl License
Example t/line2.t
#_ Vector _____________________________________________________________ # Test 2d lines # philiprbrenan@yahoo.com, 2004, Perl License #______________________________________________________________________ use Math::Zap::Line2; use Math::Zap::Vector2; use Test::Simple tests=>12; my $x = vector2(1,0); my $y = vector2(0,1); my $c = vector2(0,0); my $a = line2( -$x, +$x); my $b = line2( -$y, +$y); my $B = line2(3*$y, 4*$y); ok($a->intersect($b) == $c); ok($b->intersect($a) == $c); ok($a->intersectWithin($b) == 1); ok($a->intersectWithin($B) == 0); ok($b->intersectWithin($a) == 1); ok($B->intersectWithin($a) == 1); ok($a->parallel($b) == 0); ok($B->parallel($b) == 1); ok(!$b->intersectWithin($B), 'Parallel intersection'); ok( line2(-$x, $x)->crossOver(line2(-$y, $y)), 'Crosses 1'); ok(!line2(-$x, $x)->crossOver(line2( $y * 0.5, $y)), 'Crosses 2'); ok(!line2( $x * 0.5, $x)->crossOver(line2( $y * 0.5, $y)), 'Crosses 3');
Manipulate lines in 2D space
Create a line from two vectors
Get/Set accuracy for comparisons
Short line?
Check its a line
Test its a line
Components of line
Create a line from another line
Print line
Angle between two lines
Are two lines parallel
Intersection of two lines
Intersection of two lines occurs within second line?
Do the two line segments cross over each other?
Export "line2"
philiprbrenan@yahoo.com
philiprbrenan@yahoo.com, 2004
Perl License.
To install Math::Zap::Draw, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Zap::Draw
CPAN shell
perl -MCPAN -e shell install Math::Zap::Draw
For more information on module installation, please visit the detailed CPAN module installation guide.