comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Surface plots in spherical coordinates
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Surface plots in spherical coordinates [message #48619] Wed, 03 May 2006 17:45
Matthias Vigelius is currently offline  Matthias Vigelius
Messages: 2
Registered: May 2006
Junior Member
Hi Rick!

> I can point you to orb__define.pro in your IDL install directory to give
> you an idea of how to do this with a sphere. You may even be able to

thanks for your quick answer! This looks really interesting, so I'll
have to get familiar with object graphics, it seems :-)

cheers,

Matthias
Re: Surface plots in spherical coordinates [message #48620 is a reply to message #48619] Wed, 03 May 2006 16:53 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
You'll get the best results using object graphics. I'm not really a
direct graphics user so I can't really comment on your current approach
but your current code could be modified a bit for OG:

Steps 1-3 would be the same.

The magic would be in step 4. You will create a connectivity array
which connects the vertices you calculated in step 3. I don't have the
IDL docs in front of me but you'll want to search for terms like
"polygon connectivity" and "triangle strips" and "quad strips" and look
for the pages outlining how to construct connectivity arrays. You'll
also want to look at the documentation for IDLgrPolygon.

Step 5 would entail creating a IDLgrPolygon object using the vertices
and connectivity data you created in steps 3 and 4. Then adding that to
an instance of IDLgrModel

Step 6 would be viewing it using xobjview.


I can point you to orb__define.pro in your IDL install directory to give
you an idea of how to do this with a sphere. You may even be able to
modify this for your needs. Note that it's location has moved in the
latest version of IDL:

C:\Program Files\RSI\IDL61\examples\visual <- Pre 6.3
C:\Program Files\RSI\IDL63\examples\doc\objects <- 6.3


-Rick


Matthias Vigelius wrote:
> Hi newsgroup!
>
> Is there a possibility to plot surfaces in spherical coordinates?
>
> I have a function R(theta, phi), describing some kind of elongated
> sphere or an ellipsoid, and I'dlike to plot the surface. What I'm doing
> now is:
>
> 1) create two big vectors theta and phi which sample the sphere, that is
> phi is something like (0, ..., 2*pi, 0, ..., 2*pi, ...) and theta
> (0,...,0,..., pi, ..., pi)
>
> 2) compute R(theta, phi)
>
> 3) convert these coordinates to cartesian
>
> 4) triangulate: triangulate, x, y, tr, b
>
> 5) regrid: grid=trigrid(x, y, z, tr)
>
> 6) draw surface: surface, grid, xc, yc
>
> Besides being quite cumbersome, the problem is that I can't draw closed
> surfaces, say the whole sphere (and even so the results are at best
> moderate).
>
> Is there an easier and working way to do that? I would imagine that this
> is a common task, so I wonder why it does not seem to be supported in
> IDL (or is it?)
>
> Thanks heaps!
>
> Matthias
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDLffLangCat
Next Topic: filling an empty array

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:01:39 PDT 2025

Total time taken to generate the page: 0.00564 seconds