Dear All,
This is what I would like to visualize (scripting as much as
possible): I have a set of spheres in 3D, with diameter d=2, which I
can visualize with mayavi.
On top of that, using scipy.spatial, I can calculate a convex hull
based on the centers of the spheres.
The final touch would be to visualize this hull: I should obtain a
mesh composed by poligons. I'd like it to be partially transparent, so
that one can see also the spheres inside.
I paste below a script which visualizes the spheres and calculates the
convex hull.
Any suggestions about how to overlay the convex hull is welcome.
Cheers

Lorenzo


###########################################################################


import numpy as np

from scipy.spatial import ConvexHull

from mayavi import mlab

cluster_agglomerate=np.array([[ 0.14513811, -0.18930948, -1.44428171],
       [ 0.88042945,  1.67057596, -1.45742688],
              [-1.66682741, -0.99554261, -1.70267889],
                     [-0.95535694,  2.3159907 , -1.93637881],
                            [ 1.09396798,  1.7987614 , -3.44524095],
                                   [-2.63620654,  0.16588691,
       -3.02436539],
              [ 0.19027056,  2.70740725,  0.11479029],
                     [ 2.77638842,  1.70535678, -2.10208878],
                            [-0.09149779, -0.81908733,  2.07425244],
                                   [-0.48408772,  0.96793567,
       1.26652603],
              [ 0.67499278, -2.5386008 ,  1.39914827],
                     [ 1.02571108, -1.60932884, -0.34500693],
                            [ 2.78789155, -1.42050584,  0.59682802],
                                   [-0.14688239, -2.36883246,
       3.35177362],
              [-1.71507089,  0.19184887,  2.68408562],
                     [-1.87886026, -1.58255618,  3.97006406],
                            [ 6.61540229,  1.98324725,  0.82767368],
                                   [ 7.46818823,  3.00950487,
       -0.66214223],
              [ 4.80777628,  1.97159273,  1.68344958],
                     [ 6.3548727 ,  2.26459561,  2.92819854],
                            [ 4.70026626,  0.44618044,  0.3866837 ],
                                   [ 3.44366671,  1.87939977,
       -0.2203051 ],
              [ 2.92460648,  1.98510457,  2.37510769],
                     [ 5.07053866, -0.10349542, -1.51041234],
                            [ 7.21643437, -1.32050186, -0.70707322],
                                   [ 6.93292243,  0.58458074,
       -1.2458508 ],
              [ 7.84238244, -2.97562362, -1.63914669],
                     [ 7.43212373,  0.10620418,  0.68315389],
                            [ 9.59692827, -2.0843759 , -1.26623658],
                                   [ 8.34540867, -1.14927294,
       1.95073173],
              [ 6.57425162, -2.13797392, -2.94804639],
                     [ 6.93340304, -4.4591665 , -0.63578546]])


hull = ConvexHull(cluster_agglomerate)



x=cluster_agglomerate[:,0]
y=cluster_agglomerate[:,1]
z=cluster_agglomerate[:,2]


mlab.clf()
pts = mlab.points3d(x, y, z, scale_mode='none', resolution=20,\
                        color=(0,0,1),scale_factor=2.)
                        #mlab.axes(pts)

mlab.show()





------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
MayaVi-users mailing list
MayaVi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to