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

Remove need of std::vector in radialHit(), only use ABS_EPSILON to determine FP equality. #135

Closed cgyurgyik closed 4 years ago

cgyurgyik commented 4 years ago

So using std::vector in radialHit() to calculate multiple values for times_gt_t was causing a bit of a slowdown. Calling clear() is expensive, and similar for iterating through.

I saw that we only used times_gt_t[0] ever to calculate the intersection_time, or tMaxR. Then, it is sufficient to find the first time greater than t.

The one issue would be in the tangential hit case, where intersection_times[0] and intersection_times[1] are equal, but there are not two times greater than t.

In other words, ray.timeOfIntersectionAt(v - d_a) == ray.timeOfIntersectionAt(v + d_a), one of them is greater than t, but the other isn't. This contradicts itself; therefore, we can lessen the logic a bit.

In other news,