MCPcopy Create free account
hub / github.com/InternRobotics/EmbodiedScan / points_in_rbbox

Function points_in_rbbox

embodiedscan/structures/ops/box_np_ops.py:355–381  ·  view source on GitHub ↗

Check points in rotated bbox and return indices. Note: This function is for counterclockwise boxes. Args: points (np.ndarray, shape=[N, 3+dim]): Points to query. rbbox (np.ndarray, shape=[M, 7]): Boxes3d with rotation. z_axis (int, optional): Indicate which

(points, rbbox, z_axis=2, origin=(0.5, 0.5, 0))

Source from the content-addressed store, hash-verified

353
354
355def points_in_rbbox(points, rbbox, z_axis=2, origin=(0.5, 0.5, 0)):
356 """Check points in rotated bbox and return indices.
357
358 Note:
359 This function is for counterclockwise boxes.
360
361 Args:
362 points (np.ndarray, shape=[N, 3+dim]): Points to query.
363 rbbox (np.ndarray, shape=[M, 7]): Boxes3d with rotation.
364 z_axis (int, optional): Indicate which axis is height.
365 Defaults to 2.
366 origin (tuple[int], optional): Indicate the position of
367 box center. Defaults to (0.5, 0.5, 0).
368
369 Returns:
370 np.ndarray, shape=[N, M]: Indices of points in each box.
371 """
372 # TODO: this function is different from PointCloud3D, be careful
373 # when start to use nuscene, check the input
374 rbbox_corners = center_to_corner_box3d(rbbox[:, :3],
375 rbbox[:, 3:6],
376 rbbox[:, 6],
377 origin=origin,
378 axis=z_axis)
379 surfaces = corner_to_surfaces_3d(rbbox_corners)
380 indices = points_in_convex_polygon_3d_jit(points[:, :3], surfaces)
381 return indices
382
383
384def minmax_to_corner_2d(minmax_box):

Callers

nothing calls this directly

Calls 3

center_to_corner_box3dFunction · 0.85
corner_to_surfaces_3dFunction · 0.85

Tested by

no test coverage detected