38
$\begingroup$

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})$

enter image description here

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:

enter image description here

I drew a diagram to help me visualise the movement as well (the square moves along the red track):

enter image description here

$\endgroup$
  • $\begingroup$ The distance from the center of the cube to a corner is $\sqrt{2l^2}/2$, so if you make the square rotate around the circle at a distance $r+\sqrt{2l^2}/2$ it would not intersect the circle $\endgroup$ – Norse Jan 16 at 12:56
  • 2
    $\begingroup$ Do you want the trajectory of the square to be of constant distance from the center of the circle (as in your picture) and, for example, rotate the square along the way? Or you want to keep the position of the square straight and to change the distance from the center instead? $\endgroup$ – mur_tm Jan 16 at 12:56
  • 1
    $\begingroup$ The square should not rotate. The distance should fluctuate such that the square remains in contact with the circle. $\endgroup$ – Justin Wong Jan 16 at 12:59
  • 6
    $\begingroup$ Here I've implemented Yves' answer in Python processing (gif). Perhaps you'll find it instructive/useful/not a waste of time ¯\_(ツ)_/¯. $\endgroup$ – Izaak van Dongen Jan 16 at 15:01
  • 1
    $\begingroup$ This is very useful! I was still studying the answers and trying to figure it out and implement it. The source code will help greatly. Thanks! $\endgroup$ – Justin Wong Jan 16 at 15:15
29
$\begingroup$

As said elsewhere, the trajectory of the center is made of four lines segments and four circular arcs obtained by shifting the quarters of the original circle.

enter image description here

But it is not enough to known the shape of the trajectory, we also need to know the distance as a function of time, assuming that the center rotates at constant angular speed (not the contact point).

For convenience, the square is of side $2l$. For a contact on the left side of the square, we intersect the line

$$d\,(\cos\theta,\sin\theta)$$ where $\theta=\omega t$, with the straight part of the trajectory,

$$x=r+l$$

and we obtain the point

$$(r+l,\tan\theta(r+l))$$ and the distance $$\color{green}{d=\frac{r+l}{\cos\theta}}.$$

For a contact on the bottom left corner, we intersect the same line with the shifted circle

$$\left(x-l\right)^2+\left(y-l\right)^2=r^2$$

and this gives us the quadratic equation in $d$

$$\color{green}{d^2-2ld(\cos\theta+\sin\theta)+2l^2-r^2=0}.$$

You need to repeat the reasoning for the other sides and corners of the square.

Finally, the switch from contact by the side to contact by the corner occurs at an angle $\theta$ such that

$$\begin{cases}d\cos\theta=r+l,\\d\sin\theta=l,\end{cases}$$

i.e.

$$\color{green}{\tan\theta=\frac l{r+l}}.$$

$\endgroup$
  • $\begingroup$ I think your equations should be $r \cos \phi + \frac l2 = d\cos \theta$ (and similar for the other one), right? $\endgroup$ – Izaak van Dongen Jan 16 at 14:02
  • 1
    $\begingroup$ @IzaakvanDongen: you are quite right. I have now completely reworked my post. $\endgroup$ – Yves Daoust Jan 16 at 14:21
  • $\begingroup$ Small typo: I think you meant $\dots 2l^2 - r^2 = 0$. Otherwise I agree :). $\endgroup$ – Izaak van Dongen Jan 16 at 14:36
  • $\begingroup$ @IzaakvanDongen: thumbs up. $\endgroup$ – Yves Daoust Jan 16 at 14:38
6
$\begingroup$

Consider what happens when the square is directly to the right of the circle with the circle tangent to the midpoint of a side of the square. In order for the square to move up while remaining in contact without crossing into the square, it has to go straight up. This continues until the lower left vertex is on the circle, after which that vertex moves along the circle from the rightmost point to the topmost point. Then the square has to move straight left until the lower right vertex is on the circle, and then that vertex moves along the circle.

Each time a vertex moves along the circle, the center of the square moves along a circular arc whose center is displaced from the center of the displayed circle.

As a result, the center of the square moves straight up, then through a quarter circle arc, the straight left for the width of the square, then through another quarter circle, then down for the height of the square, etc.

The total length of the path of the square's center until it returns to the start is $2\pi r + 4s,$ where $r$ is the radius of the circle and $s$ is the side of the square. If you can use the distance along the path, not the direction between the centers, as your parameter for the motion of the square, it should make this easier to draw.

$\endgroup$
  • 3
    $\begingroup$ The trajectory of the center of the square is indeed made of four line segments and four circular arcs. But they are not traversed at constant speed because the center of the circle, of the square, and the point of contact form a variable angle. $\endgroup$ – Yves Daoust Jan 16 at 13:49
  • $\begingroup$ The one thing that's slightly surprising is that (assuming we're at the origin), the circle-arc along which the square-center moves is NOT an arc of a circle centered at the origin, but instead a circle whose center is displaced from the origin by $(\pm s, \pm s)$, where $s$ is half the length of the side of the square. Pretty cool! $\endgroup$ – John Hughes Jan 16 at 14:11
  • $\begingroup$ @YvesDaoust I did not say the center of the square must move at a constant speed. I merely suggested that if it is acceptable for the center of the square to move at a constant speed, it might make the parameterization of the path simpler. I did not see (and still do not see) any specification in the question regarding the speed of motion, so it seems like a reasonable option to suggest. Now, apparently after reading the answers OP decided that one with a constant angular motion was the desired result, and that's fine. $\endgroup$ – David K Jan 18 at 4:11
6
$\begingroup$

enter image description here

The path can be expressed in terms of the distance $d$ = AB as a function of the angle $θ$ that the distance line forms with the vertical axis.

Consider $θ$ in the first quadrant first. In the case where the sides of the square are in contact with the circle, B moves either horizontally or vertically, and the distance function is given simply by

$$d\left( θ \right) =\left( r+\frac{l}{2} \right) \sec θ ,θ \in \left( 0,\tan ^{-1}\frac{l}{2r+l} \right) $$ $$d\left( θ \right) =\left( r+\frac{l}{2} \right) \csc θ ,θ \in \left( \cot ^{-1}\frac{l}{2r+l},\frac{π}{2} \right) $$

On the other hand, if the vertex C is in contact with the circle, where $θ\in(\tan^{-1}\frac l{2r+l},\cot^{-1}\frac l{2r+l})$, apply the sine rule to the triangle ABC,

$$\frac{\sin x}r = \frac{\sin y}{\frac l{\sqrt2}}=\frac{\sin(x+y)}d$$

which leads to $d=r(\cos y + \cot x\sin y)$ and $\sin y = \frac l{\sqrt2 r}\sin x$. Recognize that $x=45-θ$ and eliminate $y$ to obtain the path function

$$d\left( θ \right) =\frac{1}{\sqrt{2}}\left( \sqrt{2r^2-l^2\sin ^2\left( 45-θ \right)}+l\cos \left( 45-θ \right) \right) $$

Similar expressions can be obtained for $θ$ in the other quadrants.

$\endgroup$
6
$\begingroup$

At first it appears that the inner vertex of the square is a circle of radius $r$ and outer vertex goes on circle radius $ r+ \sqrt2 l $.

However the constraint of parallel displacement of squares forces the squares to move horizontally or vertically maintaining sliding contact at four points $$(r,0), (0,r),(-r,0), (0,-r) $$ with square side sliding on circle radius $a$ at the above points. It also defines an outer square envelope of side $(r+l)$ serving as outer boundary.

A rough sketch (sorry about the hand drawn Paint diagram) can indicate what is happening at outer boundary.

If $\tan β=\dfrac{l}{l+r}$ then the eight demarcation of change over polar angles to flat square boundary are given by:

$$ θ= β, π/2-β,π/2+β, π-β, π+β, 3π/2-β, 3π/2+β,-β$$

How do I rotate.. Mathematica has RegionPlot command defining swept area:

r=a; a = 2; l = 1; RegionPlot[{x^2 + y^2 > a^2, x^2 + y^2 < (a + Sqrt[2] l)^2, Abs[x] 
< a + l, Abs[y] < a + l}, {x, -4, 4}, {y, -4, 4} ]
$\endgroup$
  • 1
    $\begingroup$ This is right but already said elsewhere. And the distance to the center as a function of the angle is missing (this is precisely what the question is asking). $\endgroup$ – Yves Daoust Jan 17 at 7:27
  • $\begingroup$ This is shown in Fig1, point of cross-lines. Should the trig also be given after responses from the others? $\endgroup$ – Narasimham Jan 17 at 20:11
  • $\begingroup$ Ok, shall try to post center point locus later on. $\endgroup$ – Narasimham Jan 18 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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