Skip to content

Commit 9f5cfb1

Browse files
committed
fix small bug with spiral curvecount
1 parent e8c1ccb commit 9f5cfb1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/micycle/peasygradients/PeasyGradients.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public final class PeasyGradients {
7373
private static final double HALF_PI = (0.5 * Math.PI);
7474
private static final double INV_TWO_PI = 1 / TWO_PI;
7575
private static final double THREE_QRTR_PI = (0.75 * Math.PI);
76-
private static final double DEFAULT_DITHER = 0.015;
76+
private static final double DEFAULT_DITHER = 0.01;
7777

7878
private static final ExecutorService THREAD_POOL;
7979

@@ -523,7 +523,7 @@ public void spiralGradient(Gradient gradient, PVector centerPoint, double angle,
523523
curveCount *= TWO_PI;
524524

525525
curviness = 1f / curviness;
526-
curviness *= 0.5; // curviness of 1 == exponenent of 0.5
526+
curviness *= 0.5; // curviness of 1 == exponent of 0.5
527527

528528
final double renderMidpointX = (centerPoint.x / gradientPG.width) * renderWidth;
529529
final double renderMidpointY = (centerPoint.y / gradientPG.height) * renderHeight;
@@ -1117,16 +1117,16 @@ public Boolean call() throws Exception {
11171117

11181118
double t;
11191119
double spiralOffset = 0;
1120-
11211120
for (int y = rowOffset; y < rowOffset + rows; y++) {
11221121
double rise = renderMidpointY - y;
11231122
final double riseSquared = rise * rise;
11241123
for (int x = 0; x < gradientPG.width; x++) { // FULL WIDTH
11251124

11261125
double run = renderMidpointX - x;
11271126
t = Functions.fastAtan2b(rise, run) - angle; // -PI...PI
1128-
spiralOffset = curveCount * curviness == 0.5f ? Math.sqrt((riseSquared + run * run) * curveDenominator)
1127+
spiralOffset = curviness == 0.5f ? Math.sqrt((riseSquared + run * run) * curveDenominator)
11291128
: FastPow.fastPow((riseSquared + run * run) * curveDenominator, curviness);
1129+
spiralOffset*=curveCount;
11301130
t += spiralOffset;
11311131

11321132
t *= INV_TWO_PI; // normalise

0 commit comments

Comments
 (0)