Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classify method in IvAABB.cpp has a typo issue #60

Open
vagnerlands opened this issue Sep 10, 2021 · 0 comments
Open

Classify method in IvAABB.cpp has a typo issue #60

vagnerlands opened this issue Sep 10, 2021 · 0 comments

Comments

@vagnerlands
Copy link

vagnerlands commented Sep 10, 2021

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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant