แก้ coding style ภาค 2

This commit is contained in:
Pitchaya Boonsarngsuk
2018-03-22 16:12:25 +00:00
parent 2256af7448
commit 0cdd927444
12 changed files with 160 additions and 130 deletions

View File

@@ -4,10 +4,10 @@
* to the better layout.
* @return {number} - stress of the layout.
*/
export function getStress(nodes, distance) {
let sumDiffSq = 0
export function getStress (nodes, distance) {
let sumDiffSq = 0;
let sumLowDDistSq = 0;
for (let j = nodes.length-1; j >= 1; j--) {
for (let j = nodes.length - 1; j >= 1; j--) {
for (let i = 0; i < j; i++) {
let source = nodes[i], target = nodes[j];
let lowDDist = Math.hypot(target.x - source.x, target.y - source.y);