Longest line inside of 3D object
These are very computationally expensive problems and it also depends if your polygons are convex. Also in your case you don't have any extra constraints and it can be any line within. I think that the best read for you is the following publication:


  Hall-Holt O., et al. - Finding large sticks and potatoes in polygons


You will definitely find few algorithms among ones they described (computational complexities are given). Here is some brief presentation concerning their work: click