# Longest line inside of 3D object

I have a 3D object which I have segmented and represented as a 3D binary array. I need to find the longest line which fits inside of the object in three dimensional space. What would be an efficient method I could use to approach this problem.

The following is an example of what I am trying to do but in 2 dimensions. The black part of the image is the background and the white is a segmented object. The red line is the longest line which can be drawn inside the object. I would like to find the length of this line.

I could do this by calculating the distance between each pair of two points on the surface of the object and taking the longest distance as my result, but this seems horribly inefficient particularity when solving the problem in 3 dimensions.

Is there a better way to solve this problem.

Thanks

• Welcome to DSP SE. We always appreciate more details as it is increasing your chances for getting better answer.
– jojeck
Jun 19, 2014 at 18:51
• Interesting problem! Did this paper help?
– Emre
Jun 19, 2014 at 21:03
• I don't think that paper addresses the question I am trying to solve. I am adding an image that I think will help explain what I am trying to do. Jun 19, 2014 at 21:36
• What if you found the diameter of the convex relaxation? Or do you need to exclude lines that would protrude from the hull?
– Emre
Jun 19, 2014 at 22:34
• Do you want to find the distance or like to have access to the line itself? Mar 31, 2019 at 11:38