SNERKT done :)

Here is the newest recoding 🙂

/** Sne Comp Art: Routine SNE RKT

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

*/

void setup() // Setting up the area for drawing
{
size(400,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 für snerkt */

float x1 = 10.; // Lower boundary for x-ccodinates
float x2 = 370.; // Upper boundary for x-coodinates
float y1 = 10.; // Lower boundary for y-ccordinates
float y2 = 595.; // Upper boundary for y-coordinates
float anzpkt = 1000.; // Maximal number of points
float amplx = 12.; // Maximal distance between two consecutive points in direction of the x-axis
float amply = 18.; // Maximal distance between two consecutive points in direction of the y-axis
float startx; // Start of the number of consecutive lines in the direction of the x-axis
float starty; // Start of the number of consecutive lines in the direction of the y-axis
float period = 12.; // Defines the period of repetition of the number of consecutive lines

for (int i=1; i <= 40; i++)
{
startx = rad(4., 350., 999.);
starty = rad(400., 450., 999.);
snerkt(x1, x2, y1, y2, anzpkt, amplx, amply, startx, starty, period);
}

} // end of draw
void snerkt(float x1, float x2, float y1, float y2, float anzpkt, float amplx, float amply, float startx, float starty, float period)
{
float xl = min(x1,x2);
float xr = max(x1,x2);
float yu = min(y1,y2);
float yo = max(y1,y2);

float x_new = min(max(xl,startx),xr);
float y_new = min(max(yu,starty),yo);
float x_old;
float y_old;

int k = (int) rad(1.1,2.9);
int l = (int)round(abs(anzpkt)) + (int)k – 2;
float h;

for (int i = k; i <= l; i++)
{
x_old = x_new;
y_old = y_new;
h = rad(0., TWO_PI, period);
if (i % 2 == 1)
{
y_new = y_old + sin(h)*amply;
}
else
{
x_new = x_old + sin(h)*amplx;
}
if (x_new >= xr || x_new <= xl || y_new >= yo || y_new <= yu)
{
break;
}
else
{
line(x_old,y_old, x_new, y_new);
}
}
}

/*———————————————————————*/

// Methods for generating random numbers

float [] zzuf = {0., 3.1415926, 3.1415926};
float [] rrad = {0., 3.1415926, 3.1415926, -1., 3.1415926, 3.1415926};
float rrga = 3.1415926;
float pi = 3.1415926;
float e = 2.71828182;

float rad(float von, float bis)
{
zzuf[1] = amod(zzuf[1]*pi + zzuf[2],1.);
zzuf[2] = amod(zzuf[2]*e,1.) + 1.;
return zzuf[1]*abs(von – bis) + min(von,bis);
}

float rad(float von, float bis, float period)
{
float izaehl = 0.;
if (rrad[3] != period)
{
rrad[3] = period;
rrad[4] = rrad[1];
rrad[5] = rrad[2];
izaehl = 0.;
}
izaehl = izaehl + 1.;
if (izaehl >= period)
{
rrad[1] = rrad[4];
rrad[2] = rrad[5];
izaehl = 1.;
}
rrad[1] = amod(rrad[1]*pi + rrad[2],1.);
rrad[2] = amod(rrad[2]*e, 1.) + 1.;
return rrad[1]*abs(von – bis) + min(von, bis);
}

// modulo-calculation for numbers of type float

float amod (float x, float y) // calculates x modulo y
{
while ( x >= y)
{
x = x – y;
}

return x;
}

And this happens, when you use it:

snerkt_docu-final

 

Soon I there will be the documentation online. The “rad” routine makes random numbers. In this example: startx will be in the range between 4 and 350 and sequence repeating after 999 numbers

Advertisements

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