## I tried to make a cloud chamber.

This generative art was made with Processing.

I wanted to make a cloud chamber. And I failed as always. XP
But it grows beautiful and I love this. I love to play with glowing wire!

## Processing example code (Java).

Please feel free to use this code, if you like it.
To see other works based on my code is my pleasure. And my honor.

```// Confusion.
// Processing 3.2.1
// 2017.08.27

import java.util.Random;

/* ---------------------------------------------------------------------- */
class Utils {

Random obj_random;

Utils() {
obj_random = new Random();
}

float gaussdist(float pmean, float plimit, float pdevi) {
/**
Gaussian distribution
1.parameters.
pmean  : mean value
plimit : max value of abs(deviation)
ex. plimit >= 0
pmean = 0.5, plimit = 0.5 -> return value = from 0.0 to 1.0
pdevi  : standard deviation value
ex. good value? -> pdevi = plimit / 2
2.return.
gaussian distribution
**/

if (plimit == 0) {
return pmean;
}

float gauss = (float) obj_random.nextGaussian() * pdevi;
// not good idea
if (abs(gauss) > plimit) {
gauss = pow(plimit, 2) / gauss;
}

return pmean + gauss;

}
}

/* ---------------------------------------------------------------------- */
Utils ut;

void setup() {
size(900, 900);
colorMode(HSB, 360, 100, 100, 100);
blendMode(SCREEN);
smooth(8);
noLoop();
//  frameRate(1);

ut = new Utils();

}

void draw() {

background(0, 0, 0);
translate(width / 2, height / 2);

drawLines();

saveFrame("frames/####.png");
exit();

}

void canvasRotation(float degrees) {

}

void drawLines() {

// tweak these value
int cntWidthMax = 20;
int divRotate = 5;
int cntRotateMax = 360 * divRotate;
int cntRepeatMax = 5;
int cntLinesMax = 10;
float baseStrokeWeight = 0.008;

float baseColor = map(random(1.0), 0.0, 1.0, 210.0, 270.0);
float shiftX = 0;
float shiftY = 0;

for (int cntLines = 0; cntLines < cntLinesMax; ++cntLines) {

// Shift whole canvas
translate(-shiftX, -shiftY);
canvasRotation(ut.gaussdist(45.0, 10.0, 5.0));
shiftX = ut.gaussdist(0.0, 300.0, 90.0);
shiftY = ut.gaussdist(0.0, 300.0, 30.0);
translate(shiftX, shiftY);

float noiseHueStart = random(100.0);
float noiseSatStart = random(100.0);
float noiseBriStart = random(100.0);
float noiseAlpStart = random(100.0);

float baseDrawEnd = 16.0 + abs(ut.gaussdist(60.0, 30.0, 20.0));
float sinMult = abs(ut.gaussdist(0.0, 1.0, 0.7));
float cosMult = sinMult * round(ut.gaussdist(0.0, 4.0, 2.0));

for (int cntRepeat = 0; cntRepeat < cntRepeatMax; ++cntRepeat) {

float noiseHue = noiseHueStart;
// repeat same shape with different size
float sizShape = (cntRepeat * 0.4 + 0.5) * map(random(1.0), 0.0, 1.0, 1.0, 3.0);

for (int cntWidth = 1; cntWidth <= cntWidthMax; ++cntWidth) {

float noiseSat = noiseSatStart;
float noiseBri = noiseBriStart;
float noiseAlp = noiseAlpStart;
float sumRotation = 0;
// grow the line
strokeWeight(baseStrokeWeight * cntWidth * cntWidth);

for (int cntRotate = 0; cntRotate < cntRotateMax; ++cntRotate) {

float rotation = 1.0 / divRotate;
canvasRotation(rotation);
sumRotation += rotation;

float drawEnd = baseDrawEnd * abs(sin(radians((sumRotation) * sinMult)) + cos(radians((sumRotation) * cosMult)));
float idxW = drawEnd;
float idxH = drawEnd;

float brushHue = (baseColor + 360 + map(noise(noiseHue), 0.0, 1.0, -60.0, 60)) % 360;
float brushSat = map(noise(noiseSat), 0.0, 1.0, 50.0, 100.0);
float brushSiz = map(noise(noiseBri), 0.0, 1.0, 0.0, 1.0);
float brushBri = map(noise(noiseBri), 0.0, 1.0, 0.0, 100.0) / cntWidth;
float brushAlp = map(noise(noiseAlp), 0.0, 1.0, 0.0, 90.0);
noiseHue += 0.0005;
noiseSat += 0.003;
noiseBri += 0.002;
noiseAlp += 0.005;

pushMatrix();
translate(idxW * sizShape, idxH * sizShape);
stroke(brushHue, brushSat, brushBri, brushAlp);
line(0.0, 0.0, -brushSiz, brushSiz);
popMatrix();

}

canvasRotation(-sumRotation);

}
}
}
}

/*

This program is free software: you can redistribute it and/or modify
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>
*/

```