tail -n +5 Sculptie.pgm | perl -nle 'BEGIN{$l=$c=0;} $c++ unless($_);if(++$l==127){$l=0;print $c; $c=0;}' > Sculptie.zr #!/usr/bin/perl # Use: rot.pl < Sculptie.zr > Sculptie.ppm #4 * atan2 1, 1; my $step= 4*atan2(1,1)/128; my $i=0; my $a=$step*255; my @r,$j,$k,$z,$zi; while(<>) { chomp; $r[$i++]=$_; } $z=$i; $z--; print "P3\n256 256 255\n"; for($j=$z;$j>-1;$j--) { $a=$step*255; for($i=0;$i<256;$i++) { my $x=127+int($r[$j]*cos($a)); my $y=127+int($r[$j]*sin($a)); print "$x $y $j\n"; $a-=$step; } }