I need some help with writing the this algorithm.

Given a set of lines are in space and I am trying to find the accessible volume when the origin (reference point) is 0.5,0.5,0.5 and I do the following:

For each line, calculate the distance and the point on the line which is the closest to the origin ( 0.5,0.5,0.5 ) then gather all this points.

After that I would like to calculate the interior (neither the boundary nor the convhull ) because I want to evaluate the accessible volume for the ball at ( 0.5,0.5,0.5 ). It's not quite the convex hull or the boundary polygon.

For example I want to get the green (internal line) in this simple example:

The configuration:

The closest points from the origin ( 0.5,0.5,0.5 ) to the lines

Only the points for which I want the "internal boundary" which mean the shape that bounds all the point either outside of the interior or on its boundary.

Here is the code for which I want something else rather than convhull :