MCPcopy Create free account
hub / github.com/apple/ml-pointersect / find_neighbor_points_of_rays

Function find_neighbor_points_of_rays

pointersect/pr/cuda/pr_cuda.cpp:439–470  ·  view source on GitHub ↗

Find the points within `radius` of a ray, ie, the vertical distance from the point to ray <= radius. Returns: ray2pidx: (b, M), all the points. The pidxs of a ray is found via ray2pidx[b][ray_start_idx[m]:ray_end_idx[m]] ray_start_idx: (b, m), ray_end_idx: (b, m) Note: Our algorithm is very simple. In order to be parallelized on gpu easily, we want to every thread to have as few branching condit

Source from the content-addressed store, hash-verified

437// 5. given grid idxs for each ray, gather point idxs
438//
439std::tuple<torch::Tensor, torch::Tensor, torch::Tensor> find_neighbor_points_of_rays(
440 torch::Tensor points, // (b, n, 3), float
441 torch::Tensor ray_origins, // (b, m, 3), float
442 torch::Tensor ray_directions, // (b, m, 3), float
443 torch::Tensor ray_radius, // (b,), float
444 torch::Tensor grid_size, // (b, 3), long
445 torch::Tensor grid_center, // (b, 3), float
446 torch::Tensor grid_width, // (b, 3), float
447 float t_min = 0.,
448 float t_max = 1.e12
449) {
450
451 CHECK_INPUT(points);
452 CHECK_INPUT(ray_origins);
453 CHECK_INPUT(ray_directions);
454 CHECK_INPUT(ray_radius);
455 CHECK_INPUT(grid_size);
456 CHECK_INPUT(grid_center);
457 CHECK_INPUT(grid_width);
458
459 return find_neighbor_points_of_rays_cuda(
460 points, // (b, n, 3),
461 ray_origins, // (b, m, 3), float
462 ray_directions, // (b, m, 3), float
463 ray_radius, // (b,), float
464 grid_size, // (b, 3), long
465 grid_center, // (b, 3), float
466 grid_width, // (b, 3), float
467 t_min,
468 t_max
469 );
470}
471
472// Find the k nearest points within `radius` of a ray, ie, the vertical distance from the point to ray <= radius.
473// If not enough points found, return dummy index

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected