Giuseppe Bilotta
Saturday, March 22, 2003 Hans Hagen wrote:
I would like to know if it is possible in MetaPost (in particular MetaFun) to get all the possible intersection points of the paths,
[snip]
Anything like this?
HH> not that i know, but assuming that those path have some distance, i can HH> imagine dividing a path in parts and determining the intersectionpoints iof HH> the pieces;
HH> delta := .25 ;
HH> for i=0 step delta upto length(p)-delta : HH> if intersection_found(1,subpath(i,i+.1) of p) : HH> store point HH> fi ; HH> endfor ;
I'll see if I can make something of this ... (wow, looks like I'm gonna need to learn MetaPost too ...)
I implemented it by finding some intersectiontime and the recursively finding the intersectionstimes of the two subpaths (each with some neighbourhood of the first intersection point cut off). For the time being I cannot find my code, but here it is in pseude code. let p and q be paths; let (s,t) be a pair of intersection times of p and q; recursively find the intersection times of the subpath (0, s - small number) of p and q; store (s,t); recursively find the intersection times of the subpath (s + small number, infinity) of p and q; feel happy; When done this way, the intersection times will be sorted according to the first path. -- Emil Hedevang Lohse http://home.imf.au.dk/emil/ Alle spørgsmål er lige dumme. Og spørgsmålet "Kan ænder flyve?" er ikke dumt.