line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Math::Window2Viewport; |
2
|
2
|
|
|
2
|
|
30241
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
64
|
|
3
|
2
|
|
|
2
|
|
10
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
539
|
|
4
|
|
|
|
|
|
|
our $VERSION = '1.01'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
1
|
|
|
1
|
1
|
65520
|
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
|
|
|
|
|
4
|
$self->{Sy} = ( $self->{Vt} - $self->{Vb} ) / ( $self->{Wt} - $self->{Wb} ); |
12
|
1
|
|
|
|
|
4
|
$self->{Tx} = ( $self->{Vl} * $self->{Wr} - $self->{Wl} * $self->{Vr} ) / ( $self->{Wr} - $self->{Wl} ); |
13
|
1
|
|
|
|
|
5
|
$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
|
366
|
my ($self,$x) = @_; |
20
|
6
|
|
|
|
|
26
|
return $self->{Sx} * $x + $self->{Tx}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub Dy { |
24
|
6
|
|
|
6
|
1
|
8
|
my ($self,$y) = @_; |
25
|
6
|
|
|
|
|
26
|
return $self->{Sy} * $y + $self->{Ty}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |