"vscode:/vscode.git/clone" did not exist on "29153e279f659cb27732622b52026d0d7d5de817"
Unverified Commit 8d4bef28 authored by gillbam's avatar gillbam Committed by GitHub
Browse files

[#406] - replace 'break' with 'continue' to avoid missing of points when creating voxels (#423)

parent f482dd78
...@@ -196,7 +196,7 @@ def _points_to_voxel_reverse_kernel(points, ...@@ -196,7 +196,7 @@ def _points_to_voxel_reverse_kernel(points,
if voxelidx == -1: if voxelidx == -1:
voxelidx = voxel_num voxelidx = voxel_num
if voxel_num >= max_voxels: if voxel_num >= max_voxels:
break continue
voxel_num += 1 voxel_num += 1
coor_to_voxelidx[coor[0], coor[1], coor[2]] = voxelidx coor_to_voxelidx[coor[0], coor[1], coor[2]] = voxelidx
coors[voxelidx] = coor coors[voxelidx] = coor
...@@ -268,7 +268,7 @@ def _points_to_voxel_kernel(points, ...@@ -268,7 +268,7 @@ def _points_to_voxel_kernel(points,
if voxelidx == -1: if voxelidx == -1:
voxelidx = voxel_num voxelidx = voxel_num
if voxel_num >= max_voxels: if voxel_num >= max_voxels:
break continue
voxel_num += 1 voxel_num += 1
coor_to_voxelidx[coor[0], coor[1], coor[2]] = voxelidx coor_to_voxelidx[coor[0], coor[1], coor[2]] = voxelidx
coors[voxelidx] = coor coors[voxelidx] = coor
......
...@@ -70,7 +70,7 @@ int points_to_voxel_3d_np(py::array_t<DType> points, py::array_t<DType> voxels, ...@@ -70,7 +70,7 @@ int points_to_voxel_3d_np(py::array_t<DType> points, py::array_t<DType> voxels,
voxelidx = coor_to_voxelidx_rw(coor[0], coor[1], coor[2]); voxelidx = coor_to_voxelidx_rw(coor[0], coor[1], coor[2]);
if (voxelidx == -1) { if (voxelidx == -1) {
voxelidx = voxel_num; voxelidx = voxel_num;
if (voxel_num >= max_voxels) break; if (voxel_num >= max_voxels) continue;
voxel_num += 1; voxel_num += 1;
coor_to_voxelidx_rw(coor[0], coor[1], coor[2]) = voxelidx; coor_to_voxelidx_rw(coor[0], coor[1], coor[2]) = voxelidx;
for (int k = 0; k < NDim; ++k) { for (int k = 0; k < NDim; ++k) {
...@@ -134,7 +134,7 @@ int points_to_voxel_3d_np_mean(py::array_t<DType> points, ...@@ -134,7 +134,7 @@ int points_to_voxel_3d_np_mean(py::array_t<DType> points,
voxelidx = coor_to_voxelidx_rw(coor[0], coor[1], coor[2]); voxelidx = coor_to_voxelidx_rw(coor[0], coor[1], coor[2]);
if (voxelidx == -1) { if (voxelidx == -1) {
voxelidx = voxel_num; voxelidx = voxel_num;
if (voxel_num >= max_voxels) break; if (voxel_num >= max_voxels) continue;
voxel_num += 1; voxel_num += 1;
coor_to_voxelidx_rw(coor[0], coor[1], coor[2]) = voxelidx; coor_to_voxelidx_rw(coor[0], coor[1], coor[2]) = voxelidx;
for (int k = 0; k < NDim; ++k) { for (int k = 0; k < NDim; ++k) {
...@@ -207,7 +207,7 @@ int points_to_voxel_3d_np_height( ...@@ -207,7 +207,7 @@ int points_to_voxel_3d_np_height(
voxelidx = coor_to_voxelidx_rw(coor[0], coor[1], coor[2]); voxelidx = coor_to_voxelidx_rw(coor[0], coor[1], coor[2]);
if (voxelidx == -1) { if (voxelidx == -1) {
voxelidx = voxel_num; voxelidx = voxel_num;
if (voxel_num >= max_voxels) break; if (voxel_num >= max_voxels) continue;
voxel_num += 1; voxel_num += 1;
coor_to_voxelidx_rw(coor[0], coor[1], coor[2]) = voxelidx; coor_to_voxelidx_rw(coor[0], coor[1], coor[2]) = voxelidx;
for (int k = 0; k < NDim; ++k) { for (int k = 0; k < NDim; ++k) {
...@@ -347,7 +347,7 @@ int points_to_voxel_3d_with_filtering( ...@@ -347,7 +347,7 @@ int points_to_voxel_3d_with_filtering(
voxelidx = coor_to_voxelidx_rw(coor[0], coor[1], coor[2]); voxelidx = coor_to_voxelidx_rw(coor[0], coor[1], coor[2]);
if (voxelidx == -1) { if (voxelidx == -1) {
voxelidx = voxel_num; voxelidx = voxel_num;
if (voxel_num >= max_voxels) break; if (voxel_num >= max_voxels) continue;
voxel_num += 1; voxel_num += 1;
coor_to_voxelidx_rw(coor[0], coor[1], coor[2]) = voxelidx; coor_to_voxelidx_rw(coor[0], coor[1], coor[2]) = voxelidx;
for (int k = 0; k < NDim; ++k) { for (int k = 0; k < NDim; ++k) {
......
...@@ -75,7 +75,7 @@ void hard_voxelize_kernel(const torch::TensorAccessor<T, 2> points, ...@@ -75,7 +75,7 @@ void hard_voxelize_kernel(const torch::TensorAccessor<T, 2> points,
// record voxel // record voxel
if (voxelidx == -1) { if (voxelidx == -1) {
voxelidx = voxel_num; voxelidx = voxel_num;
if (max_voxels != -1 && voxel_num >= max_voxels) break; if (max_voxels != -1 && voxel_num >= max_voxels) continue;
voxel_num += 1; voxel_num += 1;
coor_to_voxelidx[coor[i][0]][coor[i][1]][coor[i][2]] = voxelidx; coor_to_voxelidx[coor[i][0]][coor[i][1]][coor[i][2]] = voxelidx;
......
...@@ -164,7 +164,7 @@ __global__ void determin_voxel_num( ...@@ -164,7 +164,7 @@ __global__ void determin_voxel_num(
} else if (point_pos_in_voxel == 0) { } else if (point_pos_in_voxel == 0) {
// record new voxel // record new voxel
int voxelidx = voxel_num[0]; int voxelidx = voxel_num[0];
if (voxel_num[0] >= max_voxels) break; if (voxel_num[0] >= max_voxels) continue;
voxel_num[0] += 1; voxel_num[0] += 1;
coor_to_voxelidx[i] = voxelidx; coor_to_voxelidx[i] = voxelidx;
num_points_per_voxel[voxelidx] = 1; num_points_per_voxel[voxelidx] = 1;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment