-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAATC_Create_Graph.py
More file actions
75 lines (39 loc) · 1.63 KB
/
AATC_Create_Graph.py
File metadata and controls
75 lines (39 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#Create graph module
import decimal,AATC_AStar,AATC_Coordinate
def drange(start,end,step): #Generator function to produce each point for the graph
step = decimal.Decimal(step)
r = decimal.Decimal(start)
while r < end:
yield float(r)
r += decimal.Decimal(step)
def CreationDialogue(): #Obtain parameters for graph and generate graph
print("2 million nodes ~ 357MB")
xStart =float(input("Enter start x Coord"))
yStart = float(input("Enter start y Coord"))
zStart = float(input("Enter start z Coord"))
xEnd = float(input("Enter End x Coord"))
yEnd = float(input("Enter End y Coord"))
zEnd = float(input("Enter End z Coord"))
xInterval = float(input("Enter x interval"))
yInterval = float(input("Enter y interval"))
zInterval = float(input("Enter z interval"))
print("creating graph")
graph = AATC_AStar.DynoGraph()
graph.Size(xInterval,yInterval,zInterval)
nodeID = 1
for x in drange(xStart,xEnd,xInterval):
for y in drange(yStart,yEnd,yInterval):
for z in drange(zStart,zEnd,zInterval):
Coord = AATC_Coordinate.Coordinate(x,y,z) #Add nodes to graph for each point on the 3D grid
node = AATC_AStar.Node(nodeID,1,Coord)
graph.add_node(node)
nodeID +=1
xRange = xEnd - xStart
yRange = yEnd - yStart
zRange = zEnd - zStart
graph.Add_Edges(xRange,yRange,zRange)
graph.Build_Node_Cache()
graph.SaveGraph() #Create edges and cache and save graph
#return graph
if __name__ == "__main__":
graph = CreationDialogue()