opengl-tutorials / ogl

http://www.opengl-tutorial.org
2.69k stars 925 forks source link

Quick question about the sign in TestRayOBBIntersection function #124

Open DokyeongLee-3 opened 2 years ago

DokyeongLee-3 commented 2 years ago

Before the question, I am not familiar with math. Sorry for that. I have seen material about obb ray collision

image

I understand the equation and saw the TestRayOBBIntersection function

It says

        float t1 = (e+aabb_min.x)/f; // Intersection with the "left" plane
        float t2 = (e+aabb_max.x)/f; // Intersection with the "right" plane

But I can not understand why the sign of variable "e" is '+' not '-' in the t1, t2 variable since it corresponds with - N dot O in the above equation in the figure.

Can you elaborate on this one?

Best regards