In 3D space, given P1 and P2, and two links attached end to end with lengths L1 and L2 respectively, link1 starts at P1. Write a function that finds the configurations of the links that put the 2nd link’s end at point P1. I dunno where to start... What exactly "link configuration" should be (as output): A vector (like 2i -3j+5k)? Or a point coordinate of the joint point or what..?
My thought is that there is infinite number of solutions in 3D, and 2 solutions in 2D, and I am trying to one of them for the 1st step for 3D.
Given P1 (x1,y1,z1), P2 (x2,y2,z2), L1 and L2, all I can think of is: convert to a new coordinate system (not sure how though) such that P1 becomes (0,0,0) and P2 becomes (d,0,0) where d = distance(P1, P2). Now we reduce it to a 2D problem where we need to find P3 (x, y, 0) in the new coordinate system, such that P3 is L1 from (0,0,0), and L2 from (d,0,0).
I think we can find exactly two solutions of P3 (x3, +/-y3) as we fix z to 0. And then, I need to convert it back to the original coordinate system...and z coordinate should kick in...but I have no clue about how.