Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have two coordinate systems, like so

Picture of coordinate systems

How can I transform a point on the one of the coordinate system to other ?

Pxyz = M . Px'y'z' what is M ?

@kshahar hi, do you know the answer ? –  gveaf Nov 13 '12 at 10:53
M is the transformation matrix.. kwon3d.com/theory/transform/transform.html –  teodron Nov 13 '12 at 11:04
@teodron can you write the answer –  gveaf Nov 13 '12 at 11:07

1 Answer 1

From the image it looks like both your coordinate systems are cartesian coordinates, where the only difference between the two is that one has a different origin from the other.

If this is the case then to translate from xyz coordinates to x'y'z' coordinates all you need is a translation, i.e.

x' = x + dx
y' = y + dy
z' = z + dz

Where [dx, dy, dz] is the difference between the origins of the two coordinate systems.

Matrix multiplications always have the origin as a fixed point and so you can't perform translations using a 3x3 matrix, however as a sort of workaround you can express your 3-dimensional coordinates as the 4-dimensional vector [x, y, z, 1] and use a 4x4 transformation matrix that includes a translation, e.g.

|1 0 0 dx | |x|   |x + dx|
|0 1 0 dy | |y|   |y + dy|
|0 0 1 dz | |z| = |z + dz|
|0 0 0 1  | |1|   |   1  |

You can then ignore the 4th component to get the translated 3D coordinates. See more on Wikipedia here


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.