Rory Daulton thanks for the code, but I think d2 = th - d, if I understood well the formulas for T2x, T2y.
This is because d1 is the angle between <T1, C, green dotted line> and d2 is between <T2, C, green dotted line>. Thanks!!