Position and orientation of local coordinate system relative to another local coordinate system (both described in world coord. system) This question might have been answered before, but I couldn't find one that will best describe my problem, or before I got confused.
The following image depicts three coordinate systems: a world coordinate system, W, and two local coordinate systems A and B described in the world coordinate system in terms of their position, T, and orientation in quaternion format, Q (all relative to W):
Coordinate systems in 3D space


*

*$T_A$ - position of the origin of coordinate system A, in the world coordinate system, W.

*$T_B$ - position of the origin of coordinate system B, in the world coordinate system, W.

*$Q_A$ - orientation of coordinate system A, in (with reference to) the world coordinate system, W (in quaternions).

*$Q_B$ - orientation of coordinate system B, in the world coordinate system, W (in quaternions).

*$t_{BA}$ - position of the origin of coordinate system B, inside (with reference to) coordinate system A.

*$q_{BA}$ - orientation of coordinate system B, described in terms of (with reference to) coordinate system A.


I would like to get $t_{BA}$ and $q_{BA}$ (with reference to coordinate system A)? Or basically, the position and orientation of coordinate system B from an observer's perspective standing at (and inside) coordinate system A.
Any help would be appreciated!
 A: This is how you could find out that $t_{BA} = T_B - T_A$ and $q_{BA}=(Q_A)^{-1}Q_B$:
Let $\mathbf{x_P^W}= (x^W_P,y^W_P,z^W_P)$ be the coordinates $(x^W_P,y^W_P,z^W_P)$ or the position $\mathbf{x_P^W}$ of any point $P$ measured along the $x$-,$y$- and $z$-axis of the world coordinate system $W$. If the $x$-,$y$- and $z$- coordinates or the positions of the origins $0_A$ and $0_B$ of the coordinate systems $A$ and $B$ with respect to the world coordinate system $W$ are $\mathbf{x_{0_A}^W} = (x_{0_A}^W,y_{0_A}^W,z_{0_A}^W)$ and $\mathbf{x_{0_B}^W} = (x_{0_B}^W,y_{0_B}^W,z_{0_B}^W)$, then the position of the arbitrary point $P$ with respect to $A$ and $B$ can be calculated as (just vector addition in $A$ or in $B$)
$$\mathbf{x_P^A}= -\mathbf{x_{0_A}^W}+\mathbf{x_P^W}=(x^W_P-x_{0_A}^W,y^W_P-y_{0_A}^W,z^W_P-z_{0_A}^W)$$
$$\mathbf{x_P^B}= -\mathbf{x_{0_B}^W}+\mathbf{x_P^W}=(x^W_P-x_{0_B}^W,y^W_P-y_{0_B}^W,z^W_P-z_{0_B}^W)$$
Now fix this point $P$ and make it equal the origin $0_B$ of the coordinate system $B$, let $\mathbf{x_P^W}=\mathbf{x_{0_B}^W}=(x_{0_B}^W,y_{0_B}^W,z_{0_B}^W)$, then the equations above will become
$$\mathbf{x_{0_B}^A}= -\mathbf{x_{0_A}^W}+\mathbf{x_{0_B}^W}=(x_{0_B}^W-x_{0_A}^W,y_{0_B}^W-y_{0_A}^W,z_{0_B}^W-z_{0_A}^W)$$
$$\mathbf{x_{0_B}^B}= -\mathbf{x_{0_B}^W}+\mathbf{x_{0_B}^W}=(x_{0_B}^W-x_{0_B}^W,y_{0_B}^W-y_{0_B}^W,z_{0_B}^W-z_{0_B}^W)$$
The first equation is saying: the $x$-,$y$- and $z$-coordinates of the origin $0_B$ of the coordinate system $B$ measured along the $x$-,$y$- and $z$-axis of the coordinate system $A$ are $$(x_{0_B}^W-x_{0_A}^W,y_{0_B}^W-y_{0_A}^W,z_{0_B}^W-z_{0_A}^W)$$
The second equation is saying: the $x$-,$y$- and $z$-coordinates of the origin $0_B$ of the coordinate system $B$ measured along the $x$-,$y$- and $z$-axis of the coordinate system $B$ are $$(0,0,0)$$ 
Look here and here and here and here for some information about orientation. I just found this powerpoint presentation part 1 of 2  and powerpoint presentation part 2 of 2 (see page 19) which is stating that:
If $Q_A^W$ is quaternion for orientation of reference frame $A$ relative to some base reference frame $W$ and $Q_B^W$ is quaternion for orientation of another reference frame $B$ relative to that same base reference frame $W$, then $Q^{A}_{B}=(Q_A)^{-1}Q_B$ is a quaternion for orientation of reference frame $B$ relative to reference frame $A$ where $Q_A^{-1}$ is inverse of $Q_A$ (if quaternions are unit quaternions, then $Q^{-1}=Q^{*}$ (conjugate)).
