# Transformation matrix

5 replies to this topic

### #1moe

Valued Member

• Members
• 276 posts

Posted 24 September 2005 - 07:33 PM

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.

### #2Reedbeta

DevMaster Staff

• 5305 posts
• LocationBellevue, WA

Posted 24 September 2005 - 09:43 PM

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.
reedbeta.com - developer blog, OpenGL demos, and other projects

### #3moe

Valued Member

• Members
• 276 posts

Posted 24 September 2005 - 10:40 PM

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?

### #4Jordan

Member

• Members
• 41 posts

Posted 25 September 2005 - 12:08 AM

moe said:

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.

### #5moe

Valued Member

• Members
• 276 posts

Posted 25 September 2005 - 12:41 AM

Thx a lot for the help.

### #6moe

Valued Member

• Members
• 276 posts

Posted 25 September 2005 - 07:06 AM

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

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users