You're image is broken, but I think I understand what you're trying to do. I don't think there's a magic-bullet for what you want, but I'd guess you could build it fairly easily using some of Godot's basic
Geometry functions. For instance, these will likely be handy:
segment_intersects_segment_2d - find intersection between 2 line segments
is_point_in_polygon - determine if a point is inside a polygon
Basically, you'll need to see if your "line segments" have any intersections (by iterating through the segments and comparing them via
segment_intersects_segment_2d). If they don't, you're done. If you find an intersection, you'll need to create a collection of points consisting of that intersection point and all of the points "between" the 2 segments found to have the intersection (including the last point of the first intersecting segment and the first point of the second intersecting segment) - in that order.
That list of points could be used to construct a "containing" polygon - which could be used to find objects "inside" using any number of methods (potentially including