Hi everybody, Thanks for checking my code, Hans, it help to see where my initial mistake was. I am sorry i assumed that there was a minimization problem.
In short i had 2 "wavy" lines (left and right) that didn't intersect and lots of straight parallel lines that intersect the first 2 lines. I wanted to solve the intersection for the left and right line simultaneously and put everything in a big loop. And there the mistake was. Meanwhile i was able to use Don suggestion with no problem and no loop. Thanks again, Monica > Date: Thu, 1 Dec 2011 12:13:49 +0100 > Subject: Re: [R] x, y for point of intersection > From: hwborch...@googlemail.com > To: r-help@r-project.org > CC: macque...@llnl.gov; pisican...@hotmail.com; dwinsem...@comcast.net; > ted.hard...@wlandres.net > > 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 <pisican...@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: macque...@llnl.gov > > > To: pisican...@hotmail.com > > > CC: r-help@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 > > > > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.