MCPcopy Create free account
hub / github.com/AiuniAI/Unique3D / integrate_gradient_field

Function integrate_gradient_field

scripts/normal_to_height_map.py:29–45  ·  view source on GitHub ↗
(
    gradient_field: np.ndarray, axis: int, mask: np.ndarray
)

Source from the content-addressed store, hash-verified

27
28@numba.jit(nopython=True)
29def integrate_gradient_field(
30 gradient_field: np.ndarray, axis: int, mask: np.ndarray
31) -> np.ndarray:
32 heights = np.zeros(gradient_field.shape)
33
34 for d1 in numba.prange(heights.shape[1 - axis]):
35 sum_value = 0
36 for d2 in range(heights.shape[axis]):
37 coordinates = (d1, d2) if axis == 1 else (d2, d1)
38
39 if mask[coordinates] != 0:
40 sum_value = sum_value + gradient_field[coordinates]
41 heights[coordinates] = sum_value
42 else:
43 sum_value = 0
44
45 return heights
46
47
48def calculate_heights(

Callers 1

calculate_heightsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected