Skip to content

Instantly share code, notes, and snippets.

View shashashasha's full-sized avatar

Sha Hwang shashashasha

View GitHub Profile
@shashashasha
shashashasha / circlepacker.js
Created June 11, 2011 00:50
Circle Packing
// based off of http://labs.unwieldy.net/moocirclepack/
org.polymaps.packer = function() {
var packer = {},
nodes = [],
elements = [],
timesToPack = 50;
packer.elements = function(e) {
if (!arguments.length) {
return elements;
org.polymaps.paths = function() {
var paths = org.polymaps.geoJson(),
mode = "arc", // or "line"
storedPaths = [];
// a and b are location objects, c is the optional class to apply to them
paths.connect = function(a, b, c) {
var locations = [];
locations.push([a.lon, a.lat]);