diff --git a/lib/loadObj.js b/lib/loadObj.js index e38465c..293fdc6 100644 --- a/lib/loadObj.js +++ b/lib/loadObj.js @@ -330,7 +330,7 @@ function loadObj(objPath, options) { // Given the cartesian 2 vertices of a polygon, determine if convex function isConvex(positions2D) { - var length = position2D.length; + var length = positions2D.length; var turnDirection = getTurnDirection(positions2D[0], positions2D[1], positions2D[2]); for (var i=1; i < length-2; ++i) { var currentTurnDirection = getTurnDirection(positions2D[i], positions2D[i+1], positions2D[i+2]); @@ -338,11 +338,11 @@ function loadObj(objPath, options) { return false; } } - var currentTurnDirection = getTurnDirection(position2D[length-2], position2D[length-1], position2D[0]); + var currentTurnDirection = getTurnDirection(positions2D[length-2], positions2D[length-1], positions2D[0]); if (turnDirection * currentTurnDirection < 0) { return false; } - currentTurnDirection = getTurnDirection(position2D[length-1], position2D[0], position2D[1]); + currentTurnDirection = getTurnDirection(positions2D[length-1], positions2D[0], positions2D[1]); if (turnDirection * currentTurnDirection < 0) { return false; }