# how to tell if 5 points lie on the same plane?

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

## Recommended Posts

OK so i'm trying to make a dodecahedron. i have the vertices's for them but i don't know how to make out of triangles correctly. i figured that if i could find 12 sets of coplanar points that those planes would would be my pentagons and i could then either divi each pentagon up into three triangles or just use the pentagon deal instead of three triangles. but the problem remains, one is my thinking correct, and two (if i am right) how do i do it.

##### Share on other sites
I'm not sure if your thinking is correct but to be able to tell if 5 points lie on the same plane isn't too difficult luckily!

Take any 3 of your 5 points, lets call them points A,B and C.

Next, make 2 vectors... one from A to B and one from A to C, let's call these AB and AC.

Next up, take the cross product of the vectors AB and AC to get a third vector that is perpendicular to those 2 vectors. This is the normal of the plane formed by these 3 points.

Store this normal.

Next up, take one of the origional points, and the other 2 points that so far haven't been used and lets call these points A, B and C again.

Get vectors AB and AC from these new points and do a cross product again.

If the result of that cross product is the same as the first time around, all 5 points are on the same plane.

CAVEATS!

ok, so thats the simplified explanation but there's 2 issues you need to worry about.

#1 - due to floating point imprecision, instead of checking if the 2 normals are equal, you should check if they are CLOSE to equal within some level of tolerance (up to you to decide how much)

#2 - you dont know what order the points are in spatially, so the normal you calculate with the cross product may be pointing the wrong direction. So, instead of just checking if the 2 normals match, also check if they are oppositely pointed from eachother. If they are, that should also be considered a match.

HTH!

##### Share on other sites
wow thanks, im about 90% pleased but two things (srry most of the math involved in this has not been thought to me i thought it to my self)one, when you say vector you mean like same thing as spherical coordinate's, example: (r,theta,that wired little squiggly) or do you mean something else i have not learned and two explain what you mean by cross product (it sounds simple enough but i don't know exactly what you mean)

##### Share on other sites
By vector i just mean this...

To get a vector from point A to point B, just subtract point A from point B.

That will give you a set of X,Y,Z values, and that is your vector.

As far as cross product, here's an explanation:

http://www.gamedev.net/reference/articles/article1089.asp

and for more help on vector math (you should learn it... dot product, cross product, vector projection and matrix math are the basic math syou should know for game programming), check out this page:

http://chortle.ccsu.edu/VectorLessons/vectorIndex.html

##### Share on other sites
super thanks!!!! i hope it works (other wise i will be back shortly lol)

##### Share on other sites
Hey follow up question for you!

How are you getting the points, are you calculating them or what?

##### Share on other sites

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

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628644
• Total Posts
2984007

• 9
• 9
• 10
• 21
• 20