# Thread: Coordinate from one origin on another.

1. ## Coordinate from one origin on another.

I've been puzzling something.

Suppose I have a coordinate <a,b,c> as measured from origin at <0,0,0> with a basis vector of x := (1,0,0) and y := (0,1,0) and z:= (0,0,1)

How can I find the location of <a,b,c> on another coordinate (in the same space), centered on <d,e,f>, whose x, y and z basis vectors are (g,h,i), (j,k,l), (m,n,o)

This should be a fairly easy problem, but the solution seems to elude me so far.

A high level analogy to this problem is as follow: Given that we have 2 cameras, looking at a point. Camera 1 is able to determine the coordinate of the point, however not so with camera 2, because the image was blocked (occluded). Given that I know the orientation of Camera 1 and 2, as well as their displacement, how can I find the so said point with respect to Camera 2 axis. Bearing in mind that the camera have completely different angles. ie. one can be looking up to the north east, another looking down to the south, from a higher position etc.

Btw I'm no mathematician, just a programmer. I hope someone can help me.

Thank you.

2. It will help to first look at a 2D analogue of this problem. Let the basis vectors be e1 = < 1, 0 > and e2 = < 0, 1 >. Let the other two basis vectors be U = < u1, u2 >and V = < v1, v2 >. Let the point a be with coordinates (a1,a2) and the coordinate of the new origin with respect to the old be p = (p1,p2).

Now you should draw a picture indicating the old origin, the new origin and the point a. Let A be the vector pointing at point a, i.e. A = <a1,a2>. Similarly let P be the vector for point p. Then you need to find how point a relates to point p. If you draw the picture, you'll immediately see that it must be the vector pointing from point p to point a. Call this vector A'. As it happens from the rules of vectors P + A' = A, so solving this, we get A' = A - P. That is, the vector pointing at point a, starting from point p, is A' = A - P = < a1 - p1, a2 - p2>. So far so good. Now we need to express A' in the basis vectors U andV.

We must find constants x and y such that:

$\displaystyle xU+yV = A' = A - P$

This gives us a system of simultaneous linear equations in x and y:

$\displaystyle u_1x+v_1y = a_1-p_1$
$\displaystyle u_2x+v_2y = a_2-p_2$

Then I'm sure you can just solve them with either Gaussian elimination or by hand. (x,y) will be the coordinates of the point with respect to the new origin and basis vectors.

The 3D case is analogous. Here let a = (a1,a2,a3) and p = (p1,p2,p3) and the basis vectors are u,v and w. Then you need to solve

$\displaystyle Ux+Vy+Wz = A - P$

This gives you the system:

$\displaystyle u_1x+v_1y+w_1z= a_1-p_1$
$\displaystyle u_2x+v_2y+w_2z= a_2-p_2$
$\displaystyle u_3x+v_3y+w_3z= a_3-p_3$

3. Originally Posted by Vlasev
It will help to first look at a 2D analogue of this problem. Let the basis vectors be e1 = < 1, 0 > and e2 = < 0, 1 >. Let the other two basis vectors be U = < u1, u2 >and V = < v1, v2 >. Let the point a be with coordinates (a1,a2) and the coordinate of the new origin with respect to the old be p = (p1,p2).

Now you should draw a picture indicating the old origin, the new origin and the point a. Let A be the vector pointing at point a, i.e. A = <a1,a2>. Similarly let P be the vector for point p. Then you need to find how point a relates to point p. If you draw the picture, you'll immediately see that it must be the vector pointing from point p to point a. Call this vector A'. As it happens from the rules of vectors P + A' = A, so solving this, we get A' = A - P. That is, the vector pointing at point a, starting from point p, is A' = A - P = < a1 - p1, a2 - p2>. So far so good. Now we need to express A' in the basis vectors U andV.

We must find constants x and y such that:

$\displaystyle xU+yV = A' = A - P$

This gives us a system of simultaneous linear equations in x and y:

$\displaystyle u_1x+v_1y = a_1-p_1$
$\displaystyle u_2x+v_2y = a_2-p_2$

Then I'm sure you can just solve them with either Gaussian elimination or by hand. (x,y) will be the coordinates of the point with respect to the new origin and basis vectors.

The 3D case is analogous. Here let a = (a1,a2,a3) and p = (p1,p2,p3) and the basis vectors are u,v and w. Then you need to solve

$\displaystyle Ux+Vy+Wz = A - P$

This gives you the system:

$\displaystyle u_1x+v_1y+w_1z= a_1-p_1$
$\displaystyle u_2x+v_2y+w_2z= a_2-p_2$
$\displaystyle u_3x+v_3y+w_3z= a_3-p_3$
Vlasev, very, very, very impressive. You took a mere few minutes to solve a problem that's been hounding me for days.

The explanation was short, clear and easy to follow.

Thank you, I really appreciate the help.

4. Hey, no problem. Anytime! Problems like this make you wonder just what MAY be out there!