blib/lib/Math/Window2Viewport.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 3 / 3 totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
new
1.0
CRAP 1.0
↑ Summary
1 package Math::Window2Viewport;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 our $VERSION = '1.02';
5  
6 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
7 1 my $class = shift;
8 1 my $self = bless {@_}, $class;
9  
10 1 $self->{Sx} = ( $self->{Vr} - $self->{Vl} ) / ( $self->{Wr} - $self->{Wl} );
11 1 $self->{Sy} = ( $self->{Vt} - $self->{Vb} ) / ( $self->{Wt} - $self->{Wb} );
12 1 $self->{Tx} = ( $self->{Vl} * $self->{Wr} - $self->{Wl} * $self->{Vr} ) / ( $self->{Wr} - $self->{Wl} );
13 1 $self->{Ty} = ( $self->{Vb} * $self->{Wt} - $self->{Wb} * $self->{Vt} ) / ( $self->{Wt} - $self->{Wb} );
14
15 1 return $self;
16 }
17  
18 6 ▶sub Dx {
Subroutine Dx: called CC=1 SCAR=0.0
Pod documented
19 6 my ($self,$x) = @_;
20 6 return $self->{Sx} * $x + $self->{Tx};
21 }
22  
23 6 ▶sub Dy {
Subroutine Dy: called CC=1 SCAR=0.0
Pod documented
24 6 my ($self,$y) = @_;
25 6 return $self->{Sy} * $y + $self->{Ty};
26 }
27  
28 2 1;
29  
30 __END__
↑ Summary