Formatting
diff --git a/lib/src/vector_math/aabb3.dart b/lib/src/vector_math/aabb3.dart
index d1b65cc..6540f2b 100644
--- a/lib/src/vector_math/aabb3.dart
+++ b/lib/src/vector_math/aabb3.dart
@@ -319,7 +319,8 @@
}
/// Return if [this] contains [other].
- bool containsTriangle(Triangle other) => containsVector3(other._point0) &&
+ bool containsTriangle(Triangle other) =>
+ containsVector3(other._point0) &&
containsVector3(other._point1) &&
containsVector3(other._point2);
diff --git a/lib/src/vector_math/obb3.dart b/lib/src/vector_math/obb3.dart
index 5ac8480..d64834d 100644
--- a/lib/src/vector_math/obb3.dart
+++ b/lib/src/vector_math/obb3.dart
@@ -238,8 +238,9 @@
rb = other._halfExtents[i];
if ((_t[0] * _r.entry(0, i) +
- _t[1] * _r.entry(1, i) +
- _t[2] * _r.entry(2, i)).abs() >
+ _t[1] * _r.entry(1, i) +
+ _t[2] * _r.entry(2, i))
+ .abs() >
ra + rb) {
return false;
}
diff --git a/lib/src/vector_math/third_party/noise.dart b/lib/src/vector_math/third_party/noise.dart
index e1ad9f0..517586c 100644
--- a/lib/src/vector_math/third_party/noise.dart
+++ b/lib/src/vector_math/third_party/noise.dart
@@ -149,7 +149,8 @@
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) n0 = 0.0;
+ if (t0 < 0)
+ n0 = 0.0;
else {
t0 *= t0;
n0 = t0 *
@@ -157,13 +158,15 @@
_dot2(_grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient
}
double t1 = 0.5 - x1 * x1 - y1 * y1;
- if (t1 < 0) n1 = 0.0;
+ if (t1 < 0)
+ n1 = 0.0;
else {
t1 *= t1;
n1 = t1 * t1 * _dot2(_grad3[gi1], x1, y1);
}
double t2 = 0.5 - x2 * x2 - y2 * y2;
- if (t2 < 0) n2 = 0.0;
+ if (t2 < 0)
+ n2 = 0.0;
else {
t2 *= t2;
n2 = t2 * t2 * _dot2(_grad3[gi2], x2, y2);
@@ -270,25 +273,29 @@
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) n0 = 0.0;
+ if (t0 < 0)
+ n0 = 0.0;
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) n1 = 0.0;
+ if (t1 < 0)
+ n1 = 0.0;
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) n2 = 0.0;
+ if (t2 < 0)
+ n2 = 0.0;
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) n3 = 0.0;
+ if (t3 < 0)
+ n3 = 0.0;
else {
t3 *= t3;
n3 = t3 * t3 * _dot3(_grad3[gi3], x3, y3, z3);
@@ -325,18 +332,30 @@
int ranky = 0;
int rankz = 0;
int rankw = 0;
- if (x0 > y0) rankx++;
- else ranky++;
- if (x0 > z0) rankx++;
- else rankz++;
- if (x0 > w0) rankx++;
- else rankw++;
- if (y0 > z0) ranky++;
- else rankz++;
- if (y0 > w0) ranky++;
- else rankw++;
- if (z0 > w0) rankz++;
- else rankw++;
+ if (x0 > y0)
+ rankx++;
+ else
+ ranky++;
+ if (x0 > z0)
+ rankx++;
+ else
+ rankz++;
+ if (x0 > w0)
+ rankx++;
+ else
+ rankw++;
+ if (y0 > z0)
+ ranky++;
+ else
+ rankz++;
+ if (y0 > w0)
+ ranky++;
+ else
+ rankw++;
+ if (z0 > w0)
+ rankz++;
+ 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
@@ -395,31 +414,36 @@
_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) n0 = 0.0;
+ if (t0 < 0)
+ n0 = 0.0;
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) n1 = 0.0;
+ if (t1 < 0)
+ n1 = 0.0;
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) n2 = 0.0;
+ if (t2 < 0)
+ n2 = 0.0;
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) n3 = 0.0;
+ if (t3 < 0)
+ n3 = 0.0;
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) n4 = 0.0;
+ if (t4 < 0)
+ n4 = 0.0;
else {
t4 *= t4;
n4 = t4 * t4 * _dot4(_grad4[gi4], x4, y4, z4, w4);
diff --git a/lib/src/vector_math_64/aabb3.dart b/lib/src/vector_math_64/aabb3.dart
index 36fed78..8c0eed2 100644
--- a/lib/src/vector_math_64/aabb3.dart
+++ b/lib/src/vector_math_64/aabb3.dart
@@ -319,7 +319,8 @@
}
/// Return if [this] contains [other].
- bool containsTriangle(Triangle other) => containsVector3(other._point0) &&
+ bool containsTriangle(Triangle other) =>
+ containsVector3(other._point0) &&
containsVector3(other._point1) &&
containsVector3(other._point2);
diff --git a/lib/src/vector_math_64/obb3.dart b/lib/src/vector_math_64/obb3.dart
index c63b57e..2380340 100644
--- a/lib/src/vector_math_64/obb3.dart
+++ b/lib/src/vector_math_64/obb3.dart
@@ -238,8 +238,9 @@
rb = other._halfExtents[i];
if ((_t[0] * _r.entry(0, i) +
- _t[1] * _r.entry(1, i) +
- _t[2] * _r.entry(2, i)).abs() >
+ _t[1] * _r.entry(1, i) +
+ _t[2] * _r.entry(2, i))
+ .abs() >
ra + rb) {
return false;
}
diff --git a/lib/src/vector_math_64/third_party/noise.dart b/lib/src/vector_math_64/third_party/noise.dart
index b94d2ec..7d81c6a 100644
--- a/lib/src/vector_math_64/third_party/noise.dart
+++ b/lib/src/vector_math_64/third_party/noise.dart
@@ -149,7 +149,8 @@
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) n0 = 0.0;
+ if (t0 < 0)
+ n0 = 0.0;
else {
t0 *= t0;
n0 = t0 *
@@ -157,13 +158,15 @@
_dot2(_grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient
}
double t1 = 0.5 - x1 * x1 - y1 * y1;
- if (t1 < 0) n1 = 0.0;
+ if (t1 < 0)
+ n1 = 0.0;
else {
t1 *= t1;
n1 = t1 * t1 * _dot2(_grad3[gi1], x1, y1);
}
double t2 = 0.5 - x2 * x2 - y2 * y2;
- if (t2 < 0) n2 = 0.0;
+ if (t2 < 0)
+ n2 = 0.0;
else {
t2 *= t2;
n2 = t2 * t2 * _dot2(_grad3[gi2], x2, y2);
@@ -270,25 +273,29 @@
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) n0 = 0.0;
+ if (t0 < 0)
+ n0 = 0.0;
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) n1 = 0.0;
+ if (t1 < 0)
+ n1 = 0.0;
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) n2 = 0.0;
+ if (t2 < 0)
+ n2 = 0.0;
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) n3 = 0.0;
+ if (t3 < 0)
+ n3 = 0.0;
else {
t3 *= t3;
n3 = t3 * t3 * _dot3(_grad3[gi3], x3, y3, z3);
@@ -325,18 +332,30 @@
int ranky = 0;
int rankz = 0;
int rankw = 0;
- if (x0 > y0) rankx++;
- else ranky++;
- if (x0 > z0) rankx++;
- else rankz++;
- if (x0 > w0) rankx++;
- else rankw++;
- if (y0 > z0) ranky++;
- else rankz++;
- if (y0 > w0) ranky++;
- else rankw++;
- if (z0 > w0) rankz++;
- else rankw++;
+ if (x0 > y0)
+ rankx++;
+ else
+ ranky++;
+ if (x0 > z0)
+ rankx++;
+ else
+ rankz++;
+ if (x0 > w0)
+ rankx++;
+ else
+ rankw++;
+ if (y0 > z0)
+ ranky++;
+ else
+ rankz++;
+ if (y0 > w0)
+ ranky++;
+ else
+ rankw++;
+ if (z0 > w0)
+ rankz++;
+ 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
@@ -395,31 +414,36 @@
_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) n0 = 0.0;
+ if (t0 < 0)
+ n0 = 0.0;
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) n1 = 0.0;
+ if (t1 < 0)
+ n1 = 0.0;
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) n2 = 0.0;
+ if (t2 < 0)
+ n2 = 0.0;
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) n3 = 0.0;
+ if (t3 < 0)
+ n3 = 0.0;
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) n4 = 0.0;
+ if (t4 < 0)
+ n4 = 0.0;
else {
t4 *= t4;
n4 = t4 * t4 * _dot4(_grad4[gi4], x4, y4, z4, w4);
diff --git a/test/matrix4_test.dart b/test/matrix4_test.dart
index eee6759..37bd105 100644
--- a/test/matrix4_test.dart
+++ b/test/matrix4_test.dart
@@ -601,17 +601,16 @@
bool exception = false;
try {
new Matrix4.inverted(new Matrix4.zero());
- expect(false, isTrue); // don't hit here.
+ expect(false, isTrue); // don't hit here.
} catch (ArgumentError) {
exception = true;
}
expect(exception, isTrue);
expect(new Matrix4.inverted(new Matrix4.identity()),
- equals(new Matrix4.identity()));
+ equals(new Matrix4.identity()));
}
-
void main() {
group('Matrix4', () {
test('instancing from Float32List', testMatrix4InstacingFromFloat32List);