Commit 1ae6fbe08f10ec5e8ad4adafc545d8fc6fefee4c

Authored by David Mayerich
1 parent bd78d658

error fixes in network.py and added a bounding box method

Showing 1 changed file with 18 additions and 3 deletions   Show diff stats
@@ -22,6 +22,9 @@ class Node: @@ -22,6 +22,9 @@ class Node:
22 self.o = outgoing 22 self.o = outgoing
23 self.i = incoming 23 self.i = incoming
24 24
  25 +# def p():
  26 +# return self.p
  27 +
25 ''' 28 '''
26 Definition of the Fiber class. 29 Definition of the Fiber class.
27 Duplicate of the Node class in network 30 Duplicate of the Node class in network
@@ -213,7 +216,7 @@ def importNWT(str): @@ -213,7 +216,7 @@ def importNWT(str):
213 edge = readFiber(file) 216 edge = readFiber(file)
214 fiberList.append(edge) 217 fiberList.append(edge)
215 218
216 - exportNWT("/home/pavel/Documents/Python/NetLayout/from_python_seg.nwt", nodeList, fiberList) 219 + #exportNWT("/home/pavel/Documents/Python/NetLayout/from_python_seg.nwt", nodeList, fiberList)
217 print(str) 220 print(str)
218 return nodeList, fiberList; 221 return nodeList, fiberList;
219 222
@@ -270,11 +273,23 @@ def getCircularLayout(graph, dim, radius): @@ -270,11 +273,23 @@ def getCircularLayout(graph, dim, radius):
270 Return the positions dictionary for the Spring layout. 273 Return the positions dictionary for the Spring layout.
271 ''' 274 '''
272 def getSpringLayout(graph, pos, iterations, scale): 275 def getSpringLayout(graph, pos, iterations, scale):
273 - return nx.spring_layout(graph, 2, None, pos, iterations, weight='weight', scale, None) 276 + return nx.spring_layout(graph, 2, None, pos, iterations, 'weight', scale, None)
274 277
275 ''' 278 '''
276 Draws the graph. 279 Draws the graph.
277 ''' 280 '''
278 def drawGraph(graph, pos): 281 def drawGraph(graph, pos):
279 nx.draw(graph, pos) 282 nx.draw(graph, pos)
280 - return  
281 \ No newline at end of file 283 \ No newline at end of file
  284 + return
  285 +
  286 +def aabb(nodeList, edgeList):
  287 +
  288 + lower = nodeList[0].p.copy()
  289 + upper = lower.copy()
  290 + for i in nodeList:
  291 + for c in range(len(lower)):
  292 + if lower[c] > i.p[c]:
  293 + lower[c] = i.p[c]
  294 + if upper[c] < i.p[c]:
  295 + upper[c] = i.p[c]
  296 + return lower, upper