Skip to content
Snippets Groups Projects
Select Git revision
  • 8b36b0a7f7474b63aed0dd2b90a94e86534f0adc
  • master default protected
  • jiri-skrobanek/persistence
  • om-graphs
  • vk-dynamic
  • fs-succinct
  • pm-streaming
7 results

bins-example.asy

Blame
  • bins-example.asy 546 B
    import ads;
    
    pair v[];
    v[0] = (0,0);
    int p[];
    p[0] = -1;
    
    real edge_len = 0.5;
    real dists[] = { 0, 1.5, 3, 5, 7.7 };
    real dirs[] = { -45, 45, 65, 78.5 };
    
    for (int i=0; i<5; ++i) {
    	pair w[];
    	int n = v.length;
    	for (int j=0; j<n; ++j)
    		w[j] = v[j] + (dists[i],0);
    	graph(w);
    	for (int j=1; j<n; ++j)
    		edge(j, p[j]);
    	label("\strut $B_{" + (string)i + "}$", (dists[i], 0.5));
    	if (i == 4)
    		break;
    
    	for (int j=0; j<n; ++j) {
    		pair d = (0,1) * dir(dirs[i]);
    		d = d * (-edge_len/d.y);
    		v[n+j] = v[j] + d;
    		p[n+j] = p[j] + n;
    	}
    	p[n] = 0;
    }