Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have three 3d points (x, y, z). I am trying to create a 3d plane and get a 3d Matrix from those points.

enter image description here

The XYZ values are not accurate in this case but should give an idea on what I am looking. I am working in JavaScript but any pseudo code will do.

share|improve this question
Calculating a plane equation from three points is easy (google "plane from three points" and you'll find the formulas), but what matrix are you trying to create? Please clarify. – Nathan Reed Jun 11 '12 at 16:29
A transformation matrix. Something like you find in CSS3. A 16 value transform matrix: 1, 0, 0, 0, 0, -0.416146844625473, 0.9092974066734314, 0, 0, -0.9092974066734314, -0.416146844625473, 0, 100, 100, 100, 1 – Mircea Jun 11 '12 at 16:31
Yes, but a matrix is a transformation between two coordinate systems. What coordinate systems are you trying to go between? – Nathan Reed Jun 11 '12 at 16:38
I am trying to get the matrix of the new created plane. Not really sure that I am explaining this right. Thanks! – Mircea Jun 11 '12 at 16:47
@Mircea I suggest describing what you're trying to accomplish instead of asking how this one, impossible step can be done. It's clear from the confusion that more information is needed. – Patrick Hughes Jun 12 '12 at 18:05

Sounds like you don't need the plane at all. If I understand correctly, you want to create a transformation matrix which transforms a specific oriented rectangle to the rectangle in your picture. This transformation matrix you could then also use to transform other rectangles respectively.

You can create a transformation matrix easily if you know how base vectors should be transformed. Let's use 3x3 3D matrices here instead of 4x4 for simplification. You have three base vectors i=(0,0,1); j=(0,1,0); and k=(1,0,0);. Let's assume P1 is always in the origin as it is in the picture. From the picture it looks like you want to transform j to P2 and i to P4 (the last corner, missing from the picture). You still need to figure out where to transform k, and the answer is probably the cross product of P2 and P4. Let's call it P5. Now you can just make a 3x3 transformation matrix from these transformed vectors: [P2 P4 P5]. Put them either as row or column vectors depending how you handle the matrices.

If this is what you are looking for, taking translation into account and extending these to 4x4 matrices should not be hard.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.