-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
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;
}
Metadata
Metadata
Assignees
Labels
No labels