NAME
Math::Shape::OrientedRectangle - a 2d oriented rectangle
VERSION
version 0.08
METHODS
new
Constructor, requires 5 values: the x,y values for the center and the x,y values for the half_extend vector and a rotation number.
my $OrientedRectangle = Math::Shape::OrientedRectangle->new(1, 1, 2, 4, 45);
my $width = $OrientedRectangle->{rotation}; # 45
get_edge
Returns a Math::Shape::LineSegment object for a given edge of the rectangle. Requires a number for the edge of the rectangle to return (0-3).
my $segment= $oriented_rectangle->get_edge(1);
axis_is_separating
Boolean method that returns 1 if the axis is separating. Requires a Math::Shape::LineSegment object (for the axis) as an argment.
collides
Boolean method returns 1 if the OrientedRectangle collides with another OrientedRectangle, else returns 0. Requires another OrientedRectangle object as an argument.
my $is collision = $OrientedRectangle->collides($other_OrientedRectangle);
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.