Skip to content

Instantly share code, notes, and snippets.

@nevernormal1
Created May 26, 2016 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevernormal1/5be1b977a18792004daac635928db43e to your computer and use it in GitHub Desktop.
Save nevernormal1/5be1b977a18792004daac635928db43e to your computer and use it in GitHub Desktop.
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