SNE KAO

Dietrich M. Scheringer hat für recodeproject.com die Routine SNE KAO unter Processing realisiert …

Hier ist der Quellcode:

/** Sne Comp Art: Routine SNE KAO

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

*/

void setup() // Setting up the area for drawing
{
size(400,600); // defines the dimension of the display window in units of pixels
background(0); // backround colour: black
stroke(255); // colour of the lines: white
noLoop(); // execute method draw only once
}

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

float startx = 20.; // starting point in direction of x-axis
float starty = 60.; // starting point in direction of y-axis
float anzinx = 6.; // number of fields in direction of x-axis
float anziny = 12.; // number of fields in direction of y-axis
float feldlx = 50.; // field lenght in direction of x-axis
float feldly = 30.; // field length in direction of y-axis

float anzstr = 10.; // number of lines per field
float pwaag = 40.; // percentage of fields filled with horizontal lines
float psenk = 55.; // percentage of fields filled with vertical lines
// pwaag + psenk <= 100. !

snekao(startx, starty, anzinx, anziny, feldlx, feldly, anzstr, pwaag, psenk);
}
//——————————————————————————–

void snekao(float startx, float starty, float anzinx, float anziny, float feldlx, float feldly, float anzstr, float pwaag, float psenk)

{
float strtx = 0.; // local variables
float strty = 0.;
float start = 0.;
float delta = 0.;
float h = 0.;

int istr = round(abs(anzstr));
int inx = round(abs(anzinx));
int iny = round(abs(anziny));
float pdicht = pwaag + psenk;

if (istr == 0)
{
pdicht = 0.;
}

for (int i=1; i <= iny; i++)
{
strty = float(i-1)*feldly + starty;
for (int j=1; j <= inx; j++)
{
strtx = float(j-1)*feldlx + startx;
h = random(0.00001,100.);
if (h > pdicht)
{
continue; // next loop
}
else if (h > pwaag)
{
delta = feldlx/float(istr);
start = strtx;
for (int k=1; k <= istr; k++)
{
line(start, strty+feldly,start, strty);
start += delta;
}
}
else
{
delta = feldly/float(istr);
start = strty;
for (int m=1; m <= istr; m++)
{
line(strtx+feldlx,start,strtx,start);
start += delta;
}
} // end of if … else if … else …
} // end of inner for-loop
} // end of outer for-loop
} // end of snekao

Dieser Code geht in Processing direkt. Dazu die Software von processing.org downloaden. Dann den SNEKAO “Scetch” laden und los geht es.

processing_snekao_open

Das Ganze sieht dann etwa so aus:

snekao_docu-final

Zum Vergrößern einfach auf das Bild klicken.

Der SNEKAO Scetch kann auch online unter recodeproject.com direkt genutzt werden. Ein Herunterrladen der Processing Software auf Ihren PC ist dann nicht erforderlich:

Einfach eine andere Umsetzung nehmen und diese im Edit-Fenster überschreiben. So sieht das dann in etwa aus:

snekao_edit_in_recodeproject

Leave a comment