line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Window2Viewport; |
2
|
2
|
|
|
2
|
|
29202
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
58
|
|
3
|
2
|
|
|
2
|
|
8
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
426
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
1
|
|
|
1
|
1
|
58
|
my $class = shift; |
8
|
1
|
|
|
|
|
7
|
my $self = bless {@_}, $class; |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
5
|
$self->{Sx} = ( $self->{Vr} - $self->{Vl} ) / ( $self->{Wr} - $self->{Wl} ); |
11
|
1
|
|
|
|
|
3
|
$self->{Sy} = ( $self->{Vt} - $self->{Vb} ) / ( $self->{Wt} - $self->{Wb} ); |
12
|
1
|
|
|
|
|
3
|
$self->{Tx} = ( $self->{Vl} * $self->{Wr} - $self->{Wl} * $self->{Vr} ) / ( $self->{Wr} - $self->{Wl} ); |
13
|
1
|
|
|
|
|
3
|
$self->{Ty} = ( $self->{Vb} * $self->{Wt} - $self->{Wb} * $self->{Vt} ) / ( $self->{Wt} - $self->{Wb} ); |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
|
|
2
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub Dx { |
19
|
6
|
|
|
6
|
1
|
387
|
my ($self,$x) = @_; |
20
|
6
|
|
|
|
|
31
|
return $self->{Sx} * $x + $self->{Tx}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub Dy { |
24
|
6
|
|
|
6
|
1
|
8
|
my ($self,$y) = @_; |
25
|
6
|
|
|
|
|
29
|
return $self->{Sy} * $y + $self->{Ty}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |