Created
September 10, 2014 18:46
-
-
Save pv/2f756ec83cdf242ce691 to your computer and use it in GitHub Desktop.
qvoronoi strangeness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 | |
5 1 10 0 2 1 | |
5 1 4 0 2 1 | |
5 3 12 0 3 1 | |
5 3 4 0 3 1 | |
5 4 7 0 3 4 | |
5 4 5 0 2 4 | |
6 4 13 1 2 4 3 | |
5 5 14 0 4 2 | |
5 7 16 3 4 0 | |
5 9 12 0 6 1 | |
5 9 10 0 1 6 | |
5 10 19 0 6 8 | |
5 10 11 0 2 8 | |
6 10 13 1 2 8 6 | |
5 11 14 0 8 2 | |
5 12 21 0 6 5 | |
5 12 15 0 3 5 | |
6 12 13 1 3 5 6 | |
6 13 14 2 4 7 8 | |
6 13 16 3 5 7 4 | |
6 13 22 6 5 7 8 | |
5 14 23 0 8 7 | |
5 14 17 0 7 4 | |
5 15 16 3 5 0 | |
5 16 25 0 5 7 | |
5 16 17 4 0 7 | |
5 19 22 6 8 0 | |
5 21 22 6 5 0 | |
5 22 25 5 0 7 | |
5 22 23 7 0 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 | |
27 | |
0 2 0 | |
1 2 0 | |
2 2 0 | |
0 1 0 | |
1 1 0 | |
2 1 0 | |
0 0 0 | |
1 0 0 | |
2 0 0 | |
0 2 1 | |
1 2 1 | |
2 2 1 | |
0 1 1 | |
1 1 1 | |
2 1 1 | |
0 0 1 | |
1 0 1 | |
2 0 1 | |
0 2 2 | |
1 2 2 | |
2 2 2 | |
0 1 2 | |
1 1 2 | |
2 1 2 | |
0 0 2 | |
1 0 2 | |
2 0 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ridges: set([(25, 16), (22, 13), (23, 22), (14, 13), (22, 19), (17, 16), (25, 22), (12, 9), (16, 7), (15, 12), (11, 10), (14, 5), (16, 15), (21, 12), (4, 1), (13, 4), (10, 9), (5, 4), (13, 12), (23, 14), (10, 1), (13, 10), (19, 10), (14, 11), (22, 21), (17, 14), (7, 4), (12, 3), (4, 3), (16, 13)]) | |
python equals qhull: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
qvoronoi p Fv < pts.dat > out.dat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
from scipy.spatial import Voronoi | |
points = np.loadtxt('pts.dat', skiprows=2) | |
vor = Voronoi(points) | |
# Compare to qhull | |
def makepair(a, b): | |
if a > b: | |
a, b = b, a | |
return (int(b), int(a)) | |
py_ridges = set(makepair(x[0], x[1]) for x in vor.ridge_points) | |
qhull_dat = np.loadtxt('out.dat', skiprows=1) | |
qhull_ridges = set(makepair(row[1], row[2]) for row in qhull_dat) | |
print "ridges:", py_ridges | |
print "python equals qhull:", py_ridges == qhull_ridges |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment