Jump to content
  • Advertisement
Sign in to follow this  
programering

Plane Equation

This topic is 4423 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 asked this before in this thread when I didn't understand. As I read it now I definitly think I would deserve to be rated down for that. I was pissing you off, but no article explained that well so I could understand it. Now I understod I had to try harder to understand. So I have checked it out at Wikipedia. But I think I got it now. It was said that the parameter B was pointing as the normal right up at the face. But in what directions are the other two parameters pointing then? Then I got the idea that the parameters are koeffient (like ratio) values that tells how much it differs from the world's xyz axis. Therefore my guess is: A * x + B * y + C * z + D = 0 Is the same as: A * x + B * y + C * z = -D x is the x axis delta from the plane's origin to the actual point y is the y axis delta from the plane's origin to the actual point z is the z axis delta from the plane's origin to the actual point A is the value for how the plane's x axis differs from the world's x axis. B is the value for how the plane's y axis differs from the world's y axis. C is the value for how the plane's z axis differs from the world's z axis. D is the length formed by sqrt(x*x + y*y + z*z) So I just need to be confirmed if this is true. Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
A, B and C are essentially a normal to the plane, < A, B, C >. Remember a normal is a vector - a distance, not a position. D is to establish position, and is the distance between the origin and the plane, along the normal vector.

Share this post


Link to post
Share on other sites
Where's the origin and the point to check at the picture fig(3)?
Is the origin where x, y and z meets?
Is the point the black dot in the other end of D?

Is the magnitude of a vector the same as the length?

Is the vectors xyz component the delta (the difference) the displacement between two points.


To get the magnitude, do one write |AB|? where A and B is two points.

Do one get the length by sqrt(x*x + y*y + z*z).


Is it like this then:

A*x + B*x + C*z + D = 0

A,B,C the normal vector direction.
x,y,z the delta between the origin and the point to check.
D the distance between formed by sqrt(x*x + y*y + z*z)

If the point lies in the plane the expression(equation) then will be true, equal zero.

Share this post


Link to post
Share on other sites
Your understanding of x, y, z, and D is not correct.

I normally explain the whole thing the following way, where a bold uppercase letter denotes a point, and a bold lowercase letter denotes a direction vector.

To understand it totally, you first have to know a consequence of the dot product:
a . b = |a| * |b| * cos( < a,b > )
Read this as follows: The dot product of two direction vectors is proportional to the length of each vector and the cosine of the angle between the both vectors. For simplicity, let us assume that a is of unit length, so it could be seen that the dot product will result in the length of the projection of b onto a, or, in other words, the length of b in parallel direction of a (there is also a perpendicular component, but that doesn't play a role here).

Now, let us define a distance formula like this
d := ( P - O ) . n
where P and O denotes two points, and n a direction vector.

With this, a plane equation in Hessian normal form is given by
P := ( P - O ) . n = 0
where O (from "origin", not a zero!) denotes any point on the plane, and n denotes the plane's normal.

What does the definition express? Look at the dot product inside. It says: The projected length of the difference vector of any point P in the space and the origin of the plane must be 0 for P being part of the plane. Any P set into the equation above that result in a distance not equal to zero is distant of the plane and hence not part of the plane.

Next, resolve the brace to yield in
P . n - O . n = 0
and remember that that P is variable but O and n are fixed parameters for a given plane. Hence the right dot product could be computed as a scalar
- O . n =: D
From the definition of the dot product this is the (negated) length of the projected difference vector between the space origin and the plane origin, or, in other words, the distance of the plane from the space origin! (Notice that negative values may occur since the direction of the normal plays a role; so D is not really a distance!) To be precise, the full form would be
- ( O - 0 ) . n =: D
where the subtracted 0 (a bold null) denotes the space origin, so that the point is transformed into a direction vector.

Furthurmore, if selecting the 3D space as the space of interest, the left dot product could be expressed by components as
P . n = Px * nx + Py * ny + Pz * nz

Now choose some other names:
A := nx
B := ny
C := nz
and
x := Px
y := Py
z := Pz
and after substitution you yield in the known formula
A x + B y + C z + D = 0

Hence, A, B, C are just the components of the plane's normal, and D is a distance measure of the plane from the space origin. x, y, and z are the components of any space point that is either part of the plane if they fulfil the equation, or else not.


Quote:
Original post by programering
A,B,C the normal vector direction.
x,y,z the delta between the origin and the point to check.
D the distance between formed by sqrt(x*x + y*y + z*z)

With looking at the explanation above, 1st line is true, 2nd and 3rd are false.

Quote:
Original post by programering
To get the magnitude, do one write |AB|? where A and B is two points.

Yes, but normally (at least in Germany) a horizontal bar has to be written over it (unfortunately I don't know how to make them in HTML). The two vertical bars denote the "absolute value" or "lenght" or "magnitude" (it is a notion of the so-called 2-norm). If A and B denote two points, then AB denote the difference vector from A to B, computed as
AB = B - A


EDIT: As Taralieth has pointed out absolute correctly, the dot product shows the cosine (not the sine) between the both vectors. Already corrected above. Thx.

[Edited by - haegarr on April 6, 2006 7:14:28 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by haegarr
Your understanding of x, y, z, and D is not correct.

I normally explain the whole thing the following way, where a bold uppercase letter denotes a point, and a bold lowercase letter denotes a direction vector.

To understand it totally, you first have to know a consequence of the dot product:
a . b = |a| * |b| * sin( < a,b > )
Read this as follows: The dot product of two direction vectors is proportional to the length of each vector and the sine of the angle between the both vectors. For simplicity, let us assume that a is of unit length, so it could be seen that the dot product will result in the length of the projection of b onto a, or, in other words, the length of b in parallel direction of a (there is also a perpendicular component, but that doesn't play a role here).

...


Small correction to Haegarr. The dot product is actually the length of each vector times cosine of the angle in between both vectors. Otherwise I agree with what Haegarr wrote.

Quote:
Original post by haegarr
With this, a plane equation in Hessian normal form is given by
P := ( P - O ) . n = 0
where O (from "origin", not a zero!) denotes any point on the plane, and n denotes the plane's normal.

What does the definition express? Look at the dot product inside. It says: The projected length of the difference vector of any point P in the space and the origin of the plane must be 0 for P being part of the plane. Any P set into the equation above that result in a distance not equal to zero is distant of the plane and hence not part of the plane.


Another way you can think about it is that if P is a point along the plane, then P - O gives you a vector along the plane since both P and O is on the plane. That means that the vector P - O must be perpendicular to the normal of the plane which means the dot product of them must be 0 (i.e. |P|*|O|*cos90 = 0)

Share this post


Link to post
Share on other sites
programering

I wrote a Word document which explains planes in depth.

I would've posted it here in this thread, but it's a bit tricky trying to post a few pages of screen shots.

If you'd like to view it, send me a private message and I could email you the doc.

Share this post


Link to post
Share on other sites
I have googled for plane equation
to see if I could find articles about it that
explain it well so I would get to understand it better.
Google Search: "plane equation"
And I choosed the article "Polygons and the Plane Equation" in the list,
and that explained well and got me to understand that right now.


The triangle with the vertices A, B and C.

1. First you get the normal of a surface by the
cross product of the two vectors U and V between the
vertices A-B and A-C pointing out from any
vertex in the triangle, in this case the vertex A.
That's A, B and C are the normal vector x, y and z components.
The normal have no position in space, it just specifies the direction.

2. Second you normalize the normal vector to give it a length
of 1 by dividing every A, B and C component by 1.

3. Third you get the D component from the dot product of the
normal and any vertex point of the triangle.


A*x + B*y + C*z + D = 0


A, B and C are the normal vector's x, y and z components.

D is the value of the dot product of the normal and any
vertex point in the triangle (must it be the same vertex
that was the center of the two vectors of between the
vertices A-B and A-C, in this case A?).

x, y and z are the point to check if it is in the plane
(Is it the delta from the center vertex A?).

If (A*x + B*y + C*z + D) > 0 Then the point is above the plane
If (A*x + B*y + C*z + D) = 0 Then the point is in the plane (coplanar)
If (A*x + B*y + C*z + D) < 0 Then the point is below the plane


Is it right now then?

Share this post


Link to post
Share on other sites
Quote:
Original post by programering
1. First you get the normal of a surface by the
cross product of the two vectors U and V between the
vertices A-B and A-C pointing out from any
vertex in the triangle, in this case the vertex A.

Yes. The principles behind this are: A cross product of two non-colinear (!) and not zero length (!) vectors is a vector perpendicular to both of its input vectors. For the normal of a surface you have to pick the point of which you need to know the normal, compute 2 tangential vectors and the cross product from them. In your case the surface is planar, so that any 2 non-colinear vectors inside the surface are good as tangential vectors, and the normal will furthurmore be the same at all points on the surface.

Quote:
Original post by programering
That's A, B and C are the normal vector x, y and z components.

Yes. (However, notice that A, B, and C are used as positions in space in the image, so it is a little bit confusing here to use the same variable names (you may consider to use the bold kind of writing for vectors in the future)).

Quote:
Original post by programering
The normal have no position in space, it just specifies the direction.

Correct. A normal is a direction vector, and direction vectors have no position. This difference to position vectors (or "points") is important for transformations. That is why I differ also in writing a upper case letter A for a position vector and a lower case u for direction vectors.

Quote:
Original post by programering
2. Second you normalize the normal vector to give it a length
of 1 by dividing every A, B and C component by 1.

Err, no. "Normalization" is the operation to make a vector unit length, that's right. To do so, you compute its length and divide each component by this length:
n' := n / |n| = [ x/|n| y/|n| z/|n| ]
where
|n| := sqrt( x*x + y*y + z*z )
in 3D space.

Notice please that A,B,C are points in space. Points could not sensefully be normalized.

Notice furthur that it isn't sufficient to normalize u and v, since the normal is computed as the cross product of u and v, and there is a sine in-between:
|u x v| := |u| * |v| * |sin( <u,v>)|
So, until you guarantee that the angle between u and v isn't +/-90° (so that the sine becomes +/-1) you have to normalize _after_ the cross product.

You could furthur see from the sine why the both vectors must not be co-linear, or else the angle between will be 0° or 180°, and its sine will be 0 making the cross product disappear.

Quote:
Original post by programering
3. Third you get the D component from the dot product of the
normal and any vertex point of the triangle.

Closely. First, notice the negation, since the D is the negative dot-product of the normal and any point on the surface. Second, (as already mentioned) you could use _any_ point of the surface, so of course also one of the vertices. The dot-product does a projection, so it plays no role what point you use as long as it is on the surface.


Quote:
Original post by programering
A*x + B*y + C*z + D = 0

A, B and C are the normal vector's x, y and z components.

Yes. That fact comes from the definition of the dot-product.

Quote:
Original post by programering
D is the value of the dot product of the normal and any
vertex point in the triangle (must it be the same vertex
that was the center of the two vectors of between the
vertices A-B and A-C, in this case A?).

See above. Absolutely any point on the (planar) surface could be used.

Quote:
Original post by programering
x, y and z are the point to check if it is in the plane
(Is it the delta from the center vertex A?).

It is any point in space.

Quote:
Original post by programering
If (A*x + B*y + C*z + D) > 0 Then the point is above the plane
If (A*x + B*y + C*z + D) = 0 Then the point is in the plane (coplanar)
If (A*x + B*y + C*z + D) < 0 Then the point is below the plane

Yes, but this needs one more definition: Here "above" means "in direction of the normal", and "below" means "against the direction of the normal". If you negate the normal (what will denote the same surface) the meaning of "above" and "below" will just exchange.

Furthurmore I'm not sure about the term "coplanar" w.r.t. points. I think only planes could be co-planar.


Good job :) I think you mostly has understood the topic now.

Share this post


Link to post
Share on other sites
Quote:
Original post by haegarr
Good job :) I think you mostly has understood the topic now.


Not quite, there's still things to clear out.

It is of very great value I get to understand this.
Cos I want to understand this.



Quote:
Original post by haegarr
Quote:
Original post by programering
1. First you get the normal of a surface by the
cross product of the two vectors U and V between the
vertices A-B and A-C pointing out from any
vertex in the triangle, in this case the vertex A.

Yes. The principles behind this are: A cross product of two non-colinear (!) and not zero length (!) vectors is a vector perpendicular to both of its input vectors. For the normal of a surface you have to pick the point of which you need to know the normal, compute 2 tangential vectors and the cross product from them. In your case the surface is planar, so that any 2 non-colinear vectors inside the surface are good as tangential vectors, and the normal will furthurmore be the same at all points on the surface.


What's colinear?
What does "co" stand for?
What's tangential? Is it touching?
What does the "surface is planar" mean?


Quote:
Original post by haegarr
Quote:
Original post by programering
That's A, B and C are the normal vector x, y and z components.

Yes. (However, notice that A, B, and C are used as positions in space in the image,
so it is a little bit confusing here to use the same variable names (you may consider to use the bold kind of writing for vectors in the future)).


Do you mean the triangle's vertices A, B and C?

Quote:
Original post by haegarr
Quote:
Original post by programering
The normal have no position in space, it just specifies the direction.

Correct. A normal is a direction vector, and direction vectors have no position. This difference to position vectors (or "points") is important for transformations. That is why I differ also in writing a upper case letter A for a position vector and a lower case u for direction vectors.

So both the (A, B and C) and (x, y and z) vectors are the normal.
A, B and C are the position vector in uppercace.
x, y and z are the direction vector in lowercase.

Quote:
Original post by haegarr
Quote:
Original post by programering
2. Second you normalize the normal vector to give it a length
of 1 by dividing every A, B and C component by 1.

Err, no. "Normalization" is the operation to make a vector unit length, that's right. To do so, you compute its length and divide each component by this length:
n' := n / |n| = [ x/|n| y/|n| z/|n| ]
where
|n| := sqrt( x*x + y*y + z*z )
in 3D space.


void Normalize(Vector *vect)
{// shall it be integers or real numbers as float and double?
int length = GetLength(vect);
vect->x /= length;
vect->y /= length;
vect->z /= length;
}

int GetLength(Vector *v)
{// shall it be integers or real numbers as float and double?
return sqrt(v->x*v->x + v->y*v->y + v->z*v->z);
}





Quote:
Original post by haegarr
Notice please that A,B,C are points in space. Points could not sensefully be normalized.

So it is the normal's direction vector by the components x, y and z which get normalized.


Quote:
Original post by haegarr
Notice furthur that it isn't sufficient to normalize u and v, since the normal is computed as the cross product of u and v, and there is a sine in-between:
|u x v| := |u| * |v| * |sin( <u,v>)|
So, until you guarantee that the angle between u and v isn't +/-90° (so that the sine becomes +/-1) you have to normalize _after_ the cross product.

The length of the vector from the cross product of u and v shall equal the length of u and v * eachother * sin(the angle between u and v)


Quote:
Original post by haegarr
Quote:
Original post by programering
x, y and z are the point to check if it is in the plane
(Is it the delta from the center vertex A?).

It is any point in space.

Is it the point in space to be checked if it is in the plane?

Quote:
Original post by haegarr
Quote:
Original post by programering
If (A*x + B*y + C*z + D) > 0 Then the point is above the plane
If (A*x + B*y + C*z + D) = 0 Then the point is in the plane (coplanar)
If (A*x + B*y + C*z + D) < 0 Then the point is below the plane

Yes, but this needs one more definition: Here "above" means "in direction of the normal", and "below" means "against the direction of the normal". If you negate the normal (what will denote the same surface) the meaning of "above" and "below" will just exchange.


Quote:
Original post by haegarr
Furthurmore I'm not sure about the term "coplanar" w.r.t. points. I think only planes could be co-planar.

What does "v.r.t. points" means?


Thanks for helping me out.
It's a bit hard for me to understand, but I do my best.
And I have bad read understanding.
I would have rated you, but it won't have any effect
since I have much lower than you, otherwise I would.


When I finally get to understand things, I will write articles which explains it very well so people like me can understand.
But I seem to be the only one who don´t understand things here.

Share this post


Link to post
Share on other sites
Ok; I'll add my few cents below with some additions. I've tried to avoid specific mathematical definitions as you can find them -- a more natural-language oriented approach seemed more appropriate.

Quote:
What's colinear?

It means the vectors directions are the same, regardless of their length. So for example, two vectors (0,1,0) and (0,100,0) are colinear. That is not the whole story: (0,1,0) and (0,-1,0) are also colinear as their directions are on the same line, and you might abusingly think of the one as the other with negative length.

Quote:
What does "co" stand for?

It's a prefix to indicate the term colinear relates two a pair of vectors rather than a single one. Think in general of co-pilot, co-driver, co-operate, etc.

Quote:
What's tangential? Is it touching?

Yes it's touching. If you have a parabola then the tangent on the top will be horizontal, for example.

In this case, the explanation tries to tell the following. Normally, for an arbitrary curved surface, to compute the normal vector you would require two vectors that are tangents of the surface i.e. touching it's curvature. The tangents are orthogonal to each other as well as to the normal.

In this case, since the surface is planar, it is not required that the two vectors for computing the normal are orthogonal to each other; any two actually different (non-colinear) vectors in the plane will do.

Quote:
What does the "surface is planar" mean?

It means the surface is not curved, but flat. If you would have an infinitely flat plane, you could position such that it fits together with any planar surface. You cannot do this with non-planar surfaces, as the curvature will at some point move away from your infinite plane.

Actually a flat plane is a tautology: planes are always flat whereas surfaces can be curved.

Quote:
Shall it be integers or real numbers as float and double?

In general these computations are done using floating-point numbers, so stick to those for now.

Quote:
What does "w.r.t. points" means?

It means "with respect to points" i.e. how the term coplanar should be interpreted in the context of points.

FYI: coplanar points are points lying in the same plane. So any two points will be coplanar, as will be any three points but not any four points (in R^3, naturally).

Greetz,

Illco

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!