MCPcopy Create free account
hub / github.com/Sin3DM/Sin3DM / sample_grid_points_aabb

Function sample_grid_points_aabb

src/encoding/utils3d.py:13–25  ·  view source on GitHub ↗
(aabb, resolution)

Source from the content-addressed store, hash-verified

11
12
13def sample_grid_points_aabb(aabb, resolution):
14 # aabb: (6, )
15 # resolution: int
16 # return: (Nx, Ny, Nz, 3)
17 aabb_min, aabb_max = torch.split(aabb, 3, dim=-1)
18 aabb_size = aabb_max - aabb_min
19 resolutions = (resolution * aabb_size / aabb_size.max()).long()
20
21 xs = torch.linspace(0.5, resolutions[0] - 0.5, resolutions[0], device=aabb.device) / resolutions[0] * aabb_size[0] + aabb_min[0]
22 ys = torch.linspace(0.5, resolutions[1] - 0.5, resolutions[1], device=aabb.device) / resolutions[1] * aabb_size[1] + aabb_min[1]
23 zs = torch.linspace(0.5, resolutions[2] - 0.5, resolutions[2], device=aabb.device) / resolutions[2] * aabb_size[2] + aabb_min[2]
24 grid_points = torch.stack(torch.meshgrid(xs, ys, zs, indexing='ij'), dim=-1)
25 return grid_points
26
27
28def read_metarial_params_from_mtl(path):

Callers 1

decode_gridMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected