V
Vish
Hi,
I need to hash 3d coordinates to a grid which has been divided into
4*4*4 squares. Using python, I thought of a simple way as follows:
CELL_SIZE = 4
def key(point):
return (
int((floor(point[0]/CELL_SIZE))*CELL_SIZE),
int((floor(point[1]/CELL_SIZE))*CELL_SIZE),
int((floor(point[2]/CELL_SIZE))*CELL_SIZE)
)
Since python allows keys to be tuples, I think that this should work.
Is there a better (more efficient) way to do it?
Thank you,
Vishal
I need to hash 3d coordinates to a grid which has been divided into
4*4*4 squares. Using python, I thought of a simple way as follows:
CELL_SIZE = 4
def key(point):
return (
int((floor(point[0]/CELL_SIZE))*CELL_SIZE),
int((floor(point[1]/CELL_SIZE))*CELL_SIZE),
int((floor(point[2]/CELL_SIZE))*CELL_SIZE)
)
Since python allows keys to be tuples, I think that this should work.
Is there a better (more efficient) way to do it?
Thank you,
Vishal