kopia lustrzana https://github.com/evil-mad/stipplegen
Removed trailing whitespace
rodzic
b4ac67e787
commit
e71d73533a
|
@ -942,10 +942,10 @@ String makeSpiral ( float xOrigin, float yOrigin, float turns, float radius)
|
|||
{
|
||||
float resolution = 20.0;
|
||||
|
||||
float AngleStep = (TAU / resolution) ;
|
||||
float AngleStep = TAU / resolution;
|
||||
float ScaledRadiusPerTurn = radius / (TAU * turns);
|
||||
|
||||
String spiralSVG = "<path d=\"M " + xOrigin + "," + yOrigin + " "; // Mark center point of spiral
|
||||
String spiralSVG = "<path d=\"M " + xOrigin + "," + yOrigin + " "; // Mark center point of spiral
|
||||
|
||||
float x, y;
|
||||
float angle = 0;
|
||||
|
@ -984,8 +984,8 @@ void draw() {
|
|||
float cutoffScaled = 1 - cutoff;
|
||||
|
||||
if (reInitiallizeArray) {
|
||||
maxParticles = (int)cp5.getController("sliderStipples").getValue(); // Only change this here!
|
||||
|
||||
// Only change maxParticles here!
|
||||
maxParticles = (int)cp5.getController("sliderStipples").getValue();
|
||||
MainArraySetup();
|
||||
reInitiallizeArray = false;
|
||||
}
|
||||
|
@ -1001,11 +1001,11 @@ void draw() {
|
|||
|
||||
// Draw paths:
|
||||
|
||||
if ( showPath ) {
|
||||
stroke(128, 128, 255); // Stroke color (blue)
|
||||
if (showPath) {
|
||||
stroke(128, 128, 255); // Stroke color (blue)
|
||||
strokeWeight (1);
|
||||
|
||||
for ( i = 0; i < (particleRouteLength - 1); ++i) {
|
||||
for (i = 0; i < particleRouteLength - 1; ++i) {
|
||||
Vec2D p1 = particles[particleRoute[i]];
|
||||
Vec2D p2 = particles[particleRoute[i + 1]];
|
||||
line(p1.x, p1.y, p2.x, p2.y);
|
||||
|
@ -1028,30 +1028,24 @@ void draw() {
|
|||
if (invertImg) v = 1 - v;
|
||||
|
||||
if (fillingCircles) {
|
||||
strokeWeight (maxDotSize - v * dotScale);
|
||||
strokeWeight(maxDotSize - v * dotScale);
|
||||
point(px, py);
|
||||
} else {
|
||||
float DotSize = (maxDotSize - v * dotScale);
|
||||
ellipse(px, py, DotSize, DotSize);
|
||||
float dotSize = maxDotSize - v * dotScale;
|
||||
ellipse(px, py, dotSize, dotSize);
|
||||
}
|
||||
}
|
||||
} else { // NOT in pause mode. i.e., just displaying stipples.
|
||||
if (cellsCalculated == 0) {
|
||||
doBackgrounds();
|
||||
|
||||
if (generation == 0) {
|
||||
tempShowCells = true;
|
||||
}
|
||||
tempShowCells = generation == 0;
|
||||
|
||||
if (showCells || tempShowCells) { // Draw voronoi cells, over background.
|
||||
strokeWeight(1);
|
||||
noFill();
|
||||
|
||||
if (invertImg && !showBG) {
|
||||
stroke(100);
|
||||
} else {
|
||||
stroke(200);
|
||||
}
|
||||
stroke(invertImg && !showBG ? 100 : 200);
|
||||
|
||||
i = 0;
|
||||
for (Polygon2D poly : voronoi.getRegions()) {
|
||||
|
@ -1063,11 +1057,11 @@ void draw() {
|
|||
if (showCells) {
|
||||
// Show "before and after" centroids, when polygons are shown.
|
||||
|
||||
strokeWeight (minDotSize); // Normal w/ Min & Max dot size
|
||||
strokeWeight(minDotSize); // Normal w/ Min & Max dot size
|
||||
for ( i = 0; i < maxParticles; ++i) {
|
||||
|
||||
int px = (int) particles[i].x;
|
||||
int py = (int) particles[i].y;
|
||||
int px = (int)particles[i].x;
|
||||
int py = (int)particles[i].y;
|
||||
|
||||
if ((px >= imgblur.width) || (py >= imgblur.height) || (px < 0) || (py < 0))
|
||||
continue;
|
||||
|
@ -1089,19 +1083,13 @@ void draw() {
|
|||
tempShowCells = false;
|
||||
}
|
||||
|
||||
if (invertImg) {
|
||||
stroke(255);
|
||||
fill(0);
|
||||
} else {
|
||||
stroke(0);
|
||||
fill(255);
|
||||
}
|
||||
|
||||
stroke(invertImg ? 255 : 0);
|
||||
fill(invertImg ? 0 : 255);
|
||||
strokeWeight(1);
|
||||
|
||||
for ( i = cellsCalculatedLast; i < cellsCalculated; ++i) {
|
||||
int px = (int) particles[i].x;
|
||||
int py = (int) particles[i].y;
|
||||
for (i = cellsCalculatedLast; i < cellsCalculated; ++i) {
|
||||
int px = (int)particles[i].x;
|
||||
int py = (int)particles[i].y;
|
||||
|
||||
if ((px >= imgblur.width) || (py >= imgblur.height) || (px < 0) || (py < 0))
|
||||
continue;
|
||||
|
@ -1111,12 +1099,12 @@ void draw() {
|
|||
if (invertImg) v = 1 - v;
|
||||
|
||||
if (v < cutoffScaled) {
|
||||
if (fillingCircles) {
|
||||
strokeWeight (maxDotSize - v * dotScale);
|
||||
if (fillingCircles) {
|
||||
strokeWeight(maxDotSize - v * dotScale);
|
||||
point(px, py);
|
||||
} else {
|
||||
float DotSize = (maxDotSize - v * dotScale);
|
||||
ellipse(px, py, DotSize, DotSize);
|
||||
float dotSize = maxDotSize - v * dotScale;
|
||||
ellipse(px, py, dotSize, dotSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1127,7 +1115,7 @@ void draw() {
|
|||
}
|
||||
|
||||
noStroke();
|
||||
fill(100); // Background fill color
|
||||
fill(100); // Background fill color
|
||||
rect(0, mainheight, mainwidth, height); // Control area fill
|
||||
|
||||
// Underlay for hyperlink:
|
||||
|
@ -1136,7 +1124,7 @@ void draw() {
|
|||
rect(textColumnStart - 10, mainheight + 35, 205, 20);
|
||||
}
|
||||
|
||||
fill(255); // Text color
|
||||
fill(255); // Text color
|
||||
|
||||
text("StippleGen 2 (v. 2.4.0)", textColumnStart, mainheight + 15);
|
||||
text("by Evil Mad Scientist Laboratories", textColumnStart, mainheight + 30);
|
||||
|
@ -1146,7 +1134,7 @@ void draw() {
|
|||
text("Time/Frame: " + frameTime + " s", textColumnStart, mainheight + 100);
|
||||
|
||||
if (errorDisp) {
|
||||
fill(255, 0, 0); // Text color
|
||||
fill(255, 0, 0); // Text color
|
||||
text(errorDisplay, textColumnStart, mainheight + 70);
|
||||
errorDisp = !(millis() - errorTime > 8000);
|
||||
} else {
|
||||
|
@ -1162,8 +1150,8 @@ void draw() {
|
|||
String rowTemp;
|
||||
|
||||
float SVGscale = (800.0 / (float) mainheight);
|
||||
int xOffset = (int) (1600 - (SVGscale * mainwidth / 2));
|
||||
int yOffset = (int) (400 - (SVGscale * mainheight / 2));
|
||||
int xOffset = (int)(1600 - (SVGscale * mainwidth / 2));
|
||||
int yOffset = (int)(400 - (SVGscale * mainheight / 2));
|
||||
|
||||
if (fileModeTSP) { // Plot the PATH between the points only.
|
||||
println("Save TSP File (SVG)");
|
||||
|
@ -1172,11 +1160,11 @@ void draw() {
|
|||
rowTemp = "<path style=\"fill:none;stroke:black;stroke-width:2px;stroke-linejoin:round;stroke-linecap:round;\" d=\"M ";
|
||||
fileOutput = append(fileOutput, rowTemp);
|
||||
|
||||
for ( i = 0; i < particleRouteLength; ++i) {
|
||||
for (i = 0; i < particleRouteLength; ++i) {
|
||||
Vec2D p1 = particles[particleRoute[i]];
|
||||
|
||||
float xTemp = SVGscale*p1.x + xOffset;
|
||||
float yTemp = SVGscale*p1.y + yOffset;
|
||||
float xTemp = SVGscale * p1.x + xOffset;
|
||||
float yTemp = SVGscale * p1.y + yOffset;
|
||||
|
||||
rowTemp = xTemp + " " + yTemp + "\r";
|
||||
fileOutput = append(fileOutput, rowTemp);
|
||||
|
@ -1185,23 +1173,23 @@ void draw() {
|
|||
} else {
|
||||
println("Save Stipple File (SVG)");
|
||||
|
||||
for ( i = 0; i < particleRouteLength; ++i) {
|
||||
for (i = 0; i < particleRouteLength; ++i) {
|
||||
Vec2D p1 = particles[particleRoute[i]];
|
||||
|
||||
int px = floor(p1.x);
|
||||
int py = floor(p1.y);
|
||||
|
||||
float v = (brightness(imgblur.pixels[ py*imgblur.width + px ]))/255;
|
||||
float v = (brightness(imgblur.pixels[py * imgblur.width + px])) / 255;
|
||||
|
||||
if (invertImg) v = 1 - v;
|
||||
|
||||
float dotrad = (maxDotSize - v * dotScale) / 2;
|
||||
float dotrad = (maxDotSize - v * dotScale) / 2;
|
||||
|
||||
float xTemp = SVGscale*p1.x + xOffset;
|
||||
float yTemp = SVGscale*p1.y + yOffset;
|
||||
float xTemp = SVGscale * p1.x + xOffset;
|
||||
float yTemp = SVGscale * p1.y + yOffset;
|
||||
|
||||
if (fillingCircles) {
|
||||
rowTemp = makeSpiral ( xTemp, yTemp, dotrad / 2.0, dotrad);
|
||||
rowTemp = makeSpiral(xTemp, yTemp, dotrad / 2.0, dotrad);
|
||||
} else {
|
||||
rowTemp = "<circle cx=\"" + xTemp + "\" cy=\"" + yTemp + "\" r=\"" + dotrad + "\"/> ";
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue