Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Created August 29, 2013 02:05
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 calvinmetcalf/6373541 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/6373541 to your computer and use it in GitHub Desktop.
for (var i = 0, m = open ? n : n + 1; i < m; ++i) {
var point = points[(i + k) % n],
p = coincidences.peek(point);
if (!linesEqual(p, t)) {
var tInP = t.every(function(line) { return p.indexOf(line) >= 0; }),
pInT = p.every(function(line) { return t.indexOf(line) >= 0; });
if (tInP) a.push(point);
arc(a);
if (!tInP && !pInT) arc([a[a.length - 1], point]);
if (pInT) a = [a[a.length - 1]];
else a = [];
}
if (!a.length || pointCompare(a[a.length - 1], point)) a.push(point); // skip duplicate points
t = p;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment