From: Ian Jackson Date: Sun, 7 Jan 2018 20:21:44 +0000 (+0000) Subject: distort-stl: works now but needs to do something about lines X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=reprap-play.git;a=commitdiff_plain;h=abb8e254760ea536a17c97cc78191c1cc6403a93 distort-stl: works now but needs to do something about lines --- 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";