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

Function create_octree

plib/utils.py:230–263  ·  view source on GitHub ↗

Store the xys points into an octree. Args: points: (*, 3) max_depth: max depth of the octree. As the tree depth increases, internal (and eventually leaf) nodes represents a smaller partition of 3D space. Returns: an o3d octre

(
        points: T.Union[torch.Tensor, np.ndarray, o3d.geometry.PointCloud],
        max_depth: int = 5,
        remove_nan_inf: bool = True,
)

Source from the content-addressed store, hash-verified

228
229
230def create_octree(
231 points: T.Union[torch.Tensor, np.ndarray, o3d.geometry.PointCloud],
232 max_depth: int = 5,
233 remove_nan_inf: bool = True,
234) -> o3d.geometry.Octree:
235 """
236 Store the xys points into an octree.
237
238 Args:
239 points:
240 (*, 3)
241 max_depth:
242 max depth of the octree. As the tree depth increases,
243 internal (and eventually leaf) nodes represents a smaller partition of 3D space.
244
245 Returns:
246 an o3d octree
247 """
248 if isinstance(points, o3d.geometry.PointCloud):
249 pcd = points
250 elif isinstance(points, (torch.Tensor, np.ndarray)):
251 pcd = create_pcd(
252 points=points,
253 colors=None,
254 remove_nan_inf=remove_nan_inf,
255 )
256 else:
257 raise NotImplementedError
258
259 octree = o3d.geometry.Octree(max_depth=max_depth)
260 octree.convert_from_point_cloud(
261 point_cloud=pcd,
262 )
263 return octree
264
265
266def ray_aabb_intersection(

Callers

nothing calls this directly

Calls 1

create_pcdFunction · 0.85

Tested by

no test coverage detected