Looked again at your 16 pictures of your process.
So the key is to find out the y and z coordinates of Tangent point T
I never before heard of Thale's theorem, but it provides another way to locate Tangent point T.
A high school student could probably canculate the formula for point T, given points P[1], P[2], and O. :-)
Not sure exactly which tools in MoI script to use...