Hi,
The problem I am currently having is that when I use the Surface command the image that I get is not correct. For some strange reason IDL seems to be confused and does not plot the surface correctly. The same problem occurs also when I use the iSurface tool in vector graphics mode.
The surface that I want to plot is:
x=sqrt(r^2+a^2) cos(phi)sin(theta)
y=sqrt(r^2+a^2) sin(phi)sin(theta)
z=r cos(theta)
for r=8 and a=6. I can't really understand why the image is not correct in the right part of the plot.
A part of my code can be seen below.
pro testing
ni=31
x=dblarr(ni,ni)
y=dblarr(ni,ni)
z=dblarr(ni,ni)
;Theta->[0,180] degrees
;Phi-> [0,360] degrees
theta=dindgen(ni)*(180.d0/(double(ni-1)))
phi=dindgen(ni)*(360.d0/(double(ni-1)))
;Convert to radians
theta=theta*!dpi/(180.d0)
phi=2.d0*phi*!dpi/(360.d0)
r=8
a=6
for j=0,ni-1 do begin
for i=0,ni-1 do begin
x[i,j]=sqrt(r^2+a^2)*cos(phi[i])*sin(theta[j])
y[i,j]=sqrt(r^2+a^2)*sin(phi[i])*sin(theta[j])
z[i,j]=r*cos(theta[j])
endfor
endfor
device,retain=2
Surface,z,x,y,/SAVE,$
xstyle=1,ystyle=1,xrange=[-11,11],yrange=[-11,11],$
zrange=[-11,11],zst=1,$
ax=30,az=-30,CHARSIZE=2.0,$
xtitle='!3x [G m/c!S!E2!R ]',ytitle='!3y [G m/c!S!E2!R ]',$
ztitle='!3z [G m/c!S!E2!R ]',/noerase
end
Can I do the same thing using coordinate transformations and how?
Thank you in advance.
Kiki
|