Coplanar points

Started by
6 comments, last by kaarigar 13 years, 5 months ago
I have a series of 3d points in space that define a co-planar polygon. How can I check that the points are co-planar? One way is the define a plane using three of them, and then measuring distance between the plane and the remaining points. Is there any other efficient way of doing it? Thanks!
Advertisement
Solving the Plane equation ax+by+cz = d is the only method I know of
Quote:Original post by kaarigar
I have a series of 3d points in space that define a co-planar polygon. How can I check that the points are co-planar? One way is the define a plane using three of them, and then measuring distance between the plane and the remaining points. Is there any other efficient way of doing it? Thanks!


This clearly takes only O(n) time, which must also be a lower bound, since every point needs to be involved. Three multiplications, two additions and one compare seems very little work for a single step, so I think this method should be pretty close to optimal:).
You can check if four points are coplanar by making a 4x4 matrix where the rows are your points extended with a 1 as a fourth coordinate. The points are coplanar if and only if the determinant of that matrix is 0.
If you compute the singular values of the 3xN matrix of points, then the third component will be zero (or close to it) for a coplanar set of points.

Demonstrating this with python:

>>> import random, scipy.linalg>>> p = [ (random.gauss(0,1),random.gauss(0,1), random.gauss(0,.1))  for i in xrange(100) ]>>> scipy.linalg.svdvals(p)[2]0.8806>>> p = [ (random.gauss(0,1),random.gauss(0,1), random.gauss(0,0))  for i in xrange(100) ]>>> scipy.linalg.svdvals(p)[2]0.0


The second and third components will be close to zero for a colinear set of points.

Quote:Original post by tobiasjs
If you compute the singular values of the 3xN matrix of points, then the third component will be zero (or close to it) for a coplanar set of points.

Demonstrating this with python:

>>> import random, scipy.linalg>>> p = [ (random.gauss(0,1),random.gauss(0,1), random.gauss(0,.1))  for i in xrange(100) ]>>> scipy.linalg.svdvals(p)[2]0.8806>>> p = [ (random.gauss(0,1),random.gauss(0,1), random.gauss(0,0))  for i in xrange(100) ]>>> scipy.linalg.svdvals(p)[2]0.0


The second and third components will be close to zero for a colinear set of points.


I believe that only works for planes that pass through the origin. In general you need to add a fourth column of ones. Then you can do the same trick, but checking the fourth component of the singular values.

Quote:Original post by alvaro

I believe that only works for planes that pass through the origin. In general you need to add a fourth column of ones. Then you can do the same trick, but checking the fourth component of the singular values.


You're completely right. Apologies, and thanks for the correction. The other alternative would be to subtract the centroid of the points, which is possibly quicker (given the SVD is slow) and likely more numerically robust.
Thank you, guys. I have enough knowledge from you to go about it now. Thanks!

This topic is closed to new replies.

Advertisement