Jump to content
• ### What is your GameDev Story?

• Advertisement

# Find the normal of a plane, given D and x,y and z[SOLVED]

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

Hi, i'm confused about finding the normal of a plane, which formed by a point(x, y, z) and the distance between the origin and that plane. By the equation, Ax + By + Cz + D = 0, we can find out the distance(D), but how can we compute the normal's components(A, B and C)? i've searched a post and found the solution: 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 ( y2z3 - y3z2 ) - x2 ( y3z1 - y1z3 ) - x3 ( y1z2 - y2z1 ) What do those x1, x2, x3, y1,... represent respectively?? i can't make sense with these equations. Please explain further if possible. Helps will be appreciated =) [Edited by - TimChan on July 17, 2005 1:24:11 PM]

#### Share this post

##### Share on other sites
Advertisement
I'm not sure if the following will lead to the above equations. First we must know what the cross product of two vectors means geometrically. If we compute the cross product of a vector V1 and V2, and V1 and V2 are orthogonal to each other, the result vector V3 = V1 x V2 will be orthogonal to both. If we apply this to a plane case, we know that for any two vectors V1 and V2 that are in the plane, their cross product will yield the plane normal.

Two arbitrary vectors in the plane can be formed by subtracting two vertices from each other. Hence, if we have three vertices in a plane, say P1=(x1,y1,z1), P2=(x2,y2,z2) and P2=(x3,y3,z3) we can compute the plane normal as follows.

V1 = (P2 - P1);V2 = (P3 - P2);V3 = V1 X V2

If you write this out you will get the formula for V3, which is the plane normal. The equations above (OP) show the substitution of such points P1, P2 and P3 into the plane equation. Hope it helps. Greetz,

Illco

#### Share this post

##### Share on other sites
thanks in advance...

anyway, is the following code correct?
class plane....plane(float x, float y, float z, float distance) {m_vNormal = vector3(x, y, z);m_vNormal.Normalize();m_fDistance = distance;}

#### Share this post

##### Share on other sites
Quote:
 Original post by TimChananyway, is the following code correct?class plane....plane(float x, float y, float z, float distance) {m_vNormal = vector3(x, y, z);m_vNormal.Normalize();m_fDistance = distance;}

That depends on what you mean by it. If it means that the plane is initialized to having a normal (x,y,z) then it is correct but it doesn't give you a plane equation; it just stores the supplied normal and distance.

#### Share this post

##### Share on other sites
Quote:
 Original post by TimChanHi, i'm confused about finding the normal of a plane, which formed by a point(x, y, z) and the distance between the origin and that plane.

If plane have equation
x*p.x+y*p.y+z*p.z + D=0
where p.x, p.y, p.z, D is constants defining the plane, then normal of plane is p.x, p.y, p.z (and it have other normal -p.x, -p.y, -p.z , of course)

(if you need unit-length normal, normalize it. Chances are, it is already normalized)

It's hard to understand what precisely you want, though.

#### Share this post

##### Share on other sites
ok, i know what should i do now. so thanks for ur helps.

#### Share this post

##### Share on other sites
If I understand correctly, you want to find a plane given a point on the plane and the distance from the origin to the plane.

You can't. There are an infinite number of solutions.

On the other hand, the equations you posted look like they are finding a plane from three points, not a point and a distance.

#### Share this post

##### Share on other sites
I thought that this "plane defined by point and distance from plane to origin" is just poorly worded
x*p.x+y*p.y+z*p.z + d = 0
where p is "point" (actually it is _normal_) and d is "distance".

Indeed, plane can not be specified by point on plane (arbitrarely placed) and distance from plane to origin alone.

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement
• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• ### Popular Now

• 15
• 9
• 11
• 9
• 9
• Advertisement
• ### Forum Statistics

• Total Topics
634135
• Total Posts
3015753
×

## 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!