Skip to content

Commit

Permalink
Another divide by zero avoided
Browse files Browse the repository at this point in the history
  • Loading branch information
atupone committed May 1, 2024
1 parent 9647e26 commit a6a1050
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/geometry/WallSceneNode.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,14 @@ void WallSceneNode::setNumLODs(int num, float* areas)

void WallSceneNode::setPlane(const GLfloat _plane[4])
{
// get normalization factor
const float n = 1.0f / sqrtf((_plane[0] * _plane[0]) +
(_plane[1] * _plane[1]) +
(_plane[2] * _plane[2]));
float n = 1.0f;
if (_plane[0] || _plane[1] || _plane[2])
{
// get normalization factor
n = 1.0f / sqrtf((_plane[0] * _plane[0]) +
(_plane[1] * _plane[1]) +
(_plane[2] * _plane[2]));
}

// store normalized plane equation
plane[0] = n * _plane[0];
Expand Down

0 comments on commit a6a1050

Please sign in to comment.