| 1 | package SVG::Estimate::Polygon; | ||
| 2 | 8 | $SVG::Estimate::Polygon::VERSION = '1.0116'; | |
| 3 | 8 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 8 | ▶ | use Math::Trig qw/pi/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 8 | ▶ | use Clone qw/clone/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 8 | extends 'SVG::Estimate::Polyline'; | |
| 8 | |||
| 9 | =head1 NAME | ||
| 10 | |||
| 11 | SVG::Estimate::Polygon - Handles estimating shapes of more than 3 points with straight lines between the points. | ||
| 12 | |||
| 13 | =head1 VERSION | ||
| 14 | |||
| 15 | version 1.0116 | ||
| 16 | |||
| 17 | =head1 SYNOPSIS | ||
| 18 | |||
| 19 | my $polygon = SVG::Estimate::Polygon->new( | ||
| 20 | transformer => $transform, | ||
| 21 | start_point => [45,13], | ||
| 22 | points => '20,20 40,25 60,40 80,120 120,140 200,180', | ||
| 23 | ); | ||
| 24 | |||
| 25 | my $length = $polygon->length; | ||
| 26 | |||
| 27 | =head1 INHERITANCE | ||
| 28 | |||
| 29 | This class extends L<SVG::Estimate::Polyline>. | ||
| 30 | |||
| 31 | =cut | ||
| 32 | |||
| 33 | ##Take the first pair, and make it the last to close the shape. | ||
| 34 | around _get_pairs => sub { | ||
| 35 | 4 | ▶ | my $orig = shift; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 36 | 4 | my $self = shift; | |
| 37 | 4 | my @pairs = $self->$orig(@_); | |
| 38 | 4 | push @pairs, $pairs[0]; | |
| 39 | return @pairs | ||
| 40 | 4 | }; | |
| 41 | |||
| 42 | 8 | 1; | |