From abb8e254760ea536a17c97cc78191c1cc6403a93 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 7 Jan 2018 20:21:44 +0000 Subject: [PATCH] distort-stl: works now but needs to do something about lines --- distort-stl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/distort-stl b/distort-stl index da9b4ae..4820e03 100755 --- a/distort-stl +++ b/distort-stl @@ -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 () { 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"; -- 2.30.2