diff --git a/cpp/open3d/t/geometry/RaycastingScene.cpp b/cpp/open3d/t/geometry/RaycastingScene.cpp index b06d6211752..4774beeafa4 100644 --- a/cpp/open3d/t/geometry/RaycastingScene.cpp +++ b/cpp/open3d/t/geometry/RaycastingScene.cpp @@ -868,13 +868,14 @@ RaycastingScene::ListIntersections(const core::Tensor& rays, // generate results structure std::unordered_map result; - result["ray_splits"] = core::Tensor({cumsum.size() + 1}, core::UInt32); + shape[0] = shape[0] + 1; + result["ray_splits"] = core::Tensor(shape, core::UInt32); uint32_t* ptr = result["ray_splits"].GetDataPtr(); ptr[0] = 0; for (int i = 1; i < cumsum.size() + 1; ++i) { ptr[i] = cumsum[i - 1]; } - shape = {intersections_vector.sum()}; + shape[0] = intersections_vector.sum(); result["ray_ids"] = core::Tensor(shape, core::UInt32); result["geometry_ids"] = core::Tensor(shape, core::UInt32); result["primitive_ids"] = core::Tensor(shape, core::UInt32); diff --git a/python/test/t/geometry/test_raycasting_scene.py b/python/test/t/geometry/test_raycasting_scene.py index d89fdc404b3..9b930a877da 100644 --- a/python/test/t/geometry/test_raycasting_scene.py +++ b/python/test/t/geometry/test_raycasting_scene.py @@ -150,7 +150,7 @@ def test_list_intersections(): ans = scene.list_intersections(rays) np.testing.assert_allclose(ans['t_hit'].numpy(), - np.array([[1.0], [2.0], [0.5]]), + np.array([1.0, 2.0, 0.5]), rtol=1e-6, atol=1e-6)