chiark / gitweb /
distort-stl: works now but needs to do something about lines
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 7 Jan 2018 20:21:44 +0000 (20:21 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 7 Jan 2018 20:21:44 +0000 (20:21 +0000)
distort-stl

index da9b4aef89e4fa65ef756d14ed4cb0a7877dafd9..4820e03104d51485c3d7b00a9b3f945aa1f05961 100755 (executable)
@@ -29,13 +29,13 @@ sub shift_arg () {
     scalar shift @ARGV;
 }
 
-sub pointmap_distortion {
+sub pointmap_project_cylinder {
     my ($x,$y,$z) = @_;
     my $radius = shift_arg;
-    my $r = $y + $radius;
+    my $r = $radius - $y;
     my $theta = $x / $radius;
-    return ($r * cos($theta),
-           $r * sin($theta),
+    return ($r * sin($theta),
+           -$r * cos($theta),
            $z);
 }
 
@@ -62,7 +62,8 @@ while (<I>) {
        my @xyz = split /\s+/, $_;
        while (@ARGV) {
            my $op = shift_arg;
-           @xyz = &{ $::{"pointmap_$op"} }( @xyz );
+           $op =~ y/-/_/;
+           @xyz = &{ ${*::}{"pointmap_$op"} }( @xyz );
        }
        @xyz = map { sprintf "%.18g", $_ } @xyz;
        $_ = "$lhs@xyz\n";