Cory G Watson >
Geometry-Primitive-0.24 >
Geometry::Primitive::Polygon

Geometry::Primitive::Polygon - Closed shape with an arbitrary number of points.

Geometry::Primitive::Polygon represents a two dimensional figure bounded by a series of points that represent a closed path.

use Geometry::Primitive::Polygon; my $poly = Geometry::Primitive::Polygon->new; $poly->add_point($point1); $poly->add_point($point2); $poly->add_point($point3); # No need to close the path, it's handled automatically

Set/Get the arrayref of points that make up this Polygon.

Creates a new Geometry::Primitive::Polygon

Area of this polygon. Assumes it is non-self-intersecting.

Add a point to this polygon.

Clears all points from this polygon.

Returns the number of points that bound this polygon.

Returns the point at the specified offset.

Get the end point. Provided for Shape role.

Get the start point. Provided for Shape role.

Scale this this polygon by the supplied amount.

Cory Watson <gphat@cpan.org>

You can redistribute and/or modify this code under the same terms as Perl itself.

syntax highlighting: