Skip to content

Commit

Permalink
Modify the deprecated interp2d method into the supported RegularGridI…
Browse files Browse the repository at this point in the history
…nterpolator method
  • Loading branch information
CloudRipple authored Jan 8, 2025
1 parent 35d3448 commit 82b8841
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions genesis/ext/isaacgym/terrain_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ def random_uniform_terrain(
x = np.linspace(0, terrain.width * terrain.horizontal_scale, height_field_downsampled.shape[0])
y = np.linspace(0, terrain.length * terrain.horizontal_scale, height_field_downsampled.shape[1])

f = interpolate.interp2d(y, x, height_field_downsampled, kind="linear")
# f = interpolate.interp2d(y, x, height_field_downsampled, kind="linear")
f = interpolate.RegularGridInterpolator((y, x), height_field_downsampled, method="linear")

x_upsampled = np.linspace(0, terrain.width * terrain.horizontal_scale, terrain.width)
y_upsampled = np.linspace(0, terrain.length * terrain.horizontal_scale, terrain.length)
z_upsampled = np.rint(f(y_upsampled, x_upsampled))
# z_upsampled = np.rint(f(y_upsampled, x_upsampled))
z_upsampled = np.rint(f((y_upsampled, x_upsampled)))

terrain.height_field_raw += z_upsampled.astype(np.int16)
return terrain
Expand Down

0 comments on commit 82b8841

Please sign in to comment.