Detect opposing line to find closest distance

All about geometry

Detect opposing line to find closest distance

Postby Guest » Wed Jun 27, 2018 3:55 am

I have a problem in programming but in my opinion, this is a problem pretty related to a math problem.

I have a number of line segments (n). These line segments form a polygon. (See example cases in the figure)
Now I am defining one line segment as start. (For example the top line in example case a) )
I want to "roll" a ball with a variable radius through the polygon. In case of example e) the script shall detect that 2 balls are required to follow the polygon afterwards. But that is more script related and less to math.

Now: How does the script know, which opposing line to consider to calculate the ball midpoint + radius?
In example case a) its comparably easy. Perpendicular line and get the intersection with another line and build the ball.

This approach is not suitable for example case b.

My next idea was to loop through points on the line, build a circle around it with increasing radius and find the first line which intersects or tangents the circle.
However, this seems also not like a clean solution to me.

Basically, in my opinion there must be a clean mathematical geometrical solution to it, but I am not able to find it right now.

Does somebody have an idea?:)

If I did not describe the question clear enough, please feel free to tell me.

Thanks a lot!


Return to Geometry

Who is online

Users browsing this forum: No registered users and 2 guests