"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Graphics/TriD/TriD/ArcBall.pm" between
PDL-2.076.tar.gz and PDL-2.077.tar.gz

About: PDL (Perl Data Language) aims to turn perl into an efficient numerical language for scientific computing (similar to IDL and MatLab).

ArcBall.pm  (PDL-2.076):ArcBall.pm  (PDL-2.077)
skipping to change at line 40 skipping to change at line 40
sub xy2qua { sub xy2qua {
my($this,$x,$y) = @_; my($this,$x,$y) = @_;
$x -= $this->{W}/2; $y -= $this->{H}/2; $x -= $this->{W}/2; $y -= $this->{H}/2;
$x /= $this->{SC}; $y /= $this->{SC}; $x /= $this->{SC}; $y /= $this->{SC};
$y = -$y; $y = -$y;
return $this->normxy2qua($x,$y); return $this->normxy2qua($x,$y);
} }
sub mouse_moved { sub mouse_moved {
my($this,$x0,$y0,$x1,$y1) = @_; my($this,$x0,$y0,$x1,$y1) = @_;
# Copy the size of the owning viewport to our size, in case it changed
# Copy the size of the owning viewport to our size, in case it changed...
$this->{H} = $this->{Win}->{H}; $this->{H} = $this->{Win}->{H};
$this->{W} = $this->{Win}->{W}; $this->{W} = $this->{Win}->{W};
if($PDL::Graphics::TriD::verbose) { if($PDL::Graphics::TriD::verbose) {
print "QuaterController: mouse-moved: $this: $x0,$y0,$x1,$y1,$this->{W} ,$this->{H},$this->{SC}\n" if($PDL::Graphics::TriD::verbose); print "QuaterController: mouse-moved: $this: $x0,$y0,$x1,$y1,$this->{W} ,$this->{H},$this->{SC}\n" if($PDL::Graphics::TriD::verbose);
if($PDL::Graphics::TriD::verbose > 1) { if($PDL::Graphics::TriD::verbose > 1) {
print "\tthis is:\n"; print "\tthis is:\n";
foreach my $k(sort keys %$this) { foreach my $k(sort keys %$this) {
print "\t$k\t=>\t$this->{$k}\n"; print "\t$k\t=>\t$this->{$k}\n";
} }
} }
} }
# Convert both to quaternions. # Convert both to quaternions.
my ($qua0,$qua1) = ($this->xy2qua($x0,$y0),$this->xy2qua($x1,$y1)); my ($qua0,$qua1) = ($this->xy2qua($x0,$y0),$this->xy2qua($x1,$y1));
# print "ARCBALLQ: ",(join ', ',@$qua0)," ",(join ', ',@$qua1),"\n";
my $arc = $qua1->multiply($qua0->invert()); my $arc = $qua1->multiply($qua0->invert());
# my $arc = $qua0->invert()->multiply($qua1);
if($this->{Inv}) { if($this->{Inv}) {
$arc->invert_rotation_this(); $arc->invert_rotation_this();
} }
$this->{Quat}->set($arc->multiply($this->{Quat})); $this->{Quat}->set($arc->multiply($this->{Quat}));
# print "ARCBALLQ: ",(join ', ',@$arc)," ",(join ', ',@{$this->
{Quat}}),"\n";
# $this->{Quat}->set($this->{Quat}->multiply($arc));
1; # signals a refresh 1; # signals a refresh
} }
# #
# Original ArcBall # Original ArcBall
# #
package PDL::Graphics::TriD::ArcBall; package PDL::Graphics::TriD::ArcBall;
use base qw/PDL::Graphics::TriD::QuaterController/; use base qw/PDL::Graphics::TriD::QuaterController/;
# x,y to unit quaternion on the sphere. # x,y to unit quaternion on the sphere.
 End of changes. 7 change blocks. 
15 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)