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

Home » Public Forums » archive » Best way to generate arrays of coordinates for hypersurface calculations?
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
Best way to generate arrays of coordinates for hypersurface calculations? [message #70416] Tue, 06 April 2010 13:47
James[2] is currently offline  James[2]
Messages: 44
Registered: November 2009
Member
I'm interested in making a 3D array, representing a volume, where the
voxels inside a cylinder have high values and the rest are zero. I
suppose this would be called a 3D hypersurface. When dealing with 2D
plots, I have generally made two coordinate arrays, one with values
increasing across columns only, and the other across rows. I've done
this with code that's like:

x = (findgen(11,21) mod 11) - 5
y = transpose(findgen(21,11) mod 21) - 10

If I wanted to plot on x = [-5..5], y = [-10..10]. Then I would use a
function like:

gaussian = exp((-1/10)*sqrt(x^2 + y^2))

to calculate my surface. However, this looks like it's going to
become a pain in the ass really quickly for making coordinate arrays
of higher dimensions. I want to do something like this:

cylinder = bytarr(10,10,10)
cylinder[where(logical_and((x^2 + y^2 lt 4), abs(z) lt 2)] = 255

to make a cylinder of 255s with radius 2 and height 4 centered on the
z axis. Is there a better way to make the coordinate arrays x, y, and
z that I would need for this function, assuming that the dimensions
aren't always going to be a perfect cube? Should I be doing this way
differently?

Thanks,
James Preiss
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: IDL Array Push
Next Topic: IDL 8.0 and compile_opt - Update

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

Current Time: Wed Oct 08 11:34:36 PDT 2025

Total time taken to generate the page: 0.43095 seconds