Jump to content
  • Advertisement
Sign in to follow this  
eXt_

Planes (Noob question)

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

A plane is defined as ax + by + cz + d = 0, where abc is the normal and d is the distance from origo, right? Is the normal pointing to or from origo? More exactly, my problem is that I have a point which I consider belonging in the plane but when I calculate the distance it becomes d * 2. Take the plane π: (0,1,0,6) and the point P: (0,6,0) I think this point should belong in the plane, but when calculating ax + by + cz + d the result is 12 and not 0 as it should. I've tried reading a book on the subject but it doesn't explain such "simple" things.

Share this post


Link to post
Share on other sites
Advertisement
I think your problem is your "concept" of what d is.

From the values you gave..
Quote:
Take the plane π: (0,1,0,6) and the point P: (0,6,0)

The distance of P from the plane is 12.

It looks like you think the plane you quoted (0,1,0,6) is y = 6
so (0,6,0) would lie on it...

But it's not..

ax + by + cz + d = 0
0x + 1y + 0z + 6 = 0
y + 6 = 0
y = -6

So the point (0,-6,0) would be on the plane.
The point (0,6,0) is 12 from the plane.

Does that clear things up??

Share this post


Link to post
Share on other sites
Yes, I think I understand now, and I've misunderstood what d was. I've changed the way I'm calculating (mostly mental) and I get correct results now.

I'm still trying to learn linear algebra but it's not going to well. Thanks for explaining this thought!

Share this post


Link to post
Share on other sites
I'll also add that d might not be an absolute distance, either. If the normal, <a,b,c> is not length = 1, then d will have to be scaled accordingly to represent the same plane.

Share this post


Link to post
Share on other sites
Are you using the ax + ay + az + d = 0 representation of planes in code, or are you only concerned with the math of that representation. If you are using this for a program then I might add in a little of what I have experienced.

I have found in all math courses planes are represented by the form talked about above. However, I have found it easier to represent planes in code as an origin point and a normal. The origin can be any point on the plane, and the normal is just a unit vector which is tangent to the plane surface. The vector points technically into the positive space of the plane and can be used for neat stuff.

Below is generally how I represent it.

class gtVector
{
public:
float x;
float y;
float z;
};

class gtPlane
{
public:
gtVector origin;
gtVector normal;
}

With this representation you can find distance of a point to the plane with the code below.

float gtVectorToPlaneDistance(const gtVector& point, const gtPlane& plane)
{
return gtDot(plane.normal, plane.origin - point);
}

Where
gtDot = A dot product function between two vectors

- Kiro

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.

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!