spherical-volume-rendering / svr-algorithm

A spherical volume rendering algorithm that performs ray casting through a spherical voxel grid.
Other
6 stars 7 forks source link

Reduce floating point calculations in angular, azimuthal hit. #134

Closed cgyurgyik closed 4 years ago

cgyurgyik commented 4 years ago

In both angular and azimuthal hit, we were calculating p, p_end, v separately. These represent (respectively) the ray segment at time t, the ray segment at time t_end, and the free vector represented by p_end - p. I've replaced: p ->P1 p_end -> P2 v -> ray_segment

P2 never changes since t_end never changes. We can calculate P1, ray_segment once with each iteration, and pass it in each plane hit function respectively. This means we update P1, ray_segment once per iteration (using updateRaySegmentPoints() rather than twice per iteration, and P2 once per sphericalVoxelTraversal call.

Next, I've added a collinear_times array to get rid of two branch predictions per traversal and reduce a calculation to once per sphericalVoxelTraversal call rather than once per collinear hit.

In other news,