3-D positions [message #43822] |
Fri, 29 April 2005 11:24 |
panblosky
Messages: 17 Registered: May 2005
|
Junior Member |
|
|
Hi, I have the following problem. I have a 3xn array, where n can go
from 32000 to 16.000.000. This array represents positions in space, or
just lets say x,y,z. The numbers go from 0 to 1. I have a cube of sides
1. I divide that cube into a 3-D grid, where my gridsize can go from 32
to 512 in every direction (depends on how big I want the grid). So, in
1-D, the box is going to be divided in:
lon=findgen(n0)/float(n0-1)*float(boxsize)/boxsize
where n0 is the size of the grid (for example, 128) and boxsize is 1.
The same thing goes for the other two dimensions.
Now, I want to find what points (x,y,z) lies in which gridcell
(between lon[i+1] and lon[i] in every direction).
If I do it with a for loop (together with a where), it will take for
ever. I have tried sorting, but I just can't get it right. Does
somebody knows a fast way?
Thanks,
Pablo
|
|
|