Better variables scoping

This commit is contained in:
Frederic Junod
2018-01-17 09:05:39 +01:00
parent ee348c50e9
commit 4c5ca75ca6
21 changed files with 93 additions and 147 deletions
+2 -4
View File
@@ -45,12 +45,10 @@ Point.prototype.clone = function() {
*/
Point.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDistance) {
const flatCoordinates = this.flatCoordinates;
const squaredDistance = squaredDx(
x, y, flatCoordinates[0], flatCoordinates[1]);
const squaredDistance = squaredDx(x, y, flatCoordinates[0], flatCoordinates[1]);
if (squaredDistance < minSquaredDistance) {
const stride = this.stride;
let i;
for (i = 0; i < stride; ++i) {
for (let i = 0; i < stride; ++i) {
closestPoint[i] = flatCoordinates[i];
}
closestPoint.length = stride;