แก้ coding style

This commit is contained in:
Pitchaya Boonsarngsuk
2018-03-22 16:02:45 +00:00
parent b601af68b4
commit 2256af7448
9 changed files with 866 additions and 873 deletions

View File

@@ -52,10 +52,7 @@ export default function() {
quad.data = children[Math.floor(Math.random() * children.length)];
quad.x = quad.data.x;
quad.y = quad.data.y;
}
// For leaf nodes, accumulate forces from coincident quadrants.
else {
} else { // For leaf nodes, accumulate forces from coincident quadrants.
q = quad;
q.x = q.data.x;
q.y = q.data.y;
@@ -93,10 +90,7 @@ export default function() {
node.vy += y;
}
return true;
}
// Otherwise, process points directly.
else if (quad.length) return;
} else if (quad.length) return; // Otherwise, process points directly.
// Limit forces for very close nodes; randomize direction if coincident.
if (quad.data !== node || quad.next) {

View File

@@ -40,8 +40,7 @@ export function takeSampleFrom(sourceList, amount) {
sample: remainder,
remainder: randElements
};
}
else {
} else {
return {
sample: randElements,
remainder: remainder

View File

@@ -55,15 +55,13 @@ export function placeNearToNearestNeighbour(node, nearNeighbour, radius, sampleS
lowBound = 90;
highBound = 180;
}
} else {
if (dist90 > dist270) {
} else if (dist90 > dist270) {
lowBound = 270;
highBound = 360;
} else {
lowBound = 0;
highBound = 90;
}
}
// Determine the angle
let angle = binarySearchMin(lowBound, highBound, sumDistErrorByAngle);

View File

@@ -53,7 +53,9 @@ export default function() {
let u = 2 * Math.random() - 1;
let v = 2 * Math.random() - 1;
let r = u * u + v * v;
if (r == 0 || r > 1) {return gaussRandom();}
if (r == 0 || r > 1) {
return gaussRandom();
}
return u * Math.sqrt(-2 * Math.log(r) / r);
}