Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

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 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 ?

share|improve this question
@kshahar hi, do you know the answer ? – gveaf Nov 13 '12 at 10:53
M is the transformation matrix.. – teodron Nov 13 '12 at 11:04
@teodron can you write the answer – gveaf Nov 13 '12 at 11:07

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

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.