Dear R users,
I am trying to write a code that could efficiently determine which voxel a
point in space lies inside. For example, I have a matix with x,y,z values:

library(rgl)

x = runif(500, 0, 10)
y = runif(500, 0, 10)
z = runif(500, 0, 10)

myPoints <- matrix(c(x,y,z), ncol=3)
plot3d(myPoints)


Supposing I have a 3 dimensional cube in space (ex: 10 by 10 ), that is
segmented into 1 by 1 smaller voxels.

My3D <- array(0,dim=c(10,10,3))

I would really appreciate suggestions to writing a very efficient code to
determine which voxel index each of these points lie inside, especially in
an optics to do a chunk-by-chunk analysis.

Thanks for any help
Gianni

	[[alternative HTML version deleted]]

