Skip to main content
GameDev.net gamedev.net
🔒 Locked

Inverse plane equation

Started by raydog Jul 8, 2005 at 9:19 PM 16 replies 4.4k views
Original Post
raydog
raydog
If I put the plane equation, Ax+By+Cz+D=0, in a 4x4 matrix, and took the inverse of that matrix, what would that give me? Doing a search for inverse plane equation on Google gives me nothing useful.
relsoft
relsoft
Exactly then inverse of the matrix. Try multiplying them to see if the product is the identity matrix just to be sure. :*)
Hi.
JohnBolton
JohnBolton
What do you mean by "put the plane equation in a 4x4 matrix"?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
raydog
raydog
Yeah, I know it will give me the inverse of the matrix. What I'm trying to get at, is I would like to understand
the meaning behind it.

Is there such a thing as the inverse plane equation?

I'm trying to transform/rotate a plane to some neutral state/position.

What I mean is, given, Ax + By + Cz + D = 0, if I put this in matrix form, M:

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

M[1] = plane_normal.x;
M[5] = plane_normal.y;
M[9] = plane_normal.z;
M[13] = -DotProduct( plane_normal, plane_vertex );

Is the inverse of this matrix useful for anything? Or is my logic flawed?
Zakwayda
Zakwayda
I think you may be on the wrong track with the 4x4 matrix. However:
Quote:
I'm trying to transform/rotate a plane to some neutral state/position.
There is probably a solution to this problem, if you can describe more clearly what exactly you're trying to do.
raydog
raydog
I want to rotate a plane (e.g. the vertices that make up the plane) so it has a neutral normal, like (0,1,0).

Can this be done by plugging the plane equation in a matrix and taking its
inverse?
relsoft
relsoft
Quote:
Original post by raydog
I want to rotate a plane (e.g. the vertices that make up the plane) so it has a neutral normal, like (0,1,0).

Can this be done by plugging the plane equation in a matrix and taking its
inverse?


I don't think so. Although if you want you can rotate your plane on the z axis with 0 angle to make it orthogonal to your y axis.

ie:

x = (1,0,0)
y = (0,1,0)
z = (0,0,1)

So the 3 axes are orthogonal to each other.

If you want your plane to have a normal of let's say (0,1,0) then all you have to do is put your plane on the x,z axis so that it's orthogonal to the y plane.



Hi.
raydog
raydog
Quote:
Original post by Anonymous Poster
Nr * Transp (Q) + dt = 0


If Q is a point, and Transp() means Transpose, then how exactly does one take the Transpose
of a point? Matrix transposition is swapping rows for cols, but what is a point transposition?

Maybe a real-number example might clear things up.
Zakwayda
Zakwayda
Quote:
If Q is a point, and Transp() means Transpose, then how exactly does one take the Transpose of a point? Matrix transposition is swapping rows for cols, but what is a point transposition?
It's the same thing, but you have only one row or column, which becomes one column or row. Example:

[x y z]

Transposed, becomes:

[x]
[y]
[z]

Choosing one or the other has to do with rules of matrix multiplication. It looks like the AP is using row vectors in his example, so:

A*transpose(B)

Is the same as A.B (dot product). Also:

transpose(A)*B

Is a tensor product, but I don't think that came up in the example.

I'm not positive about this, but it looks like the AP is using dot product notation (% in his example) already, so the transposes may be redundant, in which case you can probably just ignore them. (I would have to look through the example more carefully to be sure, though...)
Radan
Radan
Quote:
Original post by Anonymous Poster
N % Transp (R) * Transp (Q) + N % Transp (T) + d = 0
[N % Transp (R)] * Transp (Q) + N % Transp (T) + d = 0



Hm... every thing is fine in the calculations apart for this step which just plain doesn't have any sense.

You can't just take out a composition out of a dot product.

N is a 1x3 matrix and R is a 3x3 matrix. I'm not familiar with a dot product between those two types of vectors, actuall there isn't one because they don't belong to the same vector space. Even if there was one the result is a scalar , i.e. a number which you're trying to compose with a matrix (compose not multiply). Multiplying matrices and multiplying a matrix with a scalar are two different operations.

Anyway, up to that point its all correct, but not after that.


To address the OP question:
what do you mean by the term neutral form?
Do you mean rotate the plane into one of the coordinate planes, or into a plane parrallel to one of the coordinate planes, or do you just wanna get a normalized equation of the plane(i.e. have its normal vector be unit length)?
-----------------Always look on the bright side of Life!
b34r
b34r
I'll give it a go :)...

Using the normal of your plane, cross it with the up vector (0,1,0) you get a front vector in plane space, cross that new front vector with the normal and you get your left vector in plane space.

From there build a 3x3 rotation matrix (assuming row major):

left.x   left.y   left.znormal.x normal.y normal.zfront.x  front.y  front.z


(edit: This matrix is a rotation matrix that would map, for example, the (0, 1, 0) vector on the normal vector, ie: world space to plane space).

Transpose it and there you go (note: you could transpose it on the fly... really ;) ;)).
There are a few gotchas to take care of like when the normal is already fairly close to the up vector you need to choose another axis to cross with etc... but it's very standard stuff and it works fine. Having said that, there could be a faster way to do it.

[Edited by - b34r on July 10, 2005 4:33:57 PM]
Praise the alternative.
Radan
Radan
Quote:
Original post by Anonymous Poster

You are very confuse, everything is correct perhaps you not say anything if you do not know linear algebra.


I know very well what I'm talking about, however I'd be willing to acknowledge I'm wrong.

Now I'd be grateful if you'd clarify a point at a time.

First:
N is a normal vector (3 dimensional), it can be represented as a 3x1 matrix.
Transpose(R) is a 3x3 matrix.
% - dot product
Nr = N % Transpose(R).

Could you please define an example of one dotproduct operator on those two vectors? (please don't write standard dot product, describe it , at least in short).
-----------------Always look on the bright side of Life!
b34r
b34r
Quote:
Original post by Anonymous Poster
I have not idea wha you are taking about what is say is the correct way of doing it, it follows from a rigorous prove.


Yes, and I have not idea wha you are taking about since you seem to be paid per word rather than per intelligible sentence.
I'm here to help not to be jumped on by some arrogant anonymous poster. In other words: I was not talking to you and probably never will. So put your oversized ego somewhere else than on my way. Thanks.

The method I gave works, yours certainly do (although, from what I gather, for a different problem) and everybody is happy.

Quote:

[munch munch munch]... This is the normal of the new plane equation.


Incidentaly we know the normal of the new plane equation as an input to the problem.

(edit: I'd like to clarify that this AP has been remotely getting on my nerves on numerous occasions, so it's not free flaming.)

[Edited by - b34r on July 10, 2005 8:18:11 PM]
Praise the alternative.
Radan
Radan
Quote:
Original post by Anonymous Poster
Made the same mistake again

Nr = N % Transp (R)
shoudl be

Nr = N * Transp (R)


Thats more like it. This is ok.
-----------------Always look on the bright side of Life!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.