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

Function find_k_neighbor_points_of_rays

pointersect/pr/cuda/pr_cuda.cpp:514–547  ·  view source on GitHub ↗

Find the k nearest points within `radius` of a ray, ie, the vertical distance from the point to ray <= radius. If not enough points found, return dummy index 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

Source from the content-addressed store, hash-verified

512// 5. given grid idxs for each ray, gather point idxs
513//
514std::tuple<torch::Tensor, torch::Tensor> find_k_neighbor_points_of_rays(
515 torch::Tensor points, // (b, n, 3), float
516 torch::Tensor ray_origins, // (b, m, 3), float
517 torch::Tensor ray_directions, // (b, m, 3), float
518 torch::Tensor ray_radius, // (b,), float
519 torch::Tensor grid_size, // (b, 3), long
520 torch::Tensor grid_center, // (b, 3), float
521 torch::Tensor grid_width, // (b, 3), float
522 int64_t k,
523 float t_min = 0.,
524 float t_max = 1.e12
525) {
526
527 CHECK_INPUT(points);
528 CHECK_INPUT(ray_origins);
529 CHECK_INPUT(ray_directions);
530 CHECK_INPUT(ray_radius);
531 CHECK_INPUT(grid_size);
532 CHECK_INPUT(grid_center);
533 CHECK_INPUT(grid_width);
534
535 return find_k_neighbor_points_of_rays_cuda(
536 points, // (b, n, 3),
537 ray_origins, // (b, m, 3), float
538 ray_directions, // (b, m, 3), float
539 ray_radius, // (b,), float
540 grid_size, // (b, 3), long
541 grid_center, // (b, 3), float
542 grid_width, // (b, 3), float
543 k,
544 t_min,
545 t_max
546 );
547}
548
549
550torch::Tensor keep_min_k_values(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected