[metapost] Re: new is_clockwise routine
Werner LEMBERG
wl at gnu.org
Fri Nov 25 14:49:10 CET 2005
Here a small update to my `makeline' routine. Some randomness is
needed for the direction of the line too.
Werner
======================================================================
vardef makeline primary p =
save start, loop, d, n;
pair start, d;
loop := 0;
for i = 0.5 step 1 until length p - 0.5:
% add some randomness to get different lines for each function call
n = uniformdeviate 0.9 - 0.45 + i;
start := point n of p;
d := direction n of p;
if d <> (0, 0):
loop := 1;
fi;
exitif loop = 1;
endfor;
if loop = 0:
errmessage ("Cannot find a starting point on path for orientation test");
fi;
- d := unitvector (d rotated (uniformdeviate 160 + 10));
+ d := unitvector (d rotated 90);
% construct line orthogonal to tangent which intersects path at least once
start - eps * d
-- infinity * d
enddef;
More information about the metapost
mailing list