Hello @LPUoO ,

what you want to do looks to me very similar to a principal component analysis, in which you reduce the dimensionnality of a set of points while preserving its variability as much as possible. In doing so, all the points are taken into account in the calculation. The minimal bounding box, on the other hand, is based on the extremal points of your shape. So, if youâ€™re not lucky, the minimal bounding box may not provide the axis with the highest amount of information - although Iâ€™m pretty sure it works well with regular/smooth tube-like structures.

If I were you, I would use the parameters of the 3D equivalent ellipsoid provided by the 3D roi suite of @ThomasBoudier. I donâ€™t know the details of the computation, but the results should be close to those of a PCA, with the first two axes defining the plane maximizing the variability of your points. Then you can rotate your shape according to the axes angles and project it along the Z axis, or project the points directly on the plane (though Iâ€™m not saying itâ€™s straightforward to program).

If you want to stick to the bounding box solution, though, you can find convenient to replace it with the Feret diameter, which gives you the longest line segment between two points at the border of your shape.

Good luck!

Nicolas