Sign in to follow this  
raydog

Inverse plane equation

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.



Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It is easy to transform a plane equation by a transformation matrix. You just need to write the equations symbolically and make the substitutions.
He is how for direct tranfomation.
Say M is a rotation matrix composed of a rotation R (3x3) matrix plus translation vector T

Matrix M will transform a point Q to P by:

1) P = Q * M = Q * R + T

Now say you have a plane equation

2) N % Transp(P) + d = 0;

N = a vector perpendicular to the plane surface,
d = the distance from the plane to the origin
Transp (P) is the transpose of vector P
% is the operation Dot product

Replacing equation 1 in 2 you get

N % [Transp (Q * R + T)] + d = 0

Now with some algebraic manipulation

N % [Transp (Q * R) + Transp (T)] + d = 0
N % Transp (Q * R) + N % Transp (T)] + d = 0
N % Transp (R) * Transp (Q) + N % Transp (T) + d = 0
[N % Transp (R)] * Transp (Q) + N % Transp (T) + d = 0

but Nr = N % Transp (R) is the inverse rotation of N by rotation matrix R.
dt = N % Transp (T) + d is the evaluation of the translation part of the matrix on the

Nr * Transp (Q) + dt = 0

I will let you do your own Inverse Transformation as an exercise

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...)

Share this post


Link to post
Share on other sites
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)?

Share this post


Link to post
Share on other sites
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.z
normal.x normal.y normal.z
front.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]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by A Guy from CRO
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.


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

To raydog:
The last line is
Nr % Transp (Q) + dt = 0

About the representation, the Dot product of tow vector is and scalar operation, but It can be represent as a matrix multiplication, by representing the second as the transpose of the vector
say the symbol % is the operator dot product, then is a vector class the dot product of A and B is
Dot = A % B

In matrix form this is equavalient to
Dot = A * Transp (B)

However you do not do any conversion you just use you normal dot product function.

The reason is written like that is to make the demonstration consistent with the Law and principles of linear algebra.

JYK is right it is redundant to write
A % Transp (B),
however there is not harm in doing that, because in the implementation you will be using your dot product function.


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by 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.z
normal.x normal.y normal.z
front.x front.y front.z

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.


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.
new plane

Nr % Q + dist = 0

Where:
Nr = N % Transp (R)
dist = N % Transp (T) + d is the evaluation of the translation part of the matrix on

To transform a plane equation by a transformation matrix all you need to do is:

Take the translation part of the matrix is evaluate in the plane equation this is the new distance of the new plane equation.

Take the normal of the plane and inverse rotate by he rotation part of the matrix.
This is the normal of the new plane equation.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this