How to get the distance from a top of an arm to a surface?

71 Views Asked by At

I am studying computer science and I am working on a project for my next semester. I am stuck with a problem and I am not that good in math. Imagine I have an "arm" shape line where it has 5 nodes A, B, C, D and E. 4 of these nodes have an angle b, c, d, e where A, the 5th node, is the end of this arm.

How can I calculate x for this graph:

enter image description here

And how could I prevent this or solve this case where x did not change:

enter image description here

So generally, What is the math behind calculating the distance x of my end node A whatever the shape of my arm and however it moves?