Jump to content
• Advertisement

#### Archived

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

# plane and normal equations

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

Ok can someone confirm the following to make sure I understand it. I have a triangle, with three vectors V1, V2, V3 each with [x,y,z] to get the normal, I first calculate [V1-V2] * [V2-V3] then get the length of the normal = A * B = (AyBz - ByAz)(BxAz - AxBz)(AxBy - BxAy) = (x) (y) (z) now we get the sqrt root of the length = sqrt((x*x) + (y*y) + (z*z)); then we divide each coordinate of our length (x,y,z) by the sqr root of the length.... = (x/sqrt) (y/sqrt) (z/sqrt) NOW we have the normal ...... thats part 1 PART 2 (oooo evil drumroll into a frenetic blast beat thanks to TRYM) we have three points in space and the evil plane equation The standard equation of a plane in 3 space is Ax + By + Cz + D = 0 The normal to the plane is the vector (A,B,C). using the three vertices - A = y1 (z2 - z3) + y2 (z3 - z1) + y3 (z1 - z2) B = z1 (x2 - x3) + z2 (x3 - x1) + z3 (x1 - x2) C = x1 (y2 - y3) + x2 (y3 - y1) + x3 (y1 - y2) - D = x1 (y2 z3 - y3 z2) + x2 (y3 z1 - y1 z3) + x3 (y1 z2 - y2 z1) The sign of s = Ax + By + Cz + D determines which side of some random point (the x,y,z) lies with respect to the plane. If s > 0 then the point lies on the same side as the normal (A,B,C). If s < 0 then it lies on the opposite side, if s = 0 then the point (x,y,z) lies on the plane. Is this correct ?? the plane equation is A(random point.x)+B(random point.y)+C(random point.z)+D = 0 CHEERS Im just a beginner!!! http://www.actsofgord.com

#### Share this post

##### Share on other sites
Advertisement
Looks like you''ve nailed them all correctly. Here is a tip for simpler notation for part 2: Instead of storing A,B,C,D, store two vectors. A, a point on the plane, and n, the normal (of unit length).

Then, the signed distance (s in your post) of an arbitrary point B to this plane is (A-B) dot n. If you give the vectors appropriate coordinates and plug them in to this equation, you can verify it.

#### Share this post

##### Share on other sites
quote:
Original post by fatherjohn666

A = y1 (z2 - z3) + y2 (z3 - z1) + y3 (z1 - z2)
B = z1 (x2 - x3) + z2 (x3 - x1) + z3 (x1 - x2)
C = x1 (y2 - y3) + x2 (y3 - y1) + x3 (y1 - y2)
- D = x1 (y2 z3 - y3 z2) + x2 (y3 z1 - y1 z3) + x3 (y1 z2 - y2 z1)

this is the only part that i didn''t understood. Exept this, what i suppose to be correct (if you''ve calculated it right), all is correct.
But please, don''t nail down everything to the ground but stay with a little higher math level. Proceed like a waterfall, make functions for vector multiplication and don''t brake everything in pieces.

All your stuff can be resumed to:
normal = A x B
normal(a b c) => plane: ax + by + cz = -d
where -d can be found by replacing x,y,z by the coordinates of one of the triangle''s point.
Like this, there is no confusions, all stays simple & easy. ;-)

cheers

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
Rutin
13
4. 4
5. 5
• Advertisement

• 26
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633694
• Total Posts
3013373
×

## Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!