line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVG::Estimate::Role::MakePolygon; |
2
|
|
|
|
|
|
|
$SVG::Estimate::Role::MakePolygon::VERSION = '1.0107'; |
3
|
6
|
|
|
6
|
|
2040
|
use strict; |
|
6
|
|
|
|
|
6
|
|
|
6
|
|
|
|
|
136
|
|
4
|
6
|
|
|
6
|
|
18
|
use Moo::Role; |
|
6
|
|
|
|
|
5
|
|
|
6
|
|
|
|
|
22
|
|
5
|
6
|
|
|
6
|
|
1094
|
use Image::SVG::Transform; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
122
|
|
6
|
6
|
|
|
6
|
|
1480
|
use SVG::Estimate::Polygon; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
694
|
|
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.0107 |
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
|
2
|
|
|
2
|
1
|
2
|
my ($class, $args) = @_; |
30
|
2
|
|
|
|
|
2
|
my @points; |
31
|
2
|
|
|
|
|
10
|
for (my $t = 0.0; $t <= 1.0; $t += 1/12) { |
32
|
26
|
|
|
|
|
43
|
my $point = $class->this_point($args, $t); |
33
|
26
|
|
|
|
|
46
|
$point = $args->{transformer}->transform($point); |
34
|
26
|
|
|
|
|
3073
|
push @points, $point; |
35
|
|
|
|
|
|
|
} |
36
|
2
|
|
|
|
|
3
|
my $polygon_points = join ' ', map { join ',', @{ $_ } } @points; |
|
26
|
|
|
|
|
19
|
|
|
26
|
|
|
|
|
110
|
|
37
|
|
|
|
|
|
|
##Have to send in an empty transform object |
38
|
2
|
|
|
|
|
53
|
my $littleT = Image::SVG::Transform->new(); |
39
|
2
|
|
|
|
|
38
|
return SVG::Estimate::Polygon->new(points => $polygon_points, transformer => $littleT, start_point => $args->{start_point}, ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |