|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 3190 (0xc76) Types: TextFile Names: »spline.psr«
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12 └─⟦af5ba6c8e⟧ »unix3.0/DVIWARE.tar.Z« └─⟦ca79c7339⟧ └─⟦this⟧ »DVIware/laser-setters/dvi-to-ps/TeXPS/dvitps/psr/spline.psr«
% Copyright (c) 1988 Stephan v. Bechtolsheim % This file is part of the TeXPS Software Package. % The TeXPS Software Package is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY. No author or distributor % accepts responsibility to anyone for the consequences of using it % or for whether it serves any particular purpose or works at all, % unless he says so in writing. Refer to the TeXPS Software Package % General Public License for full details. % Everyone is granted permission to copy, modify and redistribute % the TeXPS Software Package, but only under the conditions described in the % TeXPS Software Package General Public License. A copy of this license is % supposed to have been given to you along with TeXPS Software Package so you % can know your rights and responsibilities. It should be in a % file named CopyrightLong. Among other things, the copyright notice % and this notice must be preserved on all copies. % Draw a Chaikin spline, which is the same one ditroff uses. % (Needed by tpic support). % x1 y1 x2 y2 ... xn yn n @ChaikinSplineDraw /@ChaikinSplineSectionDict 20 dict def /@ChaikinSplineSectionShow { % paras : x1 y1 x2 y2 x3 y3 x4 y4 @ChaikinSplineSectionDict begin /y4 exch def /x4 exch def /y3 exch def /x3 exch def /y2 exch def /x2 exch def /y1 exch def /x1 exch def /xm x2 x3 add 2 div def % xm = (x2 + x3) / 2 /ym y2 y3 add 2 div def % ym = (y2 + y3) / 2 x1 xm sub abs 3 lt y1 ym sub abs 3 lt and % abs(x1-xm)<3 && abs(y1-ym)<3 { x1 y1 moveto xm ym lineto stroke } { xm ym x1 y1 x2 y2 x3 y3 x4 y4 % save these on the stack x1 y1 % parameters for the next recursion x1 x2 add 2 div y1 y2 add 2 div x2 3 mul x3 add 4 div y2 3 mul y3 add 4 div xm ym @ChaikinSplineSectionShow /y4 exch def /x4 exch def /y3 exch def /x3 exch def /y2 exch def /x2 exch def /y1 exch def /x1 exch def /ym exch def /xm exch def % pop them back } ifelse xm x4 sub abs 3 lt ym y4 sub abs 3 lt and % abs(x1-xm)<3 && abs(y1-ym)<3 { xm ym moveto x4 y4 lineto stroke } { xm ym x2 x3 3 mul add 4 div y2 y3 3 mul add 4 div x3 x4 add 2 div y3 y4 add 2 div x4 y4 @ChaikinSplineSectionShow } ifelse end } def /@ChaikinSplineDict 22 dict def /@ChaikinSplineDraw { @ChaikinSplineDict begin /n exch def n 2 mul -2 roll /y1 exch def /x1 exch def /n n 1 sub def n 2 mul -2 roll /y2 exch def /x2 exch def /n n 1 sub def /cx1 x1 x2 add 2 div def % cx1 = (x1+x2)/2 /cy1 y1 y2 add 2 div def /cx2 x1 3 x2 mul add 4 div def % cx2 = (x1 + 3x2)/4 /cy2 y1 3 y2 mul add 4 div def newpath x1 y1 moveto cx1 cy1 lineto { n 0 eq {exit} if /x1 x2 def /y1 y2 def n 2 mul -2 roll /y2 exch def /x2 exch def /n n 1 sub def /cx3 3 x1 mul x2 add 4 div def /cy3 3 y1 mul y2 add 4 div def /cx4 x1 x2 add 2 div def /cy4 y1 y2 add 2 div def cx1 cy1 cx2 cy2 cx3 cy3 cx4 cy4 @ChaikinSplineSectionShow /cx1 cx4 def /cy1 cy4 def /cx2 x1 3 x2 mul add 4 div def /cy2 y1 3 y2 mul add 4 div def } loop cx1 cy1 moveto x2 y2 lineto stroke end } def