line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SVG::Estimate::Role::Pythagorean; |
2
|
|
|
|
|
|
|
$SVG::Estimate::Role::Pythagorean::VERSION = '1.0107'; |
3
|
29
|
|
|
29
|
|
9154
|
use strict; |
|
29
|
|
|
|
|
35
|
|
|
29
|
|
|
|
|
679
|
|
4
|
29
|
|
|
29
|
|
81
|
use Moo::Role; |
|
29
|
|
|
|
|
32
|
|
|
29
|
|
|
|
|
128
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
SVG::Estimate::Role::Pythagorean - Use Pythagorean theorem to calc distance |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
version 1.0107 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 METHODS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 pythagorean ( point1, point2 ) |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Calculates the distance between two points. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub pythagorean { |
23
|
2255
|
|
|
2255
|
1
|
1592
|
my ($self, $p1, $p2) = @_; |
24
|
2255
|
|
|
|
|
1516
|
my $dy = $p2->[1] - $p1->[1]; |
25
|
2255
|
|
|
|
|
1435
|
my $dx = $p2->[0] - $p1->[0]; |
26
|
2255
|
|
|
|
|
2763
|
return sqrt(($dx**2)+($dy**2)); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |