| 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__ | ||