Skip to content

Commit 2cf40c9

Browse files
committed
🐛 Fix input validation in pip_query function to ensure nsamples is a positive odd integer
1 parent 8c605ea commit 2cf40c9

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/polyhedron.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function pip_query(
1414
n, m = size(points)
1515
n == 3 || error("points must be a 3xN array")
1616
m >= 1 || error("at least 1 points are required")
17+
(nsamples > 0 && isodd(nsamples)) || error("nsamples must be a positive odd integer")
1718
py_points = np.array(points')
1819

1920
# query by using open3d
@@ -28,6 +29,8 @@ function pip_query(
2829
scene = o3d.t.geometry.RaycastingScene(device=_dev)
2930
_ = scene.add_triangles(mesh_t)
3031
pts_t = o3d.core.Tensor(py_points.astype(np.float32), device=_dev)
32+
33+
println("\e[1;36m[start]:\e[0m querying points inside the STL model")
3134
occ = scene.compute_occupancy(pts_t, nsamples=nsamples)
3235
tmp = occ.numpy().astype(pybuiltins.bool)
3336

0 commit comments

Comments
 (0)