-
Notifications
You must be signed in to change notification settings - Fork 2
/
testVoroBad.py
executable file
·35 lines (26 loc) · 1.07 KB
/
testVoroBad.py
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
#!/usr/bin/python
import numpy as np
import voronizator
import tetrahedron
voronoi = voronizator.Voronizator()
maxEmptyArea = 0.1
poly1 = tetrahedron.Tetrahedron(a = [0.1,0.1,0.1], b = [0.1,0.9,0.1], c = [0.9,0.1,0.1], d = [0.5,0.5,0.9], maxEmptyArea=maxEmptyArea)
poly2 = tetrahedron.Tetrahedron(a = [-0.5,0.1,0.1], b = [-0.5,0.9,0.1], c = [-0.9,0.5,0.1], d = [-0.5,0.5,1.5], maxEmptyArea=maxEmptyArea)
poly3 = tetrahedron.Tetrahedron(a = [0.5,1.,0.5], b = [0.7,0.5,0.5], c = [0.7,0.7,1.], d = [0.9,0.7,0.5], maxEmptyArea=maxEmptyArea)
Vs = np.array([0.,0.,0.])
#Ve = np.array([1.,1.,1.])
Ve = np.array([0.5,0.6,0.5])
voronoi.addPolyhedron(poly1)
voronoi.addPolyhedron(poly2)
voronoi.addPolyhedron(poly3)
#voronoi.addBoundingBox([-2.,-2.,-2.], [3.,3.,3.], maxEmptyArea=10.)
voronoi.setPolyhedronsSites()
voronoi.makeVoroGraph()
#voronoi.calculateShortestPath(Vs, Ve, 'near')
voronoi.calculateShortestPath(Vs, Ve, 'all', postSimplify=False)
plt = plotter.Plotter()
#voronoi.plotSites(plt)
voronoi.plotPolyhedrons(plt)
voronoi.plotGraph(plt)
voronoi.plotShortestPath(plt)
plt.draw()