How to quantify how well 3D data can be fitted with a 2D triangle?

62 Views Asked by At

I have data points (their number between 100 and 1000) in 3D, which possibly come from the area of a triangle with some additional noise (so they would not perfectly be on and inside the triangle but very clearly have a relationship). I would like to quantify how well the points would be fitted by the triangle - ideally a single number similar to how correlation quantifies the relationship between two variables. I don't really need any info of the triangle itself. The pairwise correlations of the variables are not fairly low since the triangle gets projected as another triangle to all three dimensions.
Is there any way to quantify this relationship to distinguish between points that do or do not come from a triangle? By 'form a triangle' I mean that there is a triangle for which 1) the summed squared distance of points from the triangle is minimum and 2) the distance of the edges of the triangle from the points is also minimised. I will have to check over millions of variable triplets, so the simpler the better, though I have access to HPC.

I thought of first quantifying how co-planar the points are, and then applying some additional check-up on the points projected to the identified plane. Or doing a multivariate linear regression with all three variables as targets (in turns) to see how much information I can retain by their combinations. I do not know though what would be the most efficient and bulletproof way to go about it.

The points in the triangle below are here: https://gist.github.com/elakatos/1e7a5a28e8602a53fd7ea5afd4379d9e

Update: the data shown in the figure below was generated by me (with preset relationships to ensure the triangle; but I assume my data would look similar in some cases and I want to identify these cases by some decision making process. Points from a triangle in 3D

1

There are 1 best solutions below

1
On

I haven't tested any of this but try this:

  • Fit a plane to the points using least squares

  • Project the points onto the coordinate plane corresponding to the smallest coordinate in absolute value in the normalized normal vector to the fitted plane

  • Compute the convex hull of the projected points

The original points fit well into a triangle iff the convex hull has three large sides and the others are small relative to them.