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

Function sample_grid_points_aabb

data/utils.py:4–16  ·  view source on GitHub ↗
(aabb, resolution)

Source from the content-addressed store, hash-verified

2
3
4def sample_grid_points_aabb(aabb, resolution):
5 # aabb: (6, )
6 # resolution: int
7 # return: (Nx, Ny, Nz, 3)
8 aabb_min, aabb_max = aabb[:3], aabb[3:]
9 aabb_size = aabb_max - aabb_min
10 resolutions = (resolution * aabb_size / aabb_size.max()).astype(np.int32)
11
12 xs = np.linspace(0.5, resolutions[0] - 0.5, resolutions[0]) / resolutions[0] * aabb_size[0] + aabb_min[0]
13 ys = np.linspace(0.5, resolutions[1] - 0.5, resolutions[1]) / resolutions[1] * aabb_size[1] + aabb_min[1]
14 zs = np.linspace(0.5, resolutions[2] - 0.5, resolutions[2]) / resolutions[2] * aabb_size[2] + aabb_min[2]
15 grid_points = np.stack(np.meshgrid(xs, ys, zs, indexing='ij'), axis=-1)
16 return grid_points
17
18
19def normalize_aabb(v, reso, enlarge_scale=1.03, mult=8):

Callers 2

mesh_sampler.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected