Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F68053027
test_Voronoi.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jun 25, 16:31
Size
1 KB
Mime Type
text/x-python
Expires
Thu, Jun 27, 16:31 (2 d)
Engine
blob
Format
Raw Data
Handle
18519457
Attached To
rPNBODY pNbody
test_Voronoi.py
View Options
#!/usr/bin/env python
from
pNbody
import
ic
from
numpy
import
*
import
tessel
import
Ptools
as
pt
import
plot
import
sys
import
time
random
.
seed
(
0
)
# 2 for two points
n
=
500000
nb
=
ic
.
plummer
(
n
,
1
,
1
,
1
,
eps
=
0.1
,
rmax
=
1.
)
pos
=
nb
.
pos
mass
=
nb
.
mass
#pos = random.random((n,3))
#mass = pos[:,0]+pos[:,1]
#pos[0] = [0.5,0.5,0]
#pos[1] = [0.5,0.25,0]
#pos[2] = [0.25,0.5,0]
#pos[3] = [0.75,1.0,0]
t1
=
time
.
time
()
tessel
.
ConstructDelaunay
(
pos
,
mass
)
t2
=
time
.
time
()
#tessel.info()
TriangleList
=
tessel
.
GetTriangles
()
print
len
(
TriangleList
),
"triangles"
,
"in"
,(
t2
-
t1
),
"s"
'''
i = 0
for Triangle in TriangleList:
P1 = Triangle['coord'][0]
P2 = Triangle['coord'][1]
P3 = Triangle['coord'][2]
#plot.draw_triangle(P1,P2,P3)
#cm = 1/3.*(P1+P2+P3)
#pt.text(cm[0],cm[1],Triangle['id'],fontsize=12,horizontalalignment='center',verticalalignment='center')
for P in pos:
plot.draw_points([P],'b')
'''
t1
=
time
.
time
()
segments
=
tessel
.
GetVoronoi
()
t2
=
time
.
time
()
print
len
(
segments
),
"segments"
,
"in"
,(
t2
-
t1
),
"s"
sys
.
exit
()
for
segment
in
segments
:
#print segment[0],segment[1]
plot
.
draw_line
(
segment
[
0
],
segment
[
1
],
'r'
)
pt
.
axis
([
-
1
,
1
,
-
1
,
1
])
pt
.
show
()
Event Timeline
Log In to Comment