line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVG::Estimate::Role::MakePolygon; |
2
|
|
|
|
|
|
|
$SVG::Estimate::Role::MakePolygon::VERSION = '1.0113'; |
3
|
12
|
|
|
12
|
|
5566
|
use strict; |
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
313
|
|
4
|
12
|
|
|
12
|
|
49
|
use Moo::Role; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
68
|
|
5
|
12
|
|
|
12
|
|
6490
|
use Image::SVG::Transform; |
|
12
|
|
|
|
|
111088
|
|
|
12
|
|
|
|
|
440
|
|
6
|
12
|
|
|
12
|
|
4028
|
use SVG::Estimate::Polygon; |
|
12
|
|
|
|
|
27
|
|
|
12
|
|
|
|
|
1808
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
SVG::Estimate::Role::MakePolygon - Approximate shapes that are hard to estimate |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
version 1.0113 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head2 make_polygon ( $args ) |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Class method. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Make an SVG::Estimate::Polygon out of a set of point approximating the consumer's shape. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Requires that the consumer provide a C method. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub make_polygon { |
29
|
9
|
|
|
9
|
1
|
21
|
my ($class, $args) = @_; |
30
|
9
|
|
|
|
|
12
|
my @points; |
31
|
9
|
|
|
|
|
40
|
for (my $t = 0.0; $t <= 1.0; $t += 1/12) { |
32
|
117
|
|
|
|
|
270
|
my $point = $class->this_point($args, $t); |
33
|
117
|
|
|
|
|
224
|
$point = $args->{transformer}->transform($point); |
34
|
117
|
|
|
|
|
16726
|
push @points, $point; |
35
|
|
|
|
|
|
|
} |
36
|
9
|
|
|
|
|
22
|
my $polygon_points = join ' ', map { join ',', @{ $_ } } @points; |
|
117
|
|
|
|
|
117
|
|
|
117
|
|
|
|
|
412
|
|
37
|
|
|
|
|
|
|
##Have to send in an empty transform object |
38
|
9
|
|
|
|
|
187
|
my $littleT = Image::SVG::Transform->new(); |
39
|
9
|
|
|
|
|
230
|
return SVG::Estimate::Polygon->new(points => $polygon_points, transformer => $littleT, start_point => $args->{start_point}, ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |