Closed cgyurgyik closed 4 years ago
@matthewturk As discussed on Slack, here's the meat of changing to a unitized time where max_t
can be (0.0, 1.0]. This means no matter where the ray is, inside or outside the sphere, if max_t = 1.0
, it will traverse the entire sphere. If you want to traverse half the sphere, set max_t = 0.5
.
// Quick notes: ray_origin_is_outside_grid is a boolean so its value is 0 or 1.
// Set current t.
double t = t_ray_entrance * ray_origin_is_outside_grid;
// Set max_t.
const double unitized_ray_time = max_t * grid.sphereMaxRadius() * 2.0 +
t_ray_entrance * ray_origin_is_outside_grid;
max_t = ray_origin_is_outside_grid ? std::min(t_ray_exit, unitized_ray_time)
: unitized_ray_time;
Description
The yt version of walk_volume does not have a t_begin, and unitizes time and the ray direction. Our functionality should be similar. Doing so will require some refactoring.
Changes
t_end
tomax_t
.max_t
default value to 1.0walk_volume
, and its removal allows for the removal of unnecessary calculations. If one wants the ray to start at a different t_begin, the origin can be changed.max_t
. The documentation changes in the following way:is_radial_hit_transition
. This is then passed by reference into radialHit()..within_bounds
from HitParameter. We can simply exit early if none of the values are within bounds.DOUBLE_MAX
which represents the maximum value a double can be. This is the value tMax will be set to if no intersection occurs.Type of change
How Has This Been Tested?
Below are a list of tests for a different
max_t
values. We can also get simple First Quadrant tests passing simply by settingmax_t = 0.5
. This does not mean that sectored sphere traversal works, just a use case of the changes in this PR. All tests listed below are also added for the cythonized code.Checklist: