From 223483c8d3b11bb1a848d02df1ac5c90422e726f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 25 Nov 2018 12:52:01 +0000 Subject: [PATCH] distort-stl: debugging PS output, incomplete Not all that useful because typically it's off the screen or something. And there is no showpage. At least, in my current test case it produces a file which looks blank in gv. Signed-off-by: Ian Jackson --- distort-stl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/distort-stl b/distort-stl index 68b7e28..1f177dc 100755 --- a/distort-stl +++ b/distort-stl @@ -32,6 +32,12 @@ use Data::Dumper; sub TAU () { M_PI * 2; } +my $ps = %ENV{DISTORT_PS}; +if ($ps) { + open PS, "> $ps" or die $!; + print PS "%!\n"; +} + our $fa = 10; our $triangles; @@ -47,6 +53,20 @@ sub shift_arg () { sub sprintf_triangle ($) { my ($t) = @_; + if ($ps && $t->[3] =~ m/$ENV{DISTORT_PS_RE}/) { + printf PS <<'END', + %20.16g %20.16g %20.16g moveto + %20.16g %20.16g %20.16g lineto + %20.16g %20.16g %20.16g lineto + closepath stroke +END + $t->[0][0], $t->[0][1], $t->[0][2], + $t->[1][0], $t->[1][1], $t->[1][2], + $t->[2][0], $t->[2][1], $t->[2][2], + or die $!; + flush PS or die $!; + } + sprintf "%11.6f,%11.6f,%11.6f / ". "%11.6f,%11.6f,%11.6f / ". -- 2.30.2