Ejemplo n.º 1
0
if (len(sys.argv)) == 2:
    filename = sys.argv[1]

nanoparticles = []

botx, topx, boty, topy, botz, topz = \
    nanoparticle.file_to_nanoparticle_list(filename, nanoparticles)

if (botx >= topx) or (boty >= topy) or \
   (boty >= topy):
    print "Error Invalid BOX"
    exit()

scx, scy, scz, radius = \
    nanoparticle.nanoparticle_list_to_arrays(nanoparticles)

renderer = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(renderer)

iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

for selected_index in range(0, 1):
    nanop = nanoparticles[selected_index]
    renderer.AddActor(nanop.get_vtk_actor(True, 1.0))

    for p in nanop.inside_point_grid():
        renderer.AddActor(p.get_actor(0.1, rc=1.0, gc=0.0, bc=0.0))
    renderer.AddActor(nanop.get_vtk_actor(opacity=0.5))
Ejemplo n.º 2
0
zmax = xmax = ymax = -10000.0
zmin = xmin = ymin = 10000.0

xmin, xmax, ymin, ymax, zmin, zmax = \
    nanoparticle.file_to_nanoparticle_list(filename, nanoparticles)

cube_actors = cube.cube_to_actors(xmin, ymin, zmin, \
        xmax, ymax, zmax, 1.0, 1.0, 1.0)
for a in cube_actors:
    ren.AddActor(a)

Dz = (zmax - zmin)
Dy = (ymax - ymin)
Dx = (xmax - xmin)

scx, scy, scz, radius = nanoparticle.nanoparticle_list_to_arrays(nanoparticles)

meanr = radius.mean()
meand = 2.0 * meanr

# voglio fermarmi a circa 2 D dalla vetta visto che in cima avro' sempre una
# densita' minore(ricorda la prima sfera che supera zmax ferma la procedura.
dz = ((zmax - zmin) - (3.0 * meand)) / float(hw_many_planes + 1)

poly_data_points = []
center = []

for iplane in range(hw_many_planes):

    zplane = zmin + meand + (iplane + 1) * dz