Transformation matrix

87e614b8b888bb2c4485c1ac16d8c779
0
moe 101 Sep 24, 2005 at 19:33

Hi

I have a plane given from a normal and the distance to the origin.

A ground plane would look like this:
normal = (0,1,0)
distance = 0

How would I find a transformation matrix witch would transform the plane or points from the ground plane on to a plane with arbitrary values?

I am not sure that was clear.
If I would actually want to render a ground plane I could use an identity matrix but for other planes I would need a transformation matrix so I can transform the ground plane into the plane represented trough an arbitrary normal and an arbitrary distance.

Side info: Nope this is not homework. I try to find a way so I can sync the results from the physics lib with the gfx output. I can construct point on the searched plane and build a vertex buffer. Then I just render the vertex buffer using an identity matrix. But I would like to know how to use it with meshes. Then I would have a mesh representing a ground plane and use a matrix to put it in place.

Thx for any input.

5 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Sep 24, 2005 at 21:43

The normal of your plane is 0,1,0; therefore your plane can be parameterized by the x axis and z axis (1,0,0) and (0,0,1). When you construct a 3x3 matrix, it maps (1,0,0) to the first column, (0,1,0) to the second column, and (0,0,1) to the third column; therefore, figure out two axes for your desired destination plane and stick them in the first and third columns of the matrix. Then let the second column be the cross product of the third and first (in that order). You probably want the two axes you choose to be orthogonal (perpendicular) and of unit length.

87e614b8b888bb2c4485c1ac16d8c779
0
moe 101 Sep 24, 2005 at 22:40

Thx for your reply.

I am not sure I can apply the same principle to a 4x4 matrix. Can I just set the fourth value to 1? And what about the fourth column, what should it contain?

93a772f4602f3e25528acf7d68516066
0
Jordan 101 Sep 25, 2005 at 00:08

@moe

Thx for your reply. I am not sure I can apply the same principle to a 4x4 matrix. Can I just set the fourth value to 1? And what about the fourth column, what should it contain?

X X X 0
X X X 0
X X X 0
0 0 0 1

Where X is an entry in the 3x3 matrix.

87e614b8b888bb2c4485c1ac16d8c779
0
moe 101 Sep 25, 2005 at 00:41

Thx a lot for the help.

87e614b8b888bb2c4485c1ac16d8c779
0
moe 101 Sep 25, 2005 at 07:06

Lol, I forgot to say it works like a charm :)