At the very beginning I must warn you, that explaining the problem will be hard to me.
Now, that you've been warned I'll start with quick explanation:
When position is relative to angle and angle is relative to position, how can I find the "perfect point"?
Now to have an example. I have two points: A(Xa,Ya) and B(Xb,Yb), I also have angle between them which is stored in DIR.
Point A - Static, moves with mouse move
Point B - Relative to Angle between two points
DIR - Relative to position of point B
So in one step I want to calculate the perfect position of point B, so it won't have to reassign, without using loops with one, relatively short algorithm.
And now, because it might not be sufficent, I'll give you a real-life example:
I have a platformer I'm working on. There is a player, who is made out of 4 parts: Body with head, arm, and two legs. The last two are not important. What is important is the body. In this game you aim using mouse, and the arm with gun rotates accordingly. To add realism, I decided to make it so the body bends when looking down, and moves aside(? Bends up?) when looking up. But when the body rotates the point where arm connects with body moves also. Look at the picture:

See? When the angle between Point A and B changes (DIR), so does the poistion of point B, and furthermore because of that DIR changes again, and so on...
So how can I find the harmony between these points? How can I find the one and only right point? ^^
If you need, these are the formulas I use:
Code:
Point A - Static, its positions are Xa and Xb
DIR - It is atan2(Xa-Xb,Ya-Yb)
temp_atan=ATan2(-4,-5) //It's just temporarty variable, to quicken the calculations)
Xb=x+5+Sin(temp_atan+dir/5)
Yb=y+8+Cos(temp_atan+dir/5)
X and Y are coordinates of the player object, temp_atan, is the angle between rotation axis/point of body and point where body and arm joins.
(These codes above might not be perfect, as I keep finding mistakes here and there, but in any case I think I'd be able to change the finishing algorithm)
I hope it is understandable. It was hellishly difficult for me to explain ^^;
Thanks in advance