SNELIN is back

Dietrich M. Scheringer made it 🙂

Here there is the code you may use to experiment:

/** Sne Comp Art: Routine SNE LIN

originally developed in 1979 by Reiner Schneeberger
recoded in Processing in 2013 by Dietrich M. Scheringer
version 2.0

*/

void setup() // Setting up the area for drawing
{
size(600,600); // 0 <= x <= 1280, 0 <= y <= 1024
background(0); // backround colour: black
stroke(255); // colour of the lines: white
noLoop(); // execute method draw only once
}

void draw()
{
/* Parameters for snelin */

float anzpkt = 7.; // number of points
float anzstr = 80.; // number of repetitions of drawing
float [] xwerte = {0., 40., 300., 590., 300., 500., 100., 5.}; // Array with anzpkt-elements // x-coordinates of the points + xwerte[0]
float [] ywerte = {0., 20., 580., 25., 50., 500., 500., 410.}; // Array with anzpkt-elements // y-coordinates of the points + ywerte[0]
float pstrek = 7.; // pstrek > 0 –> scaling down next drawing
// pstrek < 0 –> scaling up next drawing

snelin(anzpkt, anzstr, xwerte, ywerte, pstrek);

}

void snelin(float anzpkt, float anzstr, float [] xwerte, float [] ywerte, float pstrek)
{
float [] x = new float[61];
float [] y = new float[61];

float b = 0.01*pstrek; // percentage of scaling up (pstrek < 0) or scaling down (pstrek > 0)
int n = min(round(abs(anzpkt)),59);
int m = round(abs(anzstr));
int kk;

for (int i=1; i <= n; i++)
{
x[i] = xwerte[i];
y[i] = ywerte[i];
}
for (int j=1; j <= m; j++)
{
x[0] = x[1];
y[0] = y[1];
for (int k=1; k <= n; k++)
{
kk = (k+1) % (n+1);
line (x[k], y[k], x[kk], y[kk]);
}
for (int k=1; k <= n; k++)
{
kk = (k+1) % (n+1);
x[k] = b*(x[kk] – x[k]) + x[k];
y[k] = b*(y[kk] – y[k]) + y[k];
}
}

} // end of snelin

And this you will get:

snelin_docu-final

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s