Abraham Gadalla tried (but failed) to post the following question. Why does the red point not continue to follow the square (and the curve) for the full range $0\le x\le 2\pi$?

  With[{q = Quotient[x, Pi/2], m = Mod[x, Pi/2]},
  {EdgeForm[Black], LightGray, Rotate[{Rectangle[{q, 0}], 
  {Red, PointSize[0.03], Point[{q, q}]}}, -m, {q + 1, 0}],
  {Thick, Red, Circle[{1, 0}, 1, {Pi, Pi/2}], 
   Circle[{2, 0}, Sqrt[2], {3 Pi/4, Pi/4}],Circle[{3, 0}, 1, {Pi/2, 0}]}   
], {x, 0, 2 Pi}]

What simple modification is required to get this to work?


2 Answers 2


Point[{q,q}] has to be changed:

With[{q = Quotient[x, Pi/2], m = Mod[x, Pi/2]},
Graphics[{EdgeForm[Black], LightGray, 
Rotate[ {Rectangle[{q, 0}], {Red, PointSize[0.03],Point[{{0, 0}, {1, 1}, {3, 1}, {4, 0}}[[q + 1]]](* ,Point[{q,q}]*) } }, -m, {q + 1, 0}],
{Thick, Red,Circle[{1, 0}, 1, {Pi, Pi/2}], Circle[{2, 0}, Sqrt[2], {3 Pi/4, Pi/4}],Circle[{3, 0}, 1, {Pi/2, 0}]}},PlotRange -> {{-.10, 5}, {-.1 , 2}}]], {x, 0, 2 Pi .999}]

enter image description here

In the plot I added a last phase to show a complete rotation.


Vielen Dank Herr Neumann (Thank you Mr. Neumann ) I wonder, if it is possible to draw the path while the point is moving, Or writing a function of theta similar to the cycloid parametric equations: x = r (theta - sin (theta)) and y = r (1 - cos (theta).
My main goal is to generalize the problem to write the parametric equations for the cyclogon. The following part of a program shows the multiple of four polygons after moving them above the x-axis and to the right of the y-axis. Please see below. The next step is to find a function to draw a path while a point on its vertex is rotating. I appreciate your help Draw the Cyclogon

 trM4 = Graphics[{{EdgeForm[{Thick, Red}], FaceForm[LightGray], 
     RegularPolygon[n]}, {PointSize[0.025], Blue, 
     Point[{Cos[\[Pi]/( n)] - Sin[\[Pi]/( n)], 0}]}, 
       Style[TraditionalForm[{Cos[\[Pi]/( n)] - Sin[\[Pi]/( n)], 0}], 
        16, Black], {Cos[\[Pi]/( n)] - 
        Sin[\[Pi]/( n)], -0.2}]], {Translate[{EdgeForm[{Thick, Red}], 
       FaceForm[{Yellow, Opacity[0.5]}], 
       RegularPolygon[n], {PointSize[0.03], Red, Point[{0, 0}]}}, { 
       Cos[\[Pi]/n], Cos[\[Pi]/n]}]}}, Axes -> True, ImageSize -> 400];
   Control[{{n, 4, "Number of sides"}, 4, 21, 1, 
     Appearance -> "Labeled"}], Spacer[45], 
   Control[{{hint, False, "hint"}, {False, True}}]}], 
 TrackedSymbols :> {n, hint}]

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.