python - How to produce coordinates to cover a sphere with a single line? -


i in situation :

line plotting coordinates / sphere of interest

i trying produce x,y,z coordinates allow me cover sphere, in scanning way can see on red line on figure.

i using code produce coordinates :

nsteps = 50 ntours = 3 r = 10 r = 1  theta = linspace(0, 2*pi*ntours, nsteps, endpoint = false) r0 = linspace(0, r, nsteps, endpoint = false)   x01 = (r0*cos(theta)) x02 = x01[::-1] x0 = append(x01,x02)   y01 = (r0*sin(theta)) y02 = y01[::-1]*-1 y0 = append(y01,y02)  z0 = linspace(0,10,num=100) 

as can see, not perfect @ all, , have trouble programm way force coordinate production respect sphere size.

in other words, need script would, informations entered : - radius of sphere - amount of steps required - amount of revolution

produce x,y,z coordinates trace path on sphere, being on surface of it,in 3 arrays x, y z.

because of other limitations not related topic, forced use 50 - 100 steps, , can not go further. not looking cover whole surface of sphere, cover enough quite low amount of steps.

thank !

spherical coordinates rescue: http://en.wikipedia.org/wiki/spherical_coordinate_system#cartesian_coordinates

this allows like

npoints = 100  t   = np.linspace(0,np.pi,npoints) r   = 1    = 20 phi = a*t  x = r*np.sin(t)*np.cos(phi) y = r*np.sin(t)*np.sin(phi) z = r*np.cos(t) 

adjusting r radius , a for... spirality... let's call it...


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -