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

Function integrate_vector_field_angles

scripts/normal_to_height_map.py:122–147  ·  view source on GitHub ↗
(angles: List[float])

Source from the content-addressed store, hash-verified

120 angles = np.linspace(0, 90, target_iteration_count, endpoint=False)
121
122 def integrate_vector_field_angles(angles: List[float]) -> np.ndarray:
123 all_combined_heights = np.zeros(shape)
124
125 for angle in angles:
126 rotated_vector_field = rotate_vector_field_normals(
127 rotate(vector_field, angle), angle
128 )
129 rotated_mask = rotate(mask, angle)
130
131 left_gradients, top_gradients = calculate_gradients(
132 rotated_vector_field, rotated_mask
133 )
134 (
135 left_heights,
136 right_heights,
137 top_heights,
138 bottom_heights,
139 ) = calculate_heights(left_gradients, top_gradients, rotated_mask)
140
141 combined_heights = combine_heights(
142 left_heights, right_heights, top_heights, bottom_heights
143 )
144 combined_heights = centered_crop(rotate(combined_heights, -angle), shape)
145 all_combined_heights += combined_heights / len(angles)
146
147 return all_combined_heights
148
149 with Pool(processes=thread_count) as pool:
150 heights = pool.map(

Callers

nothing calls this directly

Calls 6

rotateFunction · 0.85
calculate_gradientsFunction · 0.85
calculate_heightsFunction · 0.85
combine_heightsFunction · 0.85
centered_cropFunction · 0.85

Tested by

no test coverage detected