Loop While Geometry Intentersection <1

Hi everyone!

I’m working on a graph in which I need to find the shortest distance from a point to another unspecified point on a curve. I thought that the LoopWhile node could come in handy, but I can’t wrap my head around how it works.

In order to find the shortest distance I want to create a circle by center point and radius at my known point. Then I want to test for intersections between the circle and the curve. I want to loop this and vary the circle radius until the intersection count with the curve equals 1. The point where the circle intersects the curve only once is then the output that I’m interested in. Is this at all possible to do in Dynamo? Any answers are very much appreciated.

I’ve attached a (very) simplified image of my problem:

@Ralle More often than not, if you find yourself using Loop While, there is a better way
In this case, just use Geometry.ClosestPointTo

4 Likes

I assume this is more than finding the correct radius but rather to find the distance from a specified point and to a curve/line? The loop-while node is a little tricky, have you had a look at the previous posts etc regarding the loopwhile node?

Wow, I did not know this node existed. It was exactly what I needed. Thank you so much!

2 Likes

If a comment solved your problem, mark it as solution (and maye leave a like here and there).

1 Like