# Global position and orientation of a point relative to another

1. Mar 1, 2013

### helloearthling

Hi there all,

I have a personal project I'm working on and since I haven't done any linear algebra in many years I'm not sure what I think is right, is right.

I'm also not entirely sure this is the right place to ask but I'm asking more for confirmation/clarification of methodology than any solving so I think this board is more appropriate than the homework one.

So here goes

I have the following:
1. The global location of node (let's call it C). Let this be: $X_{C},Y_{C},Z_{C}$
2. The global rotation of C (by global rotation I mean the rotation of the node as if the global origin were shifted to the centre of the node - does this have a specific term? I hope that made sense)
Let's call the X,Y,Z rotations of C $\gamma$,$\beta$,$\alpha$ respectively
3. a point (let's call it B) exists with a known offset in the local X,Y,Z directions. Let's call these offset values: XL,YL,ZL from C. What I mean by L is that if C is rotated in the X,Y,Z then C has a new local axis and the offset occurs in that direction.

So what I want to find is:
The global location and rotation of B given the above.

What i've done but am just not sure if it's right:
I have a relative rotation matrix solved by doing CR = $Z \times Y \times X$ rotations

which is

$$\textbf{C}_{R}= \begin{bmatrix} cos( \alpha) & -sin( \alpha) & 0 \\ sin( \alpha) & cos(\alpha) & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} cos(\beta) & 0 & sin(\beta) \\ 0 & 1 & 0 \\ -sin(\beta) & 0 & cos(\beta) \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos(\gamma) & -sin(\gamma) \\ 0 & sin(\gamma) & cos(\gamma) \end{bmatrix}$$

(is this in itself right? Am I correct to label it CR ?)

And then I do, to find the Global position of B

$$\textbf{C}_{R} \begin{bmatrix} \gamma_{B}\\\beta_{B}\\\alpha_{B} \end{bmatrix}= \begin{bmatrix} X_{C}\\Y_{C}\\Z_{C} \end{bmatrix}$$

, solve for
\begin{bmatrix}
\gamma_{B}\\\beta_{B}\\\alpha_{B}
\end{bmatrix}

\begin{bmatrix}
X_{L}\\Y_{L}\\Z_{L}
\end{bmatrix}

Is this even correct?

Also, how does one determine the global rotation of B based off the rotation of C and the offset of B. Is it just "the same"? I think i'm overcomplicating thing but i'm honestly not sure.
In addition to the above, how does one determine the global rotation of B based off the rotation of C with additional rotational offsets of C relative to B

I hope that all made sense.

regards,

2. Mar 3, 2013

### helloearthling

Anyone out there that can help? Is my question too confusing?
Is there another thread out there with exactly the same question that someone can direct me too?

3. Mar 3, 2013

### chiro

Hey helloearthling and welcome to the forums.

If you want to rotate something about a point then what you do is the following:

1) Subtract the rotation center from your point to be rotated
2) Apply the rotation matrix to this new point
3) Add back the rotation origin to get the final point

For 2) You can either compose rotations (like you did above) or you can use one single rotation axis and perform the rotation.

Also if you want to interpolate rotations I'd look at quaternions.

If you want to the translations in matrix algebra, then you will need to introduce a 4x4 matrix where you have Tx, Ty, Tz, 1 in the last column.