Short Question:
If $T_\mathrm{loc}$, $P_\mathrm{rest}$ and $P_\mathrm{loc}$ are translation matrix and $T_\mathrm{rot}$ and $P_\mathrm{rot}$ are rotation matrix, how can I obtain values of $Q_\mathrm{loc}$ and $Q_\mathrm{rot}$ such that
$T_\mathrm{loc} \cdot T_\mathrm{rot} \cdot P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot} = P_\mathrm{rest} \cdot Q_\mathrm{loc} \cdot Q_\mathrm{rot}$
where, $Q_\mathrm{loc}$ and $Q_\mathrm{rot}$ must be translation matrix and rotation matrix respectively.
Detailed Explanation:
I'm working on a (Computer Graphics) project where I want to multiply a transformation matrix $T$ (more precisely, $T = T_\mathrm{loc} \cdot T_\mathrm{rot}$, ie. it first rotates about world axis and then translates given point).
I already have $T$ and if I apply $T$ to a point $P_w$ I get appropriate P_w'.
However, my problem is I don't directly have $P_w$. I compute it as $P_w = P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot}$. Also I want to get the result back in the same form $Q_\mathrm{loc}$ and $Q_\mathrm{rot}$ (ie. in 2 parts, a translation matrix and a rotation matrix).
I have tried
$Q_\mathrm{loc} = T_\mathrm{loc} \cdot P_\mathrm{loc}$ ...(since translations are commutative)
$Q_\mathrm{rot} = P_\mathrm{rest}^{-1} \cdot P_\mathrm{loc}^{-1} \cdot T_\mathrm{rot} \cdot P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot}$
which mathematically should result in
$RHS = P_\mathrm{rest} \cdot Q_\mathrm{loc} \cdot Q_\mathrm{rot}$
$ = P_\mathrm{rest} \cdot T_\mathrm{loc} \cdot P_\mathrm{loc} \cdot P_\mathrm{rest}^{-1} \cdot P_\mathrm{loc}^{-1} \cdot T_\mathrm{rot} \cdot P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot}$
$ = T_\mathrm{loc} \cdot T_\mathrm{rot} \cdot P_\mathrm{rest} \cdot P_\mathrm{loc} \cdot P_\mathrm{rot}$ ...(since translations are commutative)
$ = LHS$
However, I'm now convinced that the above will not work since $Q_\mathrm{rot}$ is a rotation matrix (ie. only rotation part) and hence there's no effect of $P_\mathrm{rest}^{-1}$ and $P_\mathrm{loc}^{-1}$.
I know this must be possible somehow since we can represent any point in 3D space with a rotation and a translation, but I'm lost. Any help would be greatly appreciated.
Thanks in advance.