แก้ coding style
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -40,8 +40,7 @@ export function takeSampleFrom(sourceList, amount) {
|
||||
sample: remainder,
|
||||
remainder: randElements
|
||||
};
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return {
|
||||
sample: randElements,
|
||||
remainder: remainder
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user