Changeset 12330
- Timestamp:
- 07/05/2009 04:04:43 PM (14 months ago)
- File:
-
- 1 edited
-
trunk/projects/kdtree-tests/tree-figs.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/projects/kdtree-tests/tree-figs.py
r12327 r12330 26 26 endfig() 27 27 28 28 29 def get_axis_sizes(levels): 29 30 # x offset … … 32 33 # y offset 33 34 Hoff = 0.0025 34 Hspace = 0.03 35 #Hspace = 0.03 36 Hspace = 0.01 35 37 Haxes = ((1. - 2*Hoff) - (levels-1)*Hspace) / float(levels) 36 38 #print 'Haxes', Haxes, 'Waxes', Waxes, 'Hspace', Hspace … … 77 79 xticks([],[]) 78 80 yticks([],[]) 79 axis('equal')81 #axis('equal') 80 82 axis(ax) 81 83 gca().frame.set_edgecolor('0.5') … … 85 87 a = gcf().add_axes([0,0,1,1], axisbg='r') 86 88 a.set_frame_on(False) 89 90 #for lev in range(levels): 91 # (x1,y1) = transform(lev, ax[0], ax[2]) 92 # (x2,y2) = transform(lev, ax[1], ax[3]) 93 # plot([x1,x2],[y1,y2], 'r.-') 87 94 for lev in range(levels-1): 88 95 bbparents = bboxes[lev] … … 94 101 (cx, cy) = transform(lev+1, (bbchild [0]+bbchild [2])/2, (bbchild [1]+bbchild [3])/2) 95 102 # nothing is quite as much fun as doing your own line clipping... 96 # (so that the connecting lines come from the centers of the boxes )103 # (so that the connecting lines come from the centers of the boxes but end at the box edges) 97 104 (nilx, clip_py) = transform(lev, 0, bbparent[1]) 98 105 (nilx, clip_cy) = transform(lev+1, 0, bbchild [3]) … … 101 108 clip1 = (clip_py - py) / dy 102 109 clip2 = (clip_cy - py) / dy 103 110 #plot([px,cx], [py,cy], 'r-') 104 111 plot([px + clip1*dx, px + clip2*dx], 105 112 [py + clip1*dy, py + clip2*dy], … … 158 165 xticks([],[]) 159 166 yticks([],[]) 160 axis('equal')167 #axis('equal') 161 168 axis(ax) 162 169 gca().frame.set_edgecolor('0.5') … … 180 187 plot([o[0], o[2]], [sval, sval], **style) 181 188 182 axis('equal')189 #axis('equal') 183 190 axis(ax) 184 191 … … 197 204 #plot_bboxes(data, t.bboxes, 6, [-0.03, 1.03, -0.03, 1.03]) 198 205 199 #plot_bbox_tree(data, t.bboxes, 4) 200 206 plot_bbox_tree(data, t.bboxes, 4) 201 207 rootbb = (t.bboxes[0])[0] 202 208 plot_split_tree(data, rootbb, t.splits, 4) 203 209 204 sys.exit(0) 205 210
Note: See TracChangeset
for help on using the changeset viewer.
