I have
- a circle of radius r
- a square of length l
The centre of the square is currently rotating around the circle in a path described by a circle of radius $(r + \frac{l}{2})$
However, the square overlaps the circle at e.g. 45°. I do not want the square to overlap with the circle at all, and still smoothly move around the circle. The square must not rotate, and should remain in contact with the circle i.e. the distance of the square from the circle should fluctuate as the square moves around the circle.
Is there a formula or algorithm for the path of the square?
[edit]
Thanks for all your help! I've implemented the movement based on Yves solution with help from Izaak's source code:
I drew a diagram to help me visualise the movement as well (the square moves along the red track):