I have a question about the behaviour of t_linear in PDL::Transform:

If you use t_linear a lot, you can use the Offset and Shift options to
rotate an image about any chosen point. 

I'd naively expect Offset and Shift to be equal but opposite in
magnitude to get the desired effect, but this is not the case - I have
to add an additional 0.5 to the Shift coordinates to get it to perform
the way I'd expect it to.

I've attached a program that demonstrates this behaviour - remove the
"+0.5" values in t_linear to see the difference it makes.

Thanks,

Matt

#!/usr/bin/perl -w
use PDL;
use PDL::NiceSlice;
use PDL::Graphics::PGPLOT;
use PDL::Fit::Linfit;
use PDL::AutoLoader;
use PDL::Transform;
use strict;

dev("/xs",4,4,{Color=>1,AxisColour=>1, 
            Linewidth=>1, HardLw => 3,
            HardCH=>1.6,
            WindowWidth=>6, Aspect=>1.0});

# make a semicircle with center at 4,4
my $s = 9;
my $im = rvals($s,$s);
$im = ($im<($s/2));
$im(0:4,) .= 0;

my $x = 4; my $y = 4;

my $scale = 1;
for (my $rot = 0; $rot <= 180; $rot +=20) {
my $t =
t_linear(Offset=>[-$x,-$y],Rotation=>$rot,Scale=>$scale,Shift=>[$x+0.5,$y+0.5]);

my $nim = $t->map($im,{pix=>1});

imag $nim;

}



-- 
Matthew Kenworthy / Instrument Scientist / CAAO / Steward Observatory
Room N414 / 933 N. Cherry Ave / Tucson AZ 85721 / vox 520 626 6720

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to