Skip to content

Instantly share code, notes, and snippets.

@calvinmetcalf
Created August 29, 2013 11:55
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/6377118 to your computer and use it in GitHub Desktop.
Save calvinmetcalf/6377118 to your computer and use it in GitHub Desktop.
return {
type: "Topology",
bbox: [x0, y0, x1, y1],
transform: {
scale: [1 / kx, 1 / ky],
translate: [x0, y0]
},
objects: objects,
arcs: arcs.map(function(arc) {
var i = 0,
n = arc.length,
point = arc[0],
x1 = point[0], x2, dx,
y1 = point[1], y2, dy,
points = [[x1, y1]];
while (++i < n) {
point = arc[i];
x2 = point[0];
y2 = point[1];
dx = x2 - x1;
dy = y2 - y1;
if (dx || dy) {
points.push([dx, dy]);
x1 = x2, y1 = y2;
}
}
return points;
})
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment