# Matrix 3D rotation/translation/scaling relative to each other

I am trying to implement an algorithm, that removes a part of an assembly (3D) and translates/rotates/scales those other matrices which are child/parent to a new matrix. For example:

(MT = Transformation Matrix)

 - MT1 (first component)
- MT2 (second component relative to MT1)
- MT3 (third component relative to MT2)


Remove MT2 to get a new structure like:

 - MT1
- MT3


To achieve this, I do the following (MT3' will be saved to MT3 at the end of the calculation):

Rotation: MT2 * MT3 = MT3'
Translation: [MT2.tx + MT3.tx = MT3'.tx] [MT2.ty + MT3.ty = MT3'.ty] [MT2.tz + MT3.tz = MT3'.tz]
Scale: MT2.scale * MT3.scale = MT3'.scale

The resulting matrix looks like this:
MT3'x1   MT3'y1   MT3'z1   MT3'.tx
MT3'x2   MT3'y2   MT3'z2   MT3'.ty
MT3'x3   MT3'y3   MT3'z3   MT3'.tz
0        0        0        MT3'.scale


MT1 is NOT included in this calculation, because the problem is, it works so far, but sometimes the 3D components are not translated, but transformed correctly. I cannot figure out exactly what the problem is, and I am searching now for about 3 days and stumbling to find the correct answer. In about 60-70 % of the tested assemblies (about 20) all worked fine, but I couldn't figure out what I did wrong...

I've tried affine 3D transformation already, but the result looked even worse...