# 点群データを numpy 配列に変換
points = np.asarray(point_cloud.points)

# 断面の設定
num_slices = 20  # 断面の数
slice_thickness = 0.1  # 断面の厚み[m]

# 各軸の範囲を取得
x_min, x_max = np.min(points[:, 0]), np.max(points[:, 0])
y_min, y_max = np.min(points[:, 1]), np.max(points[:, 1])
z_min, z_max = np.min(points[:, 2]), np.max(points[:, 2])
# 最上と最下を除外
x_levels = np.linspace(x_min, x_max, num_slices + 2)[1:-1]  
y_levels = np.linspace(y_min, y_max, num_slices + 2)[1:-1]
z_levels = np.linspace(z_min, z_max, num_slices + 2)[1:-1]

# XY 平面の断面（Z方向）
process_sections("XY", z_levels, "X", "Y", 0, 1, 2)
# XZ 平面の断面（Y方向）
#process_sections("XZ", y_levels, "X", "Z", 0, 2, 1)
# YZ 平面の断面（X方向）
#process_sections("YZ", x_levels, "Y", "Z", 1, 2, 0)
