Displaying Cartesian coordinate data on a sphere [message #82435] |
Tue, 11 December 2012 05:43 |
dplatten
Messages: 32 Registered: December 2007
|
Member |
|
|
Dear Group,
I have an array of several hundred thousand data points, each with an (x,y,z) coordinate. The coordinates of every point lies somewhere on the surface of a sphere. Each point represents the position and energy of an x-ray photon that has left my Monte Carlo simulation geometry.
I would like to be able to view the data as a texture map overlaid onto a spherical object. I have managed to do this, but I think that the resulting mapping is distorted. I'm not sure how I should configure GRIDDATA so that the resulting grid can be mapped onto the sphere. Should I be using a different command to make the grid? Any help that you can offer would be greatly appreciated. x, y, z and energy are vectors containing the coordinates and energy of the photons:
grid = GRIDDATA(x, y, z, energy, DIMENSION=[60, 60], /SPHERE)
cgLoadCT, 33, RGB_TABLE=colours
greyGrid = BYTSCL(grid)
bitmapGrid = BINDGEN(3, 60, 60)
bitmapGrid[0,*,*] = colours[greyGrid, 0] ;; The red values
bitmapGrid[1,*,*] = colours[greyGrid, 1] ;; The green values
bitmapGrid[2,*,*] = colours[greyGrid, 2] ;; The blue values
;; Set the bitmapGrid to be a texture map object
texmap = obj_new('idlgrimage', bitmapGrid)
;; Create an orb object, and set the bitmapGrid to be the
;; texture map associated with the orb
globe = obj_new('orb', radius=1, pos=[0,0,0], color=[255,255,255], density=3.0, texture_map=texmap, /tex_coords)
;; Display the globe object in a viewer
xobjview, globe
Many thanks,
David
David Platten
Medical Physics Department
Northampton General Hospital
UK
|
|
|