-
- // ray intersects box iff it intersects projection on xy plane
- // in this case: tx_near <= ty_near <= tx_far <= ty_far
- // or: tx_far <= ty_near <= tx_near <= ty_far
- // or: tx_far <= ty_far <= tx_near <= ty_near
- // or: tx_near <= ty_far <= tx_far <= ty_near
- if(tx_near <= ty_near && tx_far <= ty_near &&
- tx_near <= ty_far && tx_far <= ty_far) {
-
- // clip along z axis
- if (cos_theta = ray.direction().dot(Vec3f(0, 1, 0)) != 0)
- tz_near = diff_min.dot(Vec3f(0, 1, 0)) / cos_theta;
- if (cos_theta = ray.direction().dot(Vec3f(0, 0, 1)) != 0)
- tz_far = diff_max.dot(Vec3f(0, 1, 0)) / cos_theta;
-
- } else {
-