An old hobby, making cycloids in processing

I am a big fan of both processing and art, regardless of being computer generated or made by hand. When I started learning processing, I used to have all sorts of ideas on what to try to make. One of those ideas was to make cycloids (although the correct mathematical term is roulette).

What are cycloids, you ask? Wikipedia has something to say about this :

cycloid is the curve traced by a point on the rim of a circular wheel as the wheel rolls along a straight line. 

After reading that, coding the thing is straightforward. First you choose a radius R for your circle (or wheel, if you prefer). Now we need some points to trace, so just pick a couple of (r_{i},\ \phi_{i})\in (0,R]\times [0,2\pi) and then use something like this,

(x_{i},y_{i})=(r_{i}\cdot \cos(\phi_{i}),\ r_{i}\cdot \sin(\phi_{i}))+\vec{z}

where \vec{z} is a special vector that you define so that the points will move in each iteration of the algorithm. In each step you move that set of vectors by whatever vector z you want. As you will see, it can be any kind of curve. No reason to limit ourselves to a straight line.

Here are some of my creations.

I think that this one was moving on a spiral.
This one was moving on y = x. In processing (as in most languages used for animation and drawing), the starting point (0,0) is always on the top left corner. Of course you can translate that point at will if you want.
This should be an outward spiral, although I am not 100% sure.
This is my favourite but I don’t remember the curve.

 I had more but I lost most of them (along with the code used to generate them) during a much-needed format. The thing is, I play with my machines a lot and sometimes you break your toys while playing (which I guess is totally alright as long as you can get them running again).

Advertisements