So I have a region defined by something like MeshRegion[{{0, 0}, {1, 1}, {2, 1/2}, {2, -1/2}}, {Line[{1, 2}], Line[{2, 3}], Line[{3, 4}], Line[{4, 1}]}], and two points like Point[{1,2}] and Point[{5,5}] . Then I want to find a path which goes from one point to the region and then to the other point, and find the shortest one among all those possible paths. I have an idea of starting at a random point, then move the point along the region, towards the direction where the distance is shorter. If I start on an arbitrary large amount of points, then I can expect the best solution. However, I don't know how to move a point around a region, not to mention measuring each step. Is there a way to do so?

So as a update, I hope that this works with geo positions as well.

  • 2
    $\begingroup$ with mr = MeshRegion[...], NMinimize[{ArcLength[Line@{{1, 2}, {x, y}, {5, 5}}], RegionDistance[mr, {x, y}] == 0}, {x, y}] gives {6.65685, {x -> 1., y -> 1.}} $\endgroup$
    – kglr
    Jun 21, 2018 at 1:41
  • 2
    $\begingroup$ What does this have to do with graphs-and-networks? $\endgroup$
    – Michael E2
    Jun 21, 2018 at 2:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.