Fix Math mistake in stress calculation
This commit is contained in:
@@ -12,8 +12,8 @@ export function getStress(nodes, distance) {
|
||||
let lowDDist = Math.hypot(target.x - source.x, target.y - source.y);
|
||||
let highDDist = distance(source, target);
|
||||
totalDiffSq += Math.pow(highDDist - lowDDist, 2);
|
||||
totalHighDistSq += highDDist * highDDist;
|
||||
totalLowDDistSq += lowDDist * lowDDist;
|
||||
}
|
||||
}
|
||||
return Math.sqrt(totalDiffSq / totalHighDistSq);
|
||||
return Math.sqrt(totalDiffSq / totalLowDDistSq);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user