| 1 |
% This is |
| 2 |
% pkparallel.mf |
| 3 |
% |
| 4 |
% Copyright (C) 1989-92 by Elmar Bartel. |
| 5 |
% |
| 6 |
% This program is free software; you can redistribute it and/or modify |
| 7 |
% it under the terms of the GNU General Public License as published by |
| 8 |
% the Free Software Foundation; either version 1, or (at your option) |
| 9 |
% any later version. |
| 10 |
% |
| 11 |
% This program is distributed in the hope that it will be useful, |
| 12 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
% GNU General Public License for more details. |
| 15 |
% |
| 16 |
% You should have received a copy of the GNU General Public License |
| 17 |
% along with this program; if not, write to the Free Software |
| 18 |
% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 |
% |
| 20 |
def NewPoint(expr p,t,dist) = |
| 21 |
{ begingroup pair Dir; |
| 22 |
Dir= direction t of p; %show p; show t; show Dir; |
| 23 |
Dir |
| 24 |
endgroup } |
| 25 |
(point t of p + (Dir rotated 90)*(dist/length(Dir))) |
| 26 |
enddef; |
| 27 |
def ParallelPath(expr p,dist) = |
| 28 |
begingroup |
| 29 |
save Dir; pair Dir; Dir = direction 0 of p; |
| 30 |
|
| 31 |
((point 0 of p)+(Dir rotated 90)*(dist/length(Dir))) {Dir} |
| 32 |
for t=.5 step .5 until length(p): |
| 33 |
.. NewPoint(p,t,dist) |
| 34 |
endfor |
| 35 |
endgroup |
| 36 |
enddef; |