-
Notifications
You must be signed in to change notification settings - Fork 231
Closed
Labels
Description
I'm new to polyscope (great project, btw) but it seems like if I use irregular resolution (dimensions) something goes wrong with the render. If I run this code (notice the dim = (20, 20, 25) :
import polyscope as ps
import numpy as np
ps.init()
dims = (20, 20, 25)
bound_low = (-3.0, -3.0, -3.0)
bound_high = ( 3.0, 3.0, 3.0)
# Register the grid in Polyscope
ps_grid = ps.register_volume_grid("sample grid", dims, bound_low, bound_high)
def torus_sdf(x, y, z, R=1.5, r=0.5):
xy_len = np.sqrt(x*x + y*y)
qx = xy_len - R
qz = z
return np.sqrt(qx*qx + qz*qz) - r
nx, ny, nz = dims
xs = np.linspace(bound_low[0], bound_high[0], nx)
ys = np.linspace(bound_low[1], bound_high[1], ny)
zs = np.linspace(bound_low[2], bound_high[2], nz)
X, Y, Z = np.meshgrid(xs, ys, zs, indexing='ij')
scalar_vals = torus_sdf(X, Y, Z, R=1.5, r=0.6)
# Add scalar quantity on nodes
ps_grid.add_scalar_quantity(
"torus SDF (nodes)",
scalar_vals,
defined_on='nodes',
vminmax=(-5.0, 5.0),
enabled=True
)
ps.show()
I get this result
