Created
October 25, 2019 18:26
-
-
Save waseem/5070f7cd5b1823dd957f36d8b205faa4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for v in range(height): | |
for u in range(width): | |
# Get end of ray and round to sdf array coordinate... | |
pos = start[v,u,:] + travel[v,u] * norm[v,u,:] | |
pos += 0.5 * numpy.array(sdf.shape) # Center of sdf to 3D origin | |
sdf_coordinate = (pos+0.5).astype(int) | |
# Loop the 3 dimensions and check each is not out of bounds... | |
for d in range(3): | |
if sdf_coordinate[d]<0: | |
sdf_coordinate[d] = 0 | |
if sdf_coordinate[d]>=sdf.shape[d]: | |
sdf_coordinate[d] = sdf.shape[d] - 1 | |
# Evaluate function... | |
ret[v,u] = sdf[sdf_coordinate] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment