NAME

Math::Shape::LineSegment - a 2d vector line segment; a line with start and end points

VERSION

version 0.15

METHODS

new

Constructor, requires 4 values: the x,y values for the start and end points

my $line = Math::Shape::Line->new(1, 2, 3, 4);

project

Projects the segment onto a vector and returns a Math::Shape::Range object. Requires a Math::Shape::Vector object as an argument. This method is mainly used in collision detection.

my $vector = Math::Shape::Vector->new(5, 9);
my $range = $line->project($vector);

collides

Boolean method that returns 1 if the vector collides with another Math::Shape::Vector library object or not or 0 if not. Requires a Math::Shape::Vectorlibrary object as an argument

AUTHOR

David Farrell <dfarrell@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by David Farrell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.