Skip to content

Commit ce45b2b

Browse files
committed
let each QuaterController decide what to do with scaling x/y
1 parent 5ab3bce commit ce45b2b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/PDL/Graphics/TriD/ArcBall.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ sub new {
3030
sub xy2qua {
3131
my($this,$x,$y) = @_;
3232
$x -= $this->{W}/2; $y -= $this->{H}/2;
33-
$x /= $this->{SC}; $y /= $this->{SC};
3433
$y = -$y;
3534
return $this->normxy2qua($x,$y);
3635
}
@@ -66,6 +65,7 @@ use base qw/PDL::Graphics::TriD::QuaterController/;
6665
# x,y to unit quaternion on the sphere.
6766
sub normxy2qua {
6867
my($this,$x,$y) = @_;
68+
$x /= $this->{SC}; $y /= $this->{SC};
6969
my $dist = sqrt ($x ** 2 + $y ** 2);
7070
if($dist > 1.0) {$x /= $dist; $y /= $dist; $dist = 1.0;}
7171
my $z = sqrt(1-$dist**2);
@@ -80,6 +80,7 @@ use base qw/PDL::Graphics::TriD::QuaterController/;
8080
# x,y to unit quaternion on the sphere.
8181
sub normxy2qua {
8282
my($this,$x,$y) = @_;
83+
$x /= $this->{SC}; $y /= $this->{SC};
8384
my $dist = sqrt ($x ** 2 + $y ** 2);
8485
if($dist > 1.0) {$x /= $dist; $y /= $dist; $dist = 1.0;}
8586
my $z = 1-$dist;
@@ -96,6 +97,7 @@ use base qw/PDL::Graphics::TriD::QuaterController/;
9697
# x,y to unit quaternion on the sphere.
9798
sub normxy2qua {
9899
my($this,$x,$y) = @_;
100+
$x /= $this->{SC}; $y /= $this->{SC};
99101
my $dist = sqrt ($x ** 2 + $y ** 2);
100102
if($dist > 1.0) {$x /= $dist; $y /= $dist; $dist = 1.0;}
101103
my $z = cos($dist*3.142/2);

0 commit comments

Comments
 (0)