Create polygon from closest line segments that enclose a point

I am new to Dynamo and I am trying to select line segments (or even nodes) that enclose a specified node to create a new polygon. The problem is the line segments are from different lists and may vary from curve/polyline to a straight line defined by two points. Refer to the attached for clarity (not the best quality, sorry). Thanks in advance.

Dynamobim query

This looks like a very tricky problem. Not sure how you could solve it but maybe i could give you some ideas to start with. I tried to solve the problem with a straight forward solution but it still needs manual input to come up with the final solution.




Hopefully someone has a real solution for you, maybe using some of that brilliant design script code.