Diff of /lib/Panotools/Script.pm [04f7a6] .. [b69cf9]  Maximize  Restore

Switch to side-by-side view

--- a/lib/Panotools/Script.pm
+++ b/lib/Panotools/Script.pm
@@ -29,10 +29,13 @@
 use Panotools::Script::Line::ControlMorph;
 use Panotools::Script::Line::Variable;
 
+use Panotools::Matrix qw(matrix2rollpitchyaw rollpitchyaw2matrix);
+use Math::Trig;
+
 use File::Temp qw/ tempfile /;
 use File::Spec;
 
-our $VERSION = 0.01;
+our $VERSION = 0.02;
 
 our $CLEANUP = 1;
 $CLEANUP = 0 if defined $ENV{DEBUG};
@@ -87,6 +90,7 @@
 
     for my $line (@raw)
     {
+        $line =~ s/(\r|\n)//g;
         $self->{mode}->Parse ($line) if ($line =~ /^m /);
         $self->{panorama}->Parse ($line) if ($line =~ /^p /);
         $self->{variable}->Parse ($line) if ($line =~ /^v /);
@@ -185,6 +189,33 @@
     $self->{output} = $try->{output};
     $self->Output2Image;
     return 1;
+}
+
+=pod
+
+Rotate transform all the images in a project, angles in degrees:
+
+  $p->Transform ($roll, $pitch, $yaw);
+
+=cut
+
+sub Transform
+{
+    my $self = shift;
+    my ($roll, $pitch, $yaw) = @_;
+    my @transform_rpy = map (deg2rad ($_), ($roll, $pitch, $yaw));
+    my $transform_matrix = rollpitchyaw2matrix (@transform_rpy);
+    for my $image (@{$self->{image}})
+    {
+        my @rpy = map (deg2rad ($_), ($image->{r}, $image->{p}, $image->{y}));
+        my $matrix = rollpitchyaw2matrix (@rpy);
+        my $result = $transform_matrix->multiply ($matrix);
+        my ($r, $p, $y) = map (rad2deg ($_), matrix2rollpitchyaw ($result));
+        $image->{r} = $r;
+        $image->{p} = $p;
+        $image->{y} = $y;
+    }
+    $self->Image2Output;
 }
 
 =pod

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks