|
Hi all, In M9, I have a drawing with points and another with lines. For each point, I want to find the the closest point on the line. In other words, I'd like to snap the points to the lines. The GeomDistance tells me the distance to the closest line but does not return the point. I read somewhere in this forum (https://georeference.org/forum/t160399.6#160419) that we could normalize both layers at the same time, but then either the point or the line might be moved, which is problematic to me, since I only want to change points position. Our approach was then to draw a circle with the distance from GeomDistance as the radius and get the intersection between the line and the circle. The problem is that circles in manifold are not exact circles and sometimes the intesection returns nothing. We then added a tolerance of 1/1000 of the distance to make sure that the circle does indeed cross the line. However, we are left with two intersecting points. For our application, any of the two points is sufficiently accurate and we only consider the first point. A more accurate approach would be to calculate the middle point between the two points of the intersection. This technique does take some time when applied to hundreds of thousands of points, whereas GeomDistance itself is very fast. Is there a faster approach to get the point geometry we are looking for? It seems to me that the geometry of the nearest point should be calculated (as temporary result) when calling the GeomDistance function. Would it be possible (and would it make sense) to have a function similar to GeomDistance that would return the geometry of the nearest point? Any thoughts on the problem is welcome.
|