MCPcopy Create free account
hub / github.com/Robotics-STAR-Lab/H2-Mapping / offset_points

Function offset_points

mapping/src/functions/render_helpers.py:85–95  ·  view source on GitHub ↗
(point_xyz, quarter_voxel=1, offset_only=False, bits=2)

Source from the content-addressed store, hash-verified

83
84
85def offset_points(point_xyz, quarter_voxel=1, offset_only=False, bits=2):
86 c = torch.arange(1, 2 * bits, 2, device=point_xyz.device)
87 ox, oy, oz = torch.meshgrid([c, c, c], indexing='ij')
88 offset = (torch.cat([
89 ox.reshape(-1, 1),
90 oy.reshape(-1, 1),
91 oz.reshape(-1, 1)], 1).type_as(point_xyz) - bits) / float(bits - 1)
92 if not offset_only:
93 return (
94 point_xyz.unsqueeze(1) + offset.unsqueeze(0).type_as(point_xyz) * quarter_voxel)
95 return offset.type_as(point_xyz) * quarter_voxel # (8,3)
96
97
98@torch.enable_grad()

Callers 1

get_embeddingsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected