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

Home » Public Forums » archive » Re: plotting on a sphere
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: plotting on a sphere [message #31402 is a reply to message #31399] Mon, 08 July 2002 09:18 Go to previous messageGo to previous message
Christopher W. O'Dell is currently offline  Christopher W. O'Dell
Messages: 20
Registered: February 2001
Junior Member
Thanks to Mark and Dick Jackson!
You both effectively gave me the same answer, and i used it and it
works. Of course now i am required to learn object graphics somewhat --
like how do I get a title and a color bar on the "XOBJVIEW" screen?
But the basics work great!

Cheers,
Chris

Mark Hadfield wrote:

> "Chris O'Dell" <odell@cmb.physics.wisc.edu> wrote in message
> news:3D260AC8.3050406@cmb.physics.wisc.edu...
>
>
>> I am new to 3D graphing in IDL. I would like to plot various
>> scalar fields on the surface of a sphere, displayed in 3D using
>> color contours. Ideally, I would be able to then use my mouse to
>> rotate the sphere to different orientations.
>>
>
> If you want 3D with rotations then you want object graphics.
>
> To create a sphere in object graphics, you use MESH_OBJ to create a list of
> vertex positions and a connectivity list (i.e. a list specifying which
> vertices have to be connected to draw the shape). Then you feed these to an
> IDLgrPolygon object. Here's an example that creates & displays a
> plain-coloured sphere:
>
> pro sphere_example
> compile_opt IDL2
> if n_elements(n_lon) eq 0 then n_lon = 20
> if n_elements(n_lat) eq 0 then n_lat = 20
> mesh_obj, 4, vert, conn, replicate(1, n_lon, n_lat)
> help, vert, conn
> sphere = obj_new('IDLgrPolygon', DATA=vert, POLY=conn, COLOR=[0,0,255],
> STYLE=2)
> xobjview, sphere
> end
>
> To give the sphere a non-uniform colour you use the IDLgrPolygon's
> VERT_COLORS property. You will see that the above example creates a mesh
> with 400 vertices. The X, Y & Z positions of the vertices are held in the
> columns of a [3,400] floating-point array. The VERT_COLORS array should be a
> [3,400] byte array, with the columns corresponding to red, green and blue
> respectively. Into this you need to load the color at each vertex, expressed
> as a function of the X, Y and Z position at that vertex.
>
> --
> Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
> m.hadfield@niwa.co.nz
> National Institute for Water and Atmospheric Research (NIWA)
>
>
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: interactive polar blobby plots
Next Topic: Re: Adaptation of surf_track for viewing earthquakes in 3 dimensions

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

Current Time: Wed Oct 08 14:56:16 PDT 2025

Total time taken to generate the page: 0.00368 seconds