deviant ART

[x]

Cantor's Sets by ~scvalex:iconscvalex:


Creative Commons License
Some rights reserved. This work is licensed under a
Creative Commons Attribution 3.0 License.
Details
Submitted: February 4
File Size: 105 KB
Image Size: 105 KB
Resolution: 600×443
Comments: 0
Favourites & Collections: 0

Views
Total: 301
Today: 0

Downloads
Total: 6
Today: 0

Embed


Thumb

Artist's Comments

This is simple fractal generated using the following Processing programme:

--- BEGIN PROCESSING CODE ---
int setHeight = 60;
color setColour = color(184 + random(-40, 40),
124 + random(-40, 40),
124 + random(-40, 40));
int wid = 600;

void setup() {
size(wid, (int)((log(wid) / log(3) + 1) * (setHeight + 5)));
background(0);
smooth();

cantorSet(10, 10, width - 20, setColour);

save("cantorSet.png");
}

float rnd(float x) {
return x + random(-20, 20);
}

void brushRect(int x, int y, int w, int h) {
for (int i = 0; i < h; ++i) {
float r = random(3);
strokeWeight(r);
float downpull = random(h / 4);
float shudder = random(-2, 2);
line(x + shudder, y + i, x + w - shudder, y + i + downpull);
}
}

void cantorSet(int y, int offX, int wid, color col) {
if ((y > height - 10) || (wid < 1))
return;

stroke(col);
brushRect(offX, y, wid, setHeight);
//fill(col);
//rect(offX, y, wid, setHeight);

color newCol = color(rnd(red(col)), rnd(green(col)),
rnd(blue(col)));
cantorSet(y + setHeight + 5, offX, wid / 3, newCol);
cantorSet(y + setHeight + 5, offX + wid*2/3, wid / 3, newCol);
}
--- END PROCESSING CODE ---

Devious Comments

love 0 0 joy 0 0 wow 0 0 mad 0 0 sad 0 0 fear 0 0 neutral 0 0

No comments have been added yet.