A simple coding challenge. Let's see if anyone is up for it.

I just stumbled upon this;
 
2011-11-28-rolling-1.png
 
 
-Suppose we set a small circle rolling around the interior of a large circle of twice its diameter. If we follow a point on the small circle, what pattern will it draw?

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Surprisingly, it will draw a straight line:

2011-11-28-rolling-2.gif

As soon as I saw this, I wanted to build a real working example of this in Corona SDK, the small circle really drawing a line as it rotates, but since I’m such a newbie I don’t even know where to start. Do you think it is possible? And if so, are you up for the challenge? :slight_smile:

Draw a line from the center of the large circle to the center of the inner circle. Now you should see the algorithm.

Draw a (large circle) center line1 = x1_1,y1_1 to x1_2,y1_2 with a global var x1_2,y1_2

With a transition.to, rotate that line1 (counter-clockwise) at a rate Z

Draw a second line2 =  using x2_1,y2_1 to x2_2,y2_2

With a transition.to, rotate that line2 at the rate Z, the same way.

Now make line1 alpha=0 and line2 alpha=1

Make a timer.

Use those globals and move line2 origin (x2_1 =  x1_2, y2_1 = y1_2) in the timer function.

That should do it for getting the straight inner line to rotate in such a manner.

With corona, use a large circle background. Take an inner circle sprite and rotate it and adjust it’s center (just position the sprite with Graphics 2.0 now!) to x1_2,y1_2

Draw a line from the center of the large circle to the center of the inner circle. Now you should see the algorithm.

Draw a (large circle) center line1 = x1_1,y1_1 to x1_2,y1_2 with a global var x1_2,y1_2

With a transition.to, rotate that line1 (counter-clockwise) at a rate Z

Draw a second line2 =  using x2_1,y2_1 to x2_2,y2_2

With a transition.to, rotate that line2 at the rate Z, the same way.

Now make line1 alpha=0 and line2 alpha=1

Make a timer.

Use those globals and move line2 origin (x2_1 =  x1_2, y2_1 = y1_2) in the timer function.

That should do it for getting the straight inner line to rotate in such a manner.

With corona, use a large circle background. Take an inner circle sprite and rotate it and adjust it’s center (just position the sprite with Graphics 2.0 now!) to x1_2,y1_2