45 using boundaries =
typename mask_t::boundaries;
47 const point3_type &ro = ray.pos();
48 const vector3_type &rd = ray.dir();
50 constexpr scalar_type inv{detail::invalid_value<scalar_type>()};
51 const vector3_type inv_dir{rd[0] == 0.f ? inv : 1.f / rd[0],
52 rd[1] == 0.f ? inv : 1.f / rd[1],
53 rd[2] == 0.f ? inv : 1.f / rd[2]};
56 const vector3_type min{box[boundaries::e_min_x], box[boundaries::e_min_y],
57 box[boundaries::e_min_z]};
58 const vector3_type max{box[boundaries::e_max_x], box[boundaries::e_max_y],
59 box[boundaries::e_max_z]};
62 vector3_type t1 = (min - ro);
63 vector3_type t2 = (max - ro);
66 for (
unsigned int i{0u}; i < 3u; ++i) {
71 const bool t_comp = t1[0] > t2[0];
72 scalar_type tmin{t_comp ? t2[0] : t1[0]};
73 scalar_type tmax{t_comp ? t1[0] : t2[0]};
75 for (
unsigned int i{0u}; i < 2u; ++i) {
77 tmin = t2[i] < tmin ? tmin : t2[i];
78 tmax = t1[i] > tmax ? tmax : t1[i];
80 tmin = t1[i] < tmin ? tmin : t1[i];
81 tmax = t2[i] > tmax ? tmax : t2[i];