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

index d1be66bcb20f7f2b440468e0a16fa8b0ba1820f8..e97bdf1e039e3a1eb8856f0d2cd6929a0c526d29 100644 (file)
 
 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 mul                   % y x-width-at-this-height xprop
-    exch                       % x y
+% diagonal conversion
+/dc {                    % 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 mul             % y x-width-at-this-height xprop
+    exch                 % x y
 } def
 
 newpath
-tw neg        0   moveto
-tw            0   lineto
-bdiag neg     th  rlineto
-bdiag tw sub  th  lineto
+-1 0  dc moveto
++1 0  dc lineto
++1 1  dc lineto
+-1 1  dc lineto
 closepath stroke
 
 newpath
@@ -33,8 +34,8 @@ newpath
 
 /thirddivline {               % xprop
   newpath
-  dup 3 div  0        diagconv moveto
-      3 div  0.4      diagconv lineto stroke
+  dup 3 div  0        dc moveto
+      3 div  0.4      dc lineto stroke
                               %
 } def