# [R] x, y for point of intersection

Hans W Borchers hwborchers at googlemail.com
Thu Dec 1 12:13:49 CET 2011

```Monica has sent me some data and code for taking a quick look. As it
turned out, there was a simple programming error on her side. The
segm_distance() function in package 'pracma' is working correctly. And
there is no minimization procedure in here, it simply solves some
equations from plane geometry.

Maybe the function suggested by Don is faster, I haven't checked that.

Regards,  Hans Werner

2011/11/29 Monica Pisica <pisicandru at hotmail.com>
>
> Hi again,
>
> Working with my real data and not with the little example i sent to the list i discovered that segm_distance function from package "pracma" does not converge to 0 in all cases, even if i increase the number of iteration to 10,000 for example. It seems that it depends on the "initialization" point - most like a minimization function.
>
> So my thanks  go to Don who's suggestion works for the real data as well without any problems - so far ;-) He suggested to use the function crossing.psp from package "spatstat".
>
> Thanks again to all who have answered and helped to solve my problem. I certainly learned few new things.
>
> Monica
>
>
>
>
>
> > From: macqueen1 at llnl.gov
> > To: pisicandru at hotmail.com
> > CC: r-help at r-project.org
> > Date: Wed, 23 Nov 2011 14:03:42 -0800
>
> > Subject: Re: [R] x, y for point of intersection
> >
> > The function crossing.psp() in the spatstat package might be of use.
> > Here's an excerpt from its help page:
> >
> > crossing.psp package:spatstat R Documentation
> > Crossing Points of Two Line Segment PatternsDescription:
> > Finds any crossing points between two line segment patterns.
> > Usage:
> > crossing.psp(A,B)
> > -Don
> >
> >
> > --
> > Don MacQueen
> >
> > Lawrence Livermore National Laboratory
> > 7000 East Ave., L-627
> > Livermore, CA 94550
> > 925-423-1062
> >
>

```