# 'd' of plane - rotation?

This topic is 4984 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I've noticed planes are quite a big thingy in games. Unfortunately my math classes didn't cover them... I should have followed them on a higher level... I know the equation for a plane is ax + by + cz + d = 0. I know that a,b,c represents a normal of the plane. But what is this d? The docs say it's the distance from the plane to the origin, but how should I compute it? I can't use the normal for that, can I? [Edited by - Kalasjniekof on May 30, 2005 3:29:40 PM]

##### Share on other sites
Hi,
if you chose d=0 your plane will go through the origin of your coordinate system. If you increase/decrease d you basically translate the plane along its normal vector. E.g.if the plane's normal vector points along the y axis changing d will move your plane up and down.
hope that helps
Quak

##### Share on other sites
Quote:
 The docs say it's the distance from the plane to the origin, but how should I compute it? I can't use the normal for that, can I?
Yes you can, but you need some other information as well. If you just happen to know what distance you want, you can just set d manually. More often though you have a plane normal and a point known to be on the plane, and you want to find d given that information. The solution (for your form of the equation) is d = -(point.Dot(normal)).

Sometimes you will see the plane represented as p.n = d rather than p.n-d = 0. It's pretty much the same thing, but the d values are negatives of each other.

Basically the idea is that the plane is all points p for which the equation p.n = d is satisfied. Thus it makes sense that if you have a point q known to be on the plane, d = q.n. Simply re-arranging as p.n-d = 0 gives you the form you posted.

('.' is the dot product. Also note that I'm assuming the normal is unit-length. Otherwise, d is scaled by the length of the normal. The plane is still valid, but is un-normalized.)

##### Share on other sites
I basicly have a line between two points somewhere in 3D space.
Now I want to have a plane through that line.
I have allready calculated the normal and now I have to calculate d.

ax + by + cz + d = 0

Can I just plug one of the points from the line in d = -(ax + by + cz) to get my 'd' or should I use another method?

##### Share on other sites
Quote:
 Can I just plug one of the points from the line in d = -(ax + by + cz) to get my 'd'
Yes.

(You probably already know that there is an infinite number of planes that contain a given line, but I guess you already have the normal of the plane...)

##### Share on other sites
You can't really calculate a plane through a line (2 points) as the plane can be rotated at any degree around the line.

To calculate a plane you must have at least 3 vertices, you then calculate the face normal of that polygon and calculate the distance of the origin to the plane, normal DOT (vertex1-origin).

Hope that helps.

##### Share on other sites
I allready know the normal so I pretty much know everything I need now.

##### Share on other sites
hi, I have another question.

I know I can rotate a vector by multiplying the vector by a rotationmatrix like

matrix *

|x|
|y|
|z|
|1|

so can I multiply a plane by multiplying it by a rotationmatrix too?

matrix *

|a|
|b|
|c|
|d|

##### Share on other sites
Quote:
 Original post by Kalasjniekofhi, I have another question.I know I can rotate a vector by multiplying the vector by a rotationmatrix like matrix *|x||y||z||1|so can I multiply a plane by multiplying it by a rotationmatrix too?matrix * |a||b||c| |d|

nope.

you should only rotate the normal, ie the abc part.

for nonorthogonal transforms you had best convert to another representation, a basevector and normalvector, rotate those, then convert back to the other representation.

##### Share on other sites
This will transform a plane by multiplying it to a matrix:

Plane  p;Matrix m;float[] = { m._11*p.a + m._12*p.b + m._13*p.c,	    m._21*p.a + m._22*p.b + m._23*p.c,	    m._31*p.a + m._32*p.b + m._33*p.c };p.a = t[0];p.b = t[1];p.c = t[2];p.d = _14*t[0] + _24*t[1] + _34*t[2] + _44*p.d;

 missed that "+ _44*p.d" when I copied the code =)

• ### What is your GameDev Story?

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

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

• Total Topics
634134
• Total Posts
3015749
×