Created
January 10, 2016 01:51
-
-
Save cjameshuff/d708bf6de9bf9a919f5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
auto BBox::SlopeTest(const t_ClassifiedRay<T> & ray) const -> bool | |
{ | |
auto && tl = (minExt - ray.origin)*ray.rdir; | |
auto && th = (maxExt - ray.origin)*ray.rdir; | |
auto && tmin = std::min(tl.x, th.x); | |
auto && tmax = std::max(tl.x, th.x); | |
tmin = std::max(tmin, std::min(std::min(tl.y, th.y), tmax)); | |
tmax = std::min(tmax, std::max(std::max(tl.y, th.y), tmin)); | |
tmin = std::max(tmin, std::min(std::min(tl.z, th.z), tmax)); | |
tmax = std::min(tmax, std::max(std::max(tl.z, th.z), tmin)); | |
return tmax > std::max(tmin, T(0)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment