box2d
box2d copied to clipboard
unnecessary compassion in b2_collision.cpp
if (count < 3 || count > b2_maxPolygonVertices)
{
// check your data
return hull;
}
count = b2Min(count, b2_maxPolygonVertices); //this line is unnecessary
How?
count must always be less than or equal to b2_maxPolygonVertices according to the preceding if statement, so the call to b2Min is not required.
@krabhi7 this is same as
if(count < 3) {
return hull;
}
if(count > b2_maxPolygonVertices) {
return hull;
}
count = b2Min(count, b2_maxPolygonVertices); // count <= b2_maxPolygonVertices because of early return