Sign in to follow this  

Coplanar points

This topic is 2588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
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:).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 2588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this