I need help to solve a problem involving some math and geometry.
Inside my courses, I have this diagram which represents the equation of several point in space, along a kind of pendulum: diagram
The goal is the find the formula of the black point position according to the different link angle.
Here my struggle: let's say that the second rotation (the red one) is now around the Z-axis, what will be the black point position equation? How do I have to modify the angle coefficient?
If you can help me to figure it out, or maybe give me the name of the theorem/method.
Thanks.

$$x_1=x_0+a_1 \cos \theta_1$$ $$y_1=y_0+a_1 \sin \theta_1$$ and $$x_2=x_1+a_2 \cos \theta_2$$ $$y_2=y_1+a_2 \sin \theta_2$$
But this is not a pandulum, just circles moving on the circles