Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I am trying to write code for a computer simulator. I need to simulate a complex mechanism where each link has a known length and the ends of the links are connected to a triangle. I would like help with finding an equation to tell me the location of the triangle.

picture

Above is a picture of a machine. There are three points B, C, G, whose locations are known. There are three links 3, 4, 5, whose lengths are known. Finally, there is a triangular link with dimensions that are all known but whose location is not. Each of the links 3, 4, 5 connect to the triangular link 2.

Mathematically, the centers B, C, G, are knows as are the radii 3, 4, 5, but I am stumped at how to find the locations of D, E, and F, given the distance between each of them. I don't even have a starting point for the math because the circle-circle or circle-line intersection equations that are used to simulate simpler connections do not seem useful here.

I must add that I am a programmer and not a mathematician. I may have to ask for help turning an equation into code.

Thanks.

Dave

share|improve this question
    
It's very hard to follow your question without seeing the picture. You should import it. –  DonAntonio Jan 29 '13 at 19:47
    
As a new user, I was unable to do any more than link the picture but someone was kind enough to fix that for me. Thanks. –  David Rector Jan 29 '13 at 21:29
add comment

2 Answers

Set up a set of equations for the coordinates of all the points you have got, and see what you can do. The lengths will introduce quadratic terms, but with a bit of luck you can get rid of them.

In the worst case, you could use a computer algebra system like WolframAlpha or maxima to solve your system of equations.

share|improve this answer
    
I only have the actual coordinates of three points. The "inner" triangle dimensions are known but it's location is not known. –  David Rector Jan 30 '13 at 22:33
add comment

You have six variables and six quadratic equations of the form $(x_b-x_e)^2+(y_b-y_e)^2=\ell_4^2$, so I wouldn't hold out much hope for a closed-form solution. I plugged the equations into Mathematica just in case, and it's been chugging away for a while without finding a solution.

This is essentially something like an inverse kinematics problem with three joints and three end-effector constraints. In inverse kinematics, closed-form solutions even when they exist tend to not be particularly useful. What I would recommend is to parametrize the three unknown degrees of freedom, i.e. the orientations of the links $3$, $4$, and $5$ as angles $\theta_3$, $\theta_4$, and $\theta_5$, and then use a numerical method to satisfy the constraints. In other words, let $$\begin{align} (x_d,y_d)&=(x_c,y_c)+\ell_3(\cos\theta_3,\sin\theta_3),\\ (x_e,y_e)&=(x_b,y_b)+\ell_4(\cos\theta_4,\sin\theta_4),\\ (x_f,y_f)&=(x_g,y_g)+\ell_5(\cos\theta_5,\sin\theta_5), \end{align}$$ and define the error as $$e(\theta_3,\theta_4,\theta_5)=\begin{bmatrix}(x_e-x_f)^2+(y_e-y_f)^2-\ell_{ef}\\(x_f-x_d)^2+(y_f-y_d)^2-\ell_{fd}\\(x_d-x_e)^2+(y_d-y_e)^2-\ell_{de}\end{bmatrix}.$$ Then you can use either Newton's method or the Levenberg-Marquardt algorithm to find the value of $(\theta_3, \theta_4, \theta_5)$ that minimizes $\lVert E(\theta_3,\theta_4,\theta_5)\rVert^2$.

share|improve this answer
    
This sounds like a very reasonable examination of the problem. Someone suggested to me that if I could come up with the equation that defines the path of F around B and C, given that G and link 5 were not part of that equation, that that equation could be used in an intersection equation with the path that F takes around G to find where F sits. –  David Rector Jan 31 '13 at 15:40
    
I know that I could find the path of F in a loop and compare each segment in that path to the circle F around G. An equation would be so much more elegant though. So far, any equation for F in that four-bar mechanism B,C,D,E appears to be a function on an angle and not an X,Y function. This makes the equation method seem less possible than ever. Thanks for the feedback. I wish I could up-vote. –  David Rector Jan 31 '13 at 15:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.