Create Centreline inside closed polyline using angles

Hello all,

I would like to create line with given range of angle to form centreline between two points (circled) like below image. Input is 2 points and closed curve and it creates lines in middle of closed polygon with given range of angles for example (45 to 135 degrees)
please help!!

Hi, someone who has a good hold on Shortest Walk might be able to solve this I think. Here, the “middle of closed polygon” is a pretty lose definition mathematically speaking. But maybe I lack info, let’s hear what others have to say on this matter, pretty curious. This could be used for circulation diagrams, practical minimum walking distance from A to B. Thank you for the question.

Hey Syed,

Shortest walk might be little easier if you populate points inside polyline and connect line between start and end. Then choose points closer to line then create line from those points and smoothen it

does your red polyline need to be 3 segments all the time?

no it can be n number as long it follows mid path

i see. since this is a non-trivial problem, i will only hint you towards an approximate solution

  1. use a plugin to find the medial axis of your polygon
  2. check on which edges your two points lie in - delete the medial axis line that touch those edges. draw the lines between your point to the closest remaining point of the medial axis
  3. find the shortest path between the two points (this is the non-trivial part)
  4. check for angles and (also non-trivial) adjust the path iteratively until all the angles satisfy you constraint
  5. since the solution is a continuous space → have a logic for the optimal solution for satisfying the constraint (also non-trivial)

Does that could be good for you ?
CurveConnectPoints
CurveCoonects_

I don’t really understand your angle constrain that could be impossible to obtain or easy to suppress.

1 Like

Hi Laurent,

Yes seems good enough. I found another solution but now I am trying to figure out angle. For a given polyline how it can connect both point based on given angle input

Here is my way of doing
Making Medial Axis, Suppressing Dead End, Finding closest line between medial axis to the point (this could/must be improved in order that the line stay inside the boundary), then some curve cleaning and use of Shortes Walk

This is not very clear, it could be better with some file and some drawing
connect points.gh (20.1 KB)

Hello Laurent,

Great work with less components, my definition was quite bigger without these plugins… The polyline we create should connect two points with given angle. Here I set angle range of 120 to 135 degrees… Angle is global. Attached file for reference

centreline test.3dm (32.6 KB)

here’s a simpler definition
connect points [simple].gh (14.5 KB)

now to get the angles you need, you need to iterate on the resulting polyline, adjusting the number of segments (could be a simple rebuild) and/or moving the vertices.

1 Like

Hello Adel,

Thanks for this will definitely add looping component to solve this or will iterate using C#