How to find if 3 non-collinear points exist in set of N 3D points?

409 Views Asked by At

This question asked about test the collinearity of 3 points in 3D space, and the answer suggested a cross product of the pair of vectors connecting them. I am basically wondering how can one extend this solution to a set of N points?

The naive solution is to test points pairwise. However, computationally this seems slow. I feel like there must be a way to do this leveraging linear (in)dependence in an Nx3 matrix composed of the points. I also think there may be a solution using a covariance matrix of the data. However, I am stumped.

Ideally, I don't just want to test for collinearity, but rather find a metric that defines how close to collinear the points are (sort of an extension to this question). My purpose is to find if there exists 3 non-collinear points in a set of N 3D points. Is there an algorithm that can do this?

If it helps, my use case is that I am determining a 3D affine transformation between point sets, and to recover the rotation I need my data to span the entire 3D space. I would like to test the points first before undertaking the transformation estimation.

1

There are 1 best solutions below

1
On

Pick two distinct points $a_1,a_2$ (for numerical stability, prefer them far apart). Find two vectors $v,w$ orthogonal to $a_2-a_1$ (e.g., let $v$ be the longest of $e_i\times(a_2-a_1)$ where the $e_i$ are the standard basis, and then let $w=v\times (a_2-a_1)$) and compute $c_1=v\cdot a_1$, $c_2=w\cdot a_1$. then loop over all other points and check if $v\cdot a_i=c_1$ and $e\cdot a_i=c_2$ (or $\approx$ with suitably chosen error allowances)