Created
May 26, 2016 23:56
-
-
Save nevernormal1/5be1b977a18792004daac635928db43e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var closeVolume = function(pathVolume) { | |
var firstPoint, lastPoint, points; | |
if (pathVolume === null) { | |
return null; | |
} | |
points = pathVolume.shape.points; | |
if (points.length < 2) { | |
return pathVolume; | |
} | |
firstPoint = points[0]; | |
lastPoint = points[points.length - 1]; | |
if (firstPoint.x !== lastPoint.x || firstPoint.y !== lastPoint.y || firstPoint.lh !== lastPoint.lh || firstPoint.rh !== lastPoint.rh) { | |
points.push(firstPoint); | |
} | |
return pathVolume; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment