Skip to content

Commit

Permalink
fix latest pedantic lints (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed May 10, 2019
1 parent 52f7691 commit 4b6d6a8
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 72 deletions.
78 changes: 42 additions & 36 deletions lib/src/vector_math/third_party/noise.dart
Expand Up @@ -147,25 +147,25 @@ class SimplexNoise {
final int gi2 = _permMod12[ii + 1 + _perm[jj + 1]];
// Calculate the contribution from the three corners
double t0 = 0.5 - x0 * x0 - y0 * y0;
if (t0 < 0)
if (t0 < 0) {
n0 = 0.0;
else {
} else {
t0 *= t0;
n0 = t0 *
t0 *
_dot2(_grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient
}
double t1 = 0.5 - x1 * x1 - y1 * y1;
if (t1 < 0)
if (t1 < 0) {
n1 = 0.0;
else {
} else {
t1 *= t1;
n1 = t1 * t1 * _dot2(_grad3[gi1], x1, y1);
}
double t2 = 0.5 - x2 * x2 - y2 * y2;
if (t2 < 0)
if (t2 < 0) {
n2 = 0.0;
else {
} else {
t2 *= t2;
n2 = t2 * t2 * _dot2(_grad3[gi2], x2, y2);
}
Expand Down Expand Up @@ -272,30 +272,30 @@ class SimplexNoise {
final int gi3 = _permMod12[ii + 1 + _perm[jj + 1 + _perm[kk + 1]]];
// Calculate the contribution from the four corners
double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0;
if (t0 < 0)
if (t0 < 0) {
n0 = 0.0;
else {
} else {
t0 *= t0;
n0 = t0 * t0 * _dot3(_grad3[gi0], x0, y0, z0);
}
double t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1;
if (t1 < 0)
if (t1 < 0) {
n1 = 0.0;
else {
} else {
t1 *= t1;
n1 = t1 * t1 * _dot3(_grad3[gi1], x1, y1, z1);
}
double t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2;
if (t2 < 0)
if (t2 < 0) {
n2 = 0.0;
else {
} else {
t2 *= t2;
n2 = t2 * t2 * _dot3(_grad3[gi2], x2, y2, z2);
}
double t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3;
if (t3 < 0)
if (t3 < 0) {
n3 = 0.0;
else {
} else {
t3 *= t3;
n3 = t3 * t3 * _dot3(_grad3[gi3], x3, y3, z3);
}
Expand Down Expand Up @@ -331,30 +331,36 @@ class SimplexNoise {
int ranky = 0;
int rankz = 0;
int rankw = 0;
if (x0 > y0)
if (x0 > y0) {
rankx++;
else
} else {
ranky++;
if (x0 > z0)
}
if (x0 > z0) {
rankx++;
else
} else {
rankz++;
if (x0 > w0)
}
if (x0 > w0) {
rankx++;
else
} else {
rankw++;
if (y0 > z0)
}
if (y0 > z0) {
ranky++;
else
} else {
rankz++;
if (y0 > w0)
}
if (y0 > w0) {
ranky++;
else
} else {
rankw++;
if (z0 > w0)
}
if (z0 > w0) {
rankz++;
else
} else {
rankw++;
}
int i1, j1, k1, l1; // The integer offsets for the second simplex corner
int i2, j2, k2, l2; // The integer offsets for the third simplex corner
int i3, j3, k3, l3; // The integer offsets for the fourth simplex corner
Expand Down Expand Up @@ -414,37 +420,37 @@ class SimplexNoise {
_perm[ii + 1 + _perm[jj + 1 + _perm[kk + 1 + _perm[ll + 1]]]] % 32;
// Calculate the contribution from the five corners
double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
if (t0 < 0)
if (t0 < 0) {
n0 = 0.0;
else {
} else {
t0 *= t0;
n0 = t0 * t0 * _dot4(_grad4[gi0], x0, y0, z0, w0);
}
double t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
if (t1 < 0)
if (t1 < 0) {
n1 = 0.0;
else {
} else {
t1 *= t1;
n1 = t1 * t1 * _dot4(_grad4[gi1], x1, y1, z1, w1);
}
double t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
if (t2 < 0)
if (t2 < 0) {
n2 = 0.0;
else {
} else {
t2 *= t2;
n2 = t2 * t2 * _dot4(_grad4[gi2], x2, y2, z2, w2);
}
double t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
if (t3 < 0)
if (t3 < 0) {
n3 = 0.0;
else {
} else {
t3 *= t3;
n3 = t3 * t3 * _dot4(_grad4[gi3], x3, y3, z3, w3);
}
double t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
if (t4 < 0)
if (t4 < 0) {
n4 = 0.0;
else {
} else {
t4 *= t4;
n4 = t4 * t4 * _dot4(_grad4[gi4], x4, y4, z4, w4);
}
Expand Down
78 changes: 42 additions & 36 deletions lib/src/vector_math_64/third_party/noise.dart
Expand Up @@ -147,25 +147,25 @@ class SimplexNoise {
final int gi2 = _permMod12[ii + 1 + _perm[jj + 1]];
// Calculate the contribution from the three corners
double t0 = 0.5 - x0 * x0 - y0 * y0;
if (t0 < 0)
if (t0 < 0) {
n0 = 0.0;
else {
} else {
t0 *= t0;
n0 = t0 *
t0 *
_dot2(_grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient
}
double t1 = 0.5 - x1 * x1 - y1 * y1;
if (t1 < 0)
if (t1 < 0) {
n1 = 0.0;
else {
} else {
t1 *= t1;
n1 = t1 * t1 * _dot2(_grad3[gi1], x1, y1);
}
double t2 = 0.5 - x2 * x2 - y2 * y2;
if (t2 < 0)
if (t2 < 0) {
n2 = 0.0;
else {
} else {
t2 *= t2;
n2 = t2 * t2 * _dot2(_grad3[gi2], x2, y2);
}
Expand Down Expand Up @@ -272,30 +272,30 @@ class SimplexNoise {
final int gi3 = _permMod12[ii + 1 + _perm[jj + 1 + _perm[kk + 1]]];
// Calculate the contribution from the four corners
double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0;
if (t0 < 0)
if (t0 < 0) {
n0 = 0.0;
else {
} else {
t0 *= t0;
n0 = t0 * t0 * _dot3(_grad3[gi0], x0, y0, z0);
}
double t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1;
if (t1 < 0)
if (t1 < 0) {
n1 = 0.0;
else {
} else {
t1 *= t1;
n1 = t1 * t1 * _dot3(_grad3[gi1], x1, y1, z1);
}
double t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2;
if (t2 < 0)
if (t2 < 0) {
n2 = 0.0;
else {
} else {
t2 *= t2;
n2 = t2 * t2 * _dot3(_grad3[gi2], x2, y2, z2);
}
double t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3;
if (t3 < 0)
if (t3 < 0) {
n3 = 0.0;
else {
} else {
t3 *= t3;
n3 = t3 * t3 * _dot3(_grad3[gi3], x3, y3, z3);
}
Expand Down Expand Up @@ -331,30 +331,36 @@ class SimplexNoise {
int ranky = 0;
int rankz = 0;
int rankw = 0;
if (x0 > y0)
if (x0 > y0) {
rankx++;
else
} else {
ranky++;
if (x0 > z0)
}
if (x0 > z0) {
rankx++;
else
} else {
rankz++;
if (x0 > w0)
}
if (x0 > w0) {
rankx++;
else
} else {
rankw++;
if (y0 > z0)
}
if (y0 > z0) {
ranky++;
else
} else {
rankz++;
if (y0 > w0)
}
if (y0 > w0) {
ranky++;
else
} else {
rankw++;
if (z0 > w0)
}
if (z0 > w0) {
rankz++;
else
} else {
rankw++;
}
int i1, j1, k1, l1; // The integer offsets for the second simplex corner
int i2, j2, k2, l2; // The integer offsets for the third simplex corner
int i3, j3, k3, l3; // The integer offsets for the fourth simplex corner
Expand Down Expand Up @@ -414,37 +420,37 @@ class SimplexNoise {
_perm[ii + 1 + _perm[jj + 1 + _perm[kk + 1 + _perm[ll + 1]]]] % 32;
// Calculate the contribution from the five corners
double t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;
if (t0 < 0)
if (t0 < 0) {
n0 = 0.0;
else {
} else {
t0 *= t0;
n0 = t0 * t0 * _dot4(_grad4[gi0], x0, y0, z0, w0);
}
double t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
if (t1 < 0)
if (t1 < 0) {
n1 = 0.0;
else {
} else {
t1 *= t1;
n1 = t1 * t1 * _dot4(_grad4[gi1], x1, y1, z1, w1);
}
double t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
if (t2 < 0)
if (t2 < 0) {
n2 = 0.0;
else {
} else {
t2 *= t2;
n2 = t2 * t2 * _dot4(_grad4[gi2], x2, y2, z2, w2);
}
double t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
if (t3 < 0)
if (t3 < 0) {
n3 = 0.0;
else {
} else {
t3 *= t3;
n3 = t3 * t3 * _dot4(_grad4[gi3], x3, y3, z3, w3);
}
double t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
if (t4 < 0)
if (t4 < 0) {
n4 = 0.0;
else {
} else {
t4 *= t4;
n4 = t4 * t4 * _dot4(_grad4[gi4], x4, y4, z4, w4);
}
Expand Down

0 comments on commit 4b6d6a8

Please sign in to comment.