chiark / gitweb /
working divconv
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Dec 2020 23:26:04 +0000 (23:26 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Dec 2020 23:38:24 +0000 (23:38 +0000)
pumpkin-books.ps

index c8102a761e41785a6496c47c47d613003d7ba590..d1be66bcb20f7f2b440468e0a16fa8b0ba1820f8 100644 (file)
@@ -5,33 +5,36 @@
 0 0 0 setrgbcolor
 1 setlinewidth
 
-/tw 115 def
+/tw 57.5 def
 /th 73 def
 /bdiag 5 def
 
-/diagconv {                    % xprop(-1..+1) yprop(0..1)
+tw  0  translate
+
+/diagconv {                    % xprop yprop
     dup th mul                 % xprop yprop y
     3 1 roll                   % y xprop yprop
     bdiag mul neg              % y xprop x-margin-at-this-height
-    tw add             % y xprop x-width-at-this-height
-    exch                       % y x-width-at-this-height xprop
-    1 add 0.5 mul             % y x-width-at-this-height xprop-adj(0..1)
-    mul                        % y x
+    tw add                     % y xprop x-width-at-this-height
+    exch mul                   % y x-width-at-this-height xprop
     exch                       % x y
 } def
 
-0 0 moveto
-tw 0 lineto
-tw bdiag sub th lineto
-bdiag th lineto
+newpath
+tw neg        0   moveto
+tw            0   lineto
+bdiag neg     th  rlineto
+bdiag tw sub  th  lineto
 closepath stroke
 
-tw 0.5 mul 0 moveto
+newpath
+0 0 moveto
 0 th rlineto stroke
 
 /thirddivline {               % xprop
+  newpath
   dup 3 div  0        diagconv moveto
-      3 div  0.8      diagconv lineto stroke
+      3 div  0.4      diagconv lineto stroke
                               %
 } def