NAME

Math::Shape::Rectangle - an axis-aligned 2d rectangle

VERSION

version 0.08

METHODS

new

Constructor, requires 4 values: the x,y values for the origin and the x,y values for the size.

my $rectangle = Math::Shape::Rectangle->new(1, 1, 2, 4);
my $width = $rectangle->{size}->{x}; # 2

collides

Boolean method returns 1 if the rectangle collides with another rectangle, else returns 0. Requires another rectangle object as an argument.

my $is collision = $rectangle->collides($other_rectangle);

AUTHOR

David Farrell <sillymoos@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 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.