Screensaver graphics

For this week’s assignment, we had the task of recreating an old computer graphic from a collection of volumes denominated “Computer Graphics and Art”. While I was first browsing through the examples in each issue, I was amazed by the beauty and complexity of the 3D artworks (and their resemblance to the old screensaver graphcis!) Below are some of the artworks that caught my attention the most:

Initially, with still no idea of how it was possible to create such effects simply by coding, I resorted to the internet and discovered the magic of using parametric equations and the sin() and cos() functions to create different line movements and combinations. After a lot of trial and error and some time when I reconsidered the possibility of recreating this type of graphic, I managed to create an effective parametric equation. This was the effect that emerged from this exploring:

First attempt: solely graphing the dots

In order to create this set path, I created a float t that would be the basis for everything, as its increasing values would be used in the equations I established. I then created 4 methods that would return certain values and would determine the movement for the x1, y1, x2, y2 coordinates, since I wanted to make two points that moved at the same time. With this in mind, upon more browsing through the internet, I came upon an amazing tutorial video that gives an overview on computer graphics and the usefulness of using the sin() and cos() functions. Once I implemented these equations, the circular, fluid motion as shows in the previous image was created. Then, to create the lines seem as if they were moving on a 3D plane, I used the coordinates I previously established and implementing them in the line() function.

Once I had figured out how to approach the task of recreating any of the 3D graphics I previously saw, I thought it would be simply a matter of altering the equation to make the movement approximate that of the other ones. However, establishing parametric equations for each of the four coordinates that would recreate the appearance of my chosen image turned out to be an extremely challenging task that, frustratingly, included much more math applications. These are some of the approximations I tried to make:

Overall, it was an extremely big challenge to recreate the image I had in mind due to (at least my) perceived difficulty of altering the equations in such a precise way as to try to imitate its original movement.  Amongst all the attempts, I was able to create many interesting products that, although not as similar to those I previously wanted to make, still presented the same essence of moving along a same path and creating a 3D appearance with this effect. In the end, I was not able to completely recreate any of these images due to the difficulty of figuring out the precise equations, but I still found the graphics that I created extremely interesting and worth to post on this blog.  This whole process was incredibly useful, as I learned a lot about the sin() cos() and line() functions and the many applications they can have in computer graphic art. Along with the pieces I was able to create and the struggle of this whole process, I surely felt satisfied with the graphics I elaborated, since they managed to capture a similar movement as those of the original artists’ pieces. These are, personally, my favorites of the pieces I made: 


Another attempt at recreating the previous figures
Black and white version of the final product
Alternate colors
Final product with the addition of color

Attached is the code:

float t = 0;
float s; 

void setup(){

void draw(){ 
 //point(x1(t),y1(t)); //calling the methods, using returned value
 //s = map(t,0,400,50,150);
 s = map(t,0,400,70,140);
 //printing lines according to x1, x2, y1, y2 values (using changing values of t)
 if (t <= 100){

//methods that create parametric equations using values of t 
float x1(float t){
 return sin(t/10)*100 + sin(t/15)*100; 
 //better to use lower amplitude if frequency is higher

float y1(float t){
 //coefficient inside: changes frequency, smaller coefficient = larger curve
 //bigger coefficient (multiplying) = smaller curves (more frequency)
 //coefficient outside: amplitude changes
 return cos(t/10)*100; 

float x2(float t){
 return sin(t/20)*100 + sin(t/20)*100;

float y2(float t){
 return cos(t/40)*100 + cos(t / 40) * 55;