2011/7/15 Andrew Poelstra <as...@sfu.ca>: > On Thu, Jul 14, 2011 at 08:50:10AM +0200, Igor Lopez wrote: >> >> Check if point px,py is on rotaded elliptic arc: >> 1) Translate point to use ellipse center as origin, >> Px = px-x >> Py = py-y >> 2) Insert Px, Py in Eq1 >> lval equal 0 -> point is exactly on arc >> lval above zero -> point is inside arc >> lval below zero -> point is outside arc >> > > The problem here is that the elliptical arc has nonzero > thickness (usually, if it is a drawn solder arc). So I > actually need to see if the point is /within a certain > radius/ of the arc. > > For that I need the distance from the point to the arc, > or to draw a circle around the point and check if that > intersects the arc.
That is why I proposed two equations, one for the inner arc and one for the outer arc. Add resp Subtract half the arc thickness in the expression for the equations parameters and if the point has a radius one needs to add resp subtract that as well. With this approach it is rather simple to check if the point intersects the arc by evaluating the left side values of both equations. The point will intersect if the left hand value for the small arc is below or equal to zero and if the left hand value for the larger arc is above or equal to zero. It is an order of magnitude more difficult if the point is not a circle. I will have a look at the code for arc intersecting with another arc but I guess it will be rather more complicted. > To do either one analytically looks like a 4th order > equation must be solved. So I am looking for cheap > iterative solutions, or approximations, instead. > > -- > Andrew Poelstra > Email: asp11 at sfu.ca OR apoelstra at wpsoftware.net > Web: http://www.wpsoftware.net/andrew/ > > > > _______________________________________________ > geda-user mailing list > geda-user@moria.seul.org > http://www.seul.org/cgi-bin/mailman/listinfo/geda-user > _______________________________________________ geda-user mailing list geda-user@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-user