Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for walk_volume #2449

Merged
merged 7 commits into from
Feb 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion yt/utilities/lib/grid_traversal.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,30 @@ ctypedef void sampler_function(
int index[3],
void *data) nogil

#-----------------------------------------------------------------------------
# walk_volume(VolumeContainer *vc, np.float64_t v_pos[3], np.float64_t v_dir[3], sampler_function *sample,
# void *data, np.float64_t *return_t = NULL, np.float64_t max_t = 1.0)
# vc VolumeContainer* : Pointer to the volume container to be traversed.
# v_pos np.float64_t[3] : The x,y,z coordinates of the ray's origin.
# v_dir np.float64_t[3] : The x,y,z coordinates of the ray's direction.
# sample sampler_function* : Pointer to the sampler function to be used.
# return_t np.float64_t* : Pointer to the final value of t that is still inside the volume container. Defaulted to NULL.
# max_t np.float64_t : The maximum value of t that the ray is allowed to travel. Defaulted to 1.0 (no restriction).
#
# Note: 't' is not time here. Rather, it is a factor representing the difference between the initial point 'v_pos'
# and the end point, which we might call v_end. It is scaled such that v_pos + v * t = v_pos at t = 0.0, and
# v_end at t = 1.0. Therefore, if max_t is set to 1.0, there is no restriction on t.
#
# Written by the yt Development Team.
# Encapsulates the Amanatides & Woo "Fast Traversal Voxel Algorithm" to walk over a volume container 'vc'
# The function occurs in two phases, initialization and traversal.
# See: https://www.researchgate.net/publication/2611491_A_Fast_Voxel_Traversal_Algorithm_for_Ray_Tracing
# Returns: The number of voxels hit during the traversal phase. If the traversal phase is not reached, returns 0.
#-----------------------------------------------------------------------------
cdef int walk_volume(VolumeContainer *vc,
np.float64_t v_pos[3],
np.float64_t v_dir[3],
sampler_function *sampler,
void *data,
np.float64_t *return_t = *,
np.float64_t max_t = *) nogil