[metapost] all intersections between two paths

Laurence Finston lfinsto1 at gwdg.de
Wed Jan 5 11:47:10 CET 2005


Hello Antonio,

I'm posting this to the mailing lists for the following reasons:

1.  I've been a subscriber to the Metafont list for some time, and I
    don't remember this question coming up.

2.  The Metapost list is new and I know this question hasn't come up.

The question is about finding all of the intersections of two arbitrary
`paths'.

On Wed, 5 Jan 2005, Antonio Ramirez wrote:

> Laurence Finston wrote:
> >
> > Plain Metafont does not provide a way of doing this, so if you're trying
> > to find the intersections of arbitrary `paths', I think iterating
> > through the subpaths would be be your best bet.  Someone might have
> > written a macro to solve this problem, though, so I suggest you post your
> > query to `metafont at ens.fr' and `metapost at tug.org'.
> >
> > [...]
>
> Yeah, they are arbitrary paths. I tried my hand at it but apparently I
> don't know enough about how subpaths are parameterized. The goal is to
> have a macro that computes all the pairs (u,v) such that point u of p
> equals point v of q, given paths p and q.
>
> The problem is this: say p1 is some path and I have
>
> p2 := subpath (t,infinity) of p1,
>
> then it is not always the case that (point s of p2) equals (point (s+t)
> of p1) as seemed reasonable to me at first; somehow I need to obtain the
> parameter time in the original path p1, but this is apparently not the
> way to do it.
>

Off the top of my head, I suspect it has to do with the "speed" of the
`paths'.  I think you should iterate over subpaths of length 1, but
perhaps someone has a more clever suggestion.


Laurence

>
> Meanwhile, thanks for your suggestions about mailing lists; I will
> probably post my query there after reading through archives.
>
> Thanks,
>
> Antonio
>



More information about the metapost mailing list