Construction/Draw.pm

filter: Statementstmt 89.6% 26 / 29 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 63.6% 7 / 11 Podpod 57.1% 4 / 7 totaltotal 75.5% 37 / 49 CC 2 SCAR 6.1
CC
2
Cov
84%
is_flipped
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Construction/Point.pm ↑ Summary Construction/Role/Output.pm »
1 package Math::Geometry::Construction::Draw;
2  
3 6 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 C<Math::Geometry::Construction::Draw> - base class for drawing
11  
12 =head1 VERSION
13  
14 Version 0.022
15  
16 =cut
17  
18 6 our $VERSION = '0.022';
19  
20  
21 ###########################################################################
22 # #
23 # Class Variables and Methods #
24 # #
25 ###########################################################################
26  
27 ###########################################################################
28 # #
29 # Accessors #
30 # #
31 ###########################################################################
32  
33 6 has 'output' => (isa => 'Item',
34 is => 'rw',
35 writer => '_output');
36  
37 6 has ['width', 'height'] => (isa => 'Str',
38 is => 'ro',
39 required => 1);
40  
41 has 'transform' => (isa => 'ArrayRef[Num]',
42 is => 'ro',
43 14 ▶ default => sub { [1, 0, 0, 1, 0, 0] });
Subroutine __ANON__: called CC=1 SCAR=0.0
44  
45  
46 ###########################################################################
47 # #
48 # Generate Output #
49 # #
50 ###########################################################################
51  
52 0 ▶sub is_flipped {
Subroutine is_flipped: not called CC=2 SCAR=17.9
Pod documented
53 0 my ($self) = @_;
54 0 my $t = $self->transform;
55  
56 0 ▶ return($t->[0] * $t->[3] - $t->[1] * $t->[2] <= 0 ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$t->[0] * $t->[3] - $t->[1] * $t->[2] <= 0 ? : 0 0 0
57 }
58  
59 24 ▶sub transform_coordinates {
Subroutine transform_coordinates: called CC=1 SCAR=0.0
Pod documented
60 24 my ($self, $x, $y) = @_;
61 24 my $t = $self->transform;
62 24 my $split = qr/(.*?)(\s*[a-zA-Z]*)$/;
63  
64 24 my @x_parts = $x =~ $split;
65 24 my @y_parts = $y =~ $split;
66  
67 24 my $xt = $t->[0] * $x_parts[0] + $t->[2] * $y_parts[0] + $t->[4];
68 24 my $yt = $t->[1] * $x_parts[0] + $t->[3] * $y_parts[0] + $t->[5];
69  
70 24 return("$xt$x_parts[1]", "$yt$y_parts[1]");
71 }
72  
73 15 ▶sub transform_x_length {
Subroutine transform_x_length: called CC=1 SCAR=0.0
Pod documented
74 15 my ($self, $l) = @_;
75  
76 15 return(abs($l * $self->transform->[0]));
77 }
78  
79 15 ▶sub transform_y_length {
Subroutine transform_y_length: called CC=1 SCAR=0.0
Pod documented
80 15 my ($self, $l) = @_;
81  
82 15 return(abs($l * $self->transform->[3]));
83 }
84  
85 0 ▶sub line {}
Subroutine line: not called CC=1 SCAR=0.0
Pod undocumented
86 0 ▶sub circle {}
Subroutine circle: not called CC=1 SCAR=0.0
Pod undocumented
87 0 ▶sub text {}
Subroutine text: not called CC=1 SCAR=0.0
Pod undocumented
88  
89  
90 6 1;
91  
92  
93 __END__
« Construction/Point.pm ↑ Summary Construction/Role/Output.pm »