Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

SimDemon

Plane Normals?

This topic is 6001 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

My question is: How do I calculate a plane''s normal. I found a site on vectors, and I am going to start on collision detection. If thispost = 0 Then GoBack() Else Read() End If

Share this post


Link to post
Share on other sites
Advertisement
Theory:

With 3 points that lies on the plane you can construct 2 vectors, with 2 vectors you just need to do cross product and that''s all.

Practice:

With points a, b, c you build 2 vectors:

vector1 = a - b
vector2 = c - b

normal.x = vector1.y * vector2.z - vector1.z * vector2.y;
normal.y = vector1.z * vector2.x - vector1.x * vector2.z;
normal.z = vector1.x * vector2.y - vector1.y * vector2.x;

and that''s all.

Bye

Share this post


Link to post
Share on other sites
To clarify what Rambo said, by "points" he means "vectors"; to get the normal of a triangle, you''d use the three vertices of the triangle. Technically you could use any 3 points that lie along the plane of the triangle, but of course it''s simplest to use its vertices. Also note that the direction of the normal is relative to the order of the points - if they''re clockwise, the normal will point in the opposite direction than it would if they''re counterclockwise.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!