OK, this proved to be a tricky one. At least for me.
I have this bad mesh (and many others which are worse yet) and I want to automate finding the lowest path or depression along the bottom of the concave upper surface (se blue line), starting with only the mesh and the plane, as they are found in the attached file.
“Lowest” is here defined by the inclination of the nearby plane (never mind how I arrive at that plane) and not by the normal of the WorldXY Plane. Given is that the plane’s Y-axis is pointing upwards, and I want to find the blue line:
Viewed from the other direction (Edit: Hm, strange, the picture disappears…adding a new one):
Again, the plane’s Y-axis determines what is up and what is “downward” (down = anti-parallel to the Y-axis). And in this direction I want to find the bottom-most mesh vertices in the “valley” of the upper surface. The bottom-most vertice could form a polyline by following the mesh edges, but it can also be mesh vertices on both sides of such a polyline (the mesh can be pretty bad, so it’s ok to just collect whatever points on the surface which are not located in a hole or the alike.).
There can be several problems with the mesh, like holes, and trashy “splinters” inside the mesh, and some of this trash is not connected to the surface, while some of the crap is connected to the outer mesh surface. In any case, this trash cannot be removed by Disjoint etc, because it may destroy parts of the mesh where this “trash” still serves as a kind of “surface boundary” on really bad meshes.
The plane in this example is deliberately placed a bit off the deepest path, simply because it will never be exactly where the bottom line will end up anyway. The plane will only provide with an inclination vector (its Y-axis) and will never provide with any location hint regarding the geometry. This inclination vector will not detemine the “slope” of the blue line, only the "deepest depression along the “valley”.
In the second picture I have drawn the blue line zigzaging a little bit, which would represent how a polylinje would follow the edges of the deepest depression, but what I am after is a straight line, which if you had dropped a pen or a pipe in the depression, and it would then have rolled down and found a resting position at the “bottom” of the valley. This means for example that the nearest part of the blue line (say, the nearest 1/4:th of the blue line) should not influence where the “bottom line” should find its resting position.
In this particular case the line would probably end up in a position something like in the following picture. One could think of including vertices to a depth of e “pipe radius” so as to get more points indicating “bottom-most”:
The final line would be a Fit Line based on the bottom-most mesh vertices found. For some reason this particular case seems being trickier than I first thought, but if any of you guys already have solved something like this I’d be happy to learn your trick. Hint: Deformities and holes in the mesh can cause serious trouble.