"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Graphics/TriD/TriD/Control3D.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).

Control3D.pm  (PDL-2.076):Control3D.pm  (PDL-2.077)
skipping to change at line 21 skipping to change at line 21
# at negative z axis). # at negative z axis).
# 4. camera "rotation" after that (not always usable). # 4. camera "rotation" after that (not always usable).
package PDL::Graphics::TriD::SimpleController; package PDL::Graphics::TriD::SimpleController;
use strict; use strict;
use warnings; use warnings;
use fields qw/WOrigin WRotation CDistance CRotation/; use fields qw/WOrigin WRotation CDistance CRotation/;
sub new{ sub new{
my ($class) = @_; my ($class) = @_;
my $self = fields::new($class); my $self = fields::new($class);
$self->reset(); $self->reset();
$self; $self;
} }
sub normalize { my($this) = @_; sub normalize { my($this) = @_;
$this->{WRotation}->normalize_this(); $this->{WRotation}->normalize_this();
$this->{CRotation}->normalize_this(); $this->{CRotation}->normalize_this();
} }
sub reset { sub reset {
my($this) = @_; my($this) = @_;
$this->{WOrigin} = [0,0,0]; $this->{WOrigin} = [0.5,0.5,0.5];
$this->{WRotation} = PDL::Graphics::TriD::Quaternion->new(1,0,0,0); $this->{WRotation} = PDL::Graphics::TriD::Quaternion->new(
# $this->{WRotation} = PDL::Graphics::TriD::Quaternion->new( 0.715, -0.613, -0.204, -0.272); # isometric-ish like gnuplot
# 0.847, -0.458, -0.161, -0.216); $this->{CDistance} = 2.5;
# $this->{WRotation} = PDL::Graphics::TriD::Quaternion->new(
# 0.347, -0.458, -0.161, -0.216);
$this->{CDistance} = 5;
$this->{CRotation} = PDL::Graphics::TriD::Quaternion->new(1,0,0,0); $this->{CRotation} = PDL::Graphics::TriD::Quaternion->new(1,0,0,0);
} }
sub set { sub set {
my($this,$options) = @_; my($this,$options) = @_;
foreach my $what (keys %$options){ foreach my $what (keys %$options){
if($what =~ /Rotation/){ if($what =~ /Rotation/){
$this->{$what}[0] = $options->{$what}[0]; $this->{$what}[0] = $options->{$what}[0];
$this->{$what}[1] = $options->{$what}[1]; $this->{$what}[1] = $options->{$what}[1];
$this->{$what}[2] = $options->{$what}[2]; $this->{$what}[2] = $options->{$what}[2];
$this->{$what}[3] = $options->{$what}[3]; $this->{$what}[3] = $options->{$what}[3];
}elsif($what eq 'WOrigin'){ }elsif($what eq 'WOrigin'){
$this->{$what}[0] = $options->{$what}[0]; $this->{$what}[0] = $options->{$what}[0];
$this->{$what}[1] = $options->{$what}[1]; $this->{$what}[1] = $options->{$what}[1];
$this->{$what}[2] = $options->{$what}[2]; $this->{$what}[2] = $options->{$what}[2];
 End of changes. 4 change blocks. 
11 lines changed or deleted 4 lines changed or added

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