Fitting a plane to the flatter part of the tube

I have a mesh of a tubular shape with cross-sections like these.

The cross-sections are flattened on one side.

There is also a centerline curve for the tube.
I would like to set up a local construction plane approximating the flat surface of the tube for a certain stretch of the tube.

The way I was thinking of doing this is by

  1. making cross-sections between the given points on the centerline

  2. looping through all possible chords to maximize the length of the chord and minimize the area it cuts off

  3. fit a plane to points of all the chords selected in (2) for all cross-sections.

Am I on the right track, or is there a simpler way to do this?

I realized that I hadn’t attached the file for the mesh and probably didn’t explain my question clearly enough.
Mesh sample.3dm (878.0 KB)
I am looking for an algorithm to fit a plane based on the local convexity of a mesh. The mesh is very roughly elliptical cylinder-like, one side is flatter, the other convex. The simplest 3D algorithm, I imagine, would be this:

  1. Find the local long axis of the mesh. For each vertex of the mesh construct planes based on the long axis vector, the selected vertex and another vertex (loop through all vertices). For each of the planes obtain the ratio between its intersection area with the mesh and the clipped* volume (*in areas where the plane passes on the outside of the mesh, this measure would also include the volume enclosed between the plane and the mesh rather than only clipped volume). Find the maximum ratio.

But this algorithm would probably be extremely slow. The other option I have considered is this (2D algorithm):

Using the local long axis of the mesh, construct cross-sections. In each cross-section, from each vertex shoot a chord to every other vertex. Maximize the ratio between the length of the chord and the clipped* area (*plus enclosed area for chords passing on the outside of the cross-section). Fit a plane to the collection of chords obtained from the cross-sections.

This way, the number of cross-sections can be varied to make a small subsample of the mesh.

I am sure there is a better way, though. Maybe there are standard algorithms for this?

Couldn’t this be done by simply getting the bounding box of the object in question. The planar surface that you’re looking for could be the lowest bounding box face along the z-axis.
You’d probably have to compute the minimum bounding box though!

You’re right, this could be a first step and then maybe a different algorithm for the refinement, since finding a bounding box is probably faster than doing a million mesh splits.