X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=distort-stl;h=68290c410a6ae4738d680d6409abd8f3464c008e;hb=6dba99d4594590c1af949fbd0379d366a05c2ca6;hp=8167e3540932a14f62954b1790e229528ba624ec;hpb=f5e5bb227ce24bc8faa92c700583f7a06bc894d0;p=reprap-play.git diff --git a/distort-stl b/distort-stl index 8167e35..68290c4 100755 --- a/distort-stl +++ b/distort-stl @@ -32,7 +32,7 @@ use Data::Dumper; sub TAU () { M_PI * 2; } -our $debug = $ENV{DISTORT_DEBUG}; +our $debug = $ENV{DISTORT_DEBUG} // 0 ; my $ps = $ENV{DISTORT_PS}; if ($ps) { @@ -104,6 +104,7 @@ sub maybe_subdivide_triangle ($$$$) { printf STDERR "OK nok=%d nchanged=%d\n", (scalar @$ok), (scalar @$changed) if $debug; + print STDERR Dumper(\@$ok) if $debug>=2; return; } my ($dummy,$ix,$jx) = @longest; @@ -179,7 +180,7 @@ sub project_cylinder_tri { my $radius = $project_cylinder_radius; my @ot; - foreach my $p (@$t) { + foreach my $p (@$t[0..2]) { my ($x,$y,$z) = @$p; my $r = $radius - $y; my $theta = $x / $radius; @@ -187,6 +188,7 @@ sub project_cylinder_tri { -$r * cos($theta), $z ]; } + push @ot, $t->[3].'P'; append_triangle \@ot; } @@ -274,8 +276,8 @@ print "solid distort-stl\n"; foreach my $t (@$triangles) { print " facet normal 0 0 0\n"; print " outer loop\n"; - die unless @$t==3; - foreach my $p (@$t) { + die unless @$t==4; + foreach my $p (@$t[0..2]) { die unless @$p==3; print " vertex"; printf " %.18g", $_ foreach @$p;