| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% % |
| 3 |
% Correction to PiCTeX 1.1 9/21/87 % |
| 4 |
% by Andreas Schrell, Wuppertal, FRG, 9/30/91 % |
| 5 |
% % |
| 6 |
% The bug forces wrong height and position of the % |
| 7 |
% vertical \betweenarrows - structure if the % |
| 8 |
% coordinate difference is negative. % |
| 9 |
% You can search for ERROR in this file. % |
| 10 |
% % |
| 11 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 12 |
|
| 13 |
{\catcode`!=11 |
| 14 |
|
| 15 |
\global |
| 16 |
\def\betweenarrows #1#2 from #3 #4 to #5 #6 {% |
| 17 |
\!xloc=\!M{#3}\!xunit \!xxloc=\!M{#5}\!xunit% |
| 18 |
\!yloc=\!M{#4}\!yunit \!yyloc=\!M{#6}\!yunit% |
| 19 |
\!dxpos=\!xxloc \advance\!dxpos by -\!xloc |
| 20 |
\!dypos=\!yyloc \advance\!dypos by -\!yloc |
| 21 |
\advance\!xloc .5\!dxpos |
| 22 |
\advance\!yloc .5\!dypos |
| 23 |
% |
| 24 |
\let\!MBA=\!M% ** save current coord\dimen mode |
| 25 |
\!setdimenmode% ** express locations in dimens |
| 26 |
\ifdim\!dypos=\!zpt |
| 27 |
\ifdim\!dxpos<\!zpt \!dxpos=-\!dxpos \fi |
| 28 |
\put {\!lrarrows{\!dxpos}{#1}}#2{} at {\!xloc} {\!yloc} |
| 29 |
\else |
| 30 |
\ifdim\!dxpos=\!zpt |
| 31 |
% \ifdim\!dypos<\!zpt \!dypos=-\!zpt \fi |
| 32 |
% ^^^^^ ERROR! |
| 33 |
\ifdim\!dypos<\!zpt \!dypos=-\!dypos \fi |
| 34 |
% ^^^^^^^ CORRECTION! |
| 35 |
\put {\!udarrows{\!dypos}{#1}}#2{} at {\!xloc} {\!yloc} |
| 36 |
\fi |
| 37 |
\fi |
| 38 |
\let\!M=\!MBA% ** restore previous c/d mode |
| 39 |
\ignorespaces} |
| 40 |
|
| 41 |
|
| 42 |
% correction added by Robin Fairbairns ([email protected]) 1999/09/14 |
| 43 |
|
| 44 |
\def\!qjoin (#1,#2) (#3,#4){% |
| 45 |
\advance\!intervalno by 1 |
| 46 |
\!ifcoordmode |
| 47 |
\edef\!xmidpt{#1}\edef\!ymidpt{#2}% |
| 48 |
\else |
| 49 |
\!dimenA=#1\relax \edef\!xmidpt{\the\!dimenA}% |
| 50 |
% \!dimenA=#2\relax \edef\!xmidpt{\the\!dimenA}% WRONG |
| 51 |
% ^^^^^^^^ |
| 52 |
\!dimenA=#2\relax \edef\!ymidpt{\the\!dimenA}% |
| 53 |
% ^^^^^^^^ |
| 54 |
\fi |
| 55 |
\!xM=\!M{#1}\!xunit \!yM=\!M{#2}\!yunit \!rotateaboutpivot\!xM\!yM |
| 56 |
\!xE=\!M{#3}\!xunit \!yE=\!M{#4}\!yunit \!rotateaboutpivot\!xE\!yE |
| 57 |
% |
| 58 |
% ** Find coefficients for x(t)=a_x + b_x*t + c_x*t**2 |
| 59 |
\!dimenA=\!xM \advance \!dimenA by -\!xS% ** dimA = I = xM - xS |
| 60 |
\!dimenB=\!xE \advance \!dimenB by -\!xM% ** dimB = II = xE-xM |
| 61 |
\!xB=3\!dimenA \advance \!xB by -\!dimenB% ** b=3I-II |
| 62 |
\!xC=2\!dimenB \advance \!xC by -2\!dimenA% ** c=2(II-I) |
| 63 |
% |
| 64 |
% ** Find coefficients for y(t)=y_x + b_y*t + c_y*t**2 |
| 65 |
\!dimenA=\!yM \advance \!dimenA by -\!yS% |
| 66 |
\!dimenB=\!yE \advance \!dimenB by -\!yM% |
| 67 |
\!yB=3\!dimenA \advance \!yB by -\!dimenB% |
| 68 |
\!yC=2\!dimenB \advance \!yC by -2\!dimenA% |
| 69 |
% |
| 70 |
% ** Use Simpson's rule to calculate arc length over [0,1/2]: |
| 71 |
% ** arc length = 1/2[1/6 f(0) + 4/6 f(1/4) + 1/6 f(1/2)] |
| 72 |
% ** with f(t) = sqrt(x'(t)**2 + y'(t)**2). |
| 73 |
\!xprime=\!xB \!yprime=\!yB% ** x'(t) = b + 2ct |
| 74 |
\!dxprime=.5\!xC \!dyprime=.5\!yC% ** dt=1/4 ==> dx'(t) = c/2 |
| 75 |
\!getf \!midarclength=\!dimenA |
| 76 |
\!getf \advance \!midarclength by 4\!dimenA |
| 77 |
\!getf \advance \!midarclength by \!dimenA |
| 78 |
\divide \!midarclength by 12 |
| 79 |
% |
| 80 |
% ** Get arc length over [0,1]. |
| 81 |
\!arclength=\!dimenA |
| 82 |
\!getf \advance \!arclength by 4\!dimenA |
| 83 |
\!getf \advance \!arclength by \!dimenA |
| 84 |
\divide \!arclength by 12% ** Now have arc length over [1/2,1] |
| 85 |
\advance \!arclength by \!midarclength |
| 86 |
\global\advance \totalarclength by \!arclength |
| 87 |
% |
| 88 |
% |
| 89 |
% ** Check to see if there's anything to plot in this interval |
| 90 |
\ifdim\!distacross>\!arclength |
| 91 |
\advance \!distacross by -\!arclength% ** nothing |
| 92 |
% |
| 93 |
\else |
| 94 |
\!initinverseinterp% ** initialize for inverse interpolation on arc length |
| 95 |
\loop\ifdim\!distacross<\!arclength% ** loop over points on arc |
| 96 |
\!inverseinterp% ** find t such that arc length[0,t] = distacross, |
| 97 |
% ** using inverse quadratic interpolation |
| 98 |
% ** now evaluate x(t)=(c*t + b)*t + a |
| 99 |
\!xpos=\!t\!xC \advance\!xpos by \!xB |
| 100 |
\!xpos=\!t\!xpos \advance \!xpos by \!xS |
| 101 |
% ** evaluate y(t) |
| 102 |
\!ypos=\!t\!yC \advance\!ypos by \!yB |
| 103 |
\!ypos=\!t\!ypos \advance \!ypos by \!yS |
| 104 |
\!plotifinbounds% ** plot point if in bounds |
| 105 |
\advance\!distacross \plotsymbolspacing%** advance arc length for next pt |
| 106 |
\!advancedashing% ** see "linear" |
| 107 |
\repeat |
| 108 |
% |
| 109 |
\advance \!distacross by -\!arclength% ** prepare for next interval |
| 110 |
\fi |
| 111 |
% |
| 112 |
\!xS=\!xE% ** shift ending points to starting points |
| 113 |
\!yS=\!yE |
| 114 |
\ignorespaces} |
| 115 |
} |
| 116 |
|
| 117 |
\endinput |
| 118 |
|