You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, the instructions in the book are correct, but the code in github has a typo issue.
The diagMin, diagMax should be inverted if the normal is negative (i.e., diagMin.x = mMaxima.x; diagMax.x = mMinima.x).
Second issue, is that for Y axis we're comparing "x" instead of "y" (should be: plane.GetNormal().y, instead of plane.GetNormal().x).
Here is how the code should be:
// set min/max values for x direction
if ( plane.GetNormal().x >= 0.0f )
{
diagMin.x = mMinima.x;
diagMax.x = mMaxima.x;
}
else
{
diagMin.x = mMaxima.x;
diagMax.x = mMinima.x;
}
// set min/max values for y direction
if ( plane.GetNormal().y >= 0.0f )
{
diagMin.y = mMinima.y;
diagMax.y = mMaxima.y;
}
else
{
diagMin.y = mMaxima.y;
diagMax.y = mMinima.y;
}
// set min/max values for z direction
if ( plane.GetNormal().z >= 0.0f )
{
diagMin.z = mMinima.z;
diagMax.z = mMaxima.z;
}
else
{
diagMin.z = mMaxima.z;
diagMax.z = mMinima.z;
}
The text was updated successfully, but these errors were encountered:
Hello, the instructions in the book are correct, but the code in github has a typo issue.
The diagMin, diagMax should be inverted if the normal is negative (i.e., diagMin.x = mMaxima.x; diagMax.x = mMinima.x).
Second issue, is that for Y axis we're comparing "x" instead of "y" (should be: plane.GetNormal().y, instead of plane.GetNormal().x).
Here is how the code should be:
The text was updated successfully, but these errors were encountered: