Skip to content

Commit

Permalink
sorting out wrong shapes and unit test error
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrishastin committed Oct 29, 2023
1 parent 5e4c097 commit 9d7dccf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions cpp/open3d/t/geometry/RaycastingScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -868,13 +868,14 @@ RaycastingScene::ListIntersections(const core::Tensor& rays,

// generate results structure
std::unordered_map<std::string, core::Tensor> 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<uint32_t>();
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);
Expand Down
2 changes: 1 addition & 1 deletion python/test/t/geometry/test_raycasting_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 9d7dccf

Please sign in to comment.