Python: How can I plot a generic 3D object if I have x, y and z as functions of some parameters? -



Python: How can I plot a generic 3D object if I have x, y and z as functions of some parameters? -

for instance, unit sphere, 1 has

x = cos(phi)sin(theta) y = sin(phi)sin(theta) z = cos(theta)

i plot set of points phi , theta in intervals [0, 2*pi] , [0, pi], respectively.

is there way in general case, meaning specifying

x,y,z functions of parameters, and the ranges of parameters

and getting 3d plot of that?

i think far mayavi goes, stuck creating grids yourself, , plotting resulting datapoints... does, however, not have cumbersome when using numpy :

from numpy import pi, sin, cos, mgrid [phi,theta] = mgrid[0:2*pi:100j,0:pi:100j] # 100 amount of steps in respective dimension x = cos(phi)*sin(theta) y = sin(phi)*sin(theta) z = cos(theta) mayavi import mlab s = mlab.mesh(x, y, z) mlab.show()

python plot 3d visualization mayavi

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -