I have a large point cloud in open3D and I want to basically make a 3D grid and bin the points based on which cube they are in. Other have called it "binning in 3D space."
Example image with grids only in one direction (I want to split into 3D volumes)
Better Image of what I'm trying to do
Example:
import numpy as np
A = np.array([[ 0, -1, 10],
[ 1, -2 ,11],
[ 2, -3 ,12],
[ 3, -4 ,13],
[ 4, -5 ,14],
[ 5, -6 ,15],
[ 6, -7 ,16],
[ 7, -8 ,17],
[ 8, -9 ,18]])
#point 1: X,Y,Z
#point 2: X,Y,Z
print(A)
X_segments = np.linspace(0,8,3) #plane at beginning, middle and end - this creates 2 sections where data can be
Y_segments = np.linspace(-9,-1,3)
Z_segments = np.linspace(10,18,3)
#all of these combined form 4 cuboids where data can be
#its also possible for the data to be outside these cuboids but we can ignore that
bin1 = A where A[0,:] is > X_segments [0] and < X_segments[1]
and A where A[1,:] is > Y_segments [0] and < Y_segments[1]
and A where A[2,:] is > Z_segments [0] and < Z_segments[1]
bin2 = A where A[0,:] is > X_segments [1] and < X_segments[2]
and A where A[1,:] is > Y_segments [0] and < Y_segments[1]
and A where A[2,:] is > Z_segments [0] and < Z_segments[1]
bin3 = A where A[0,:] is > X_segments [1] and < X_segments[2]
and A where A[1,:] is > Y_segments [1] and < Y_segments[2]
and A where A[2,:] is > Z_segments [0] and < Z_segments[1]
bin4 = A where A[0,:] is > X_segments [1] and < X_segments[2]
and A where A[1,:] is > Y_segments [1] and < Y_segments[2]
and A where A[2,:] is > Z_segments [1] and < Z_segments[2]
Thanks yall!