Fixed a false positive in sphere vs polyhedron
This commit is contained in:
parent
ec945693aa
commit
6663156405
|
@ -325,8 +325,15 @@ namespace SHADE
|
||||||
// Check Region C
|
// Check Region C
|
||||||
// Face to vertex is in the opposite direction of any tangent.
|
// Face to vertex is in the opposite direction of any tangent.
|
||||||
const float PROJECTION = SHVec3::Dot(FACE_TO_CENTER, tangent1);
|
const float PROJECTION = SHVec3::Dot(FACE_TO_CENTER, tangent1);
|
||||||
if (PROJECTION < 0)
|
if (PROJECTION < 0.0f)
|
||||||
|
{
|
||||||
|
const float DISTANCE_SQUARED = SHVec3::DistanceSquared(faceVertex, CENTER);
|
||||||
|
if (DISTANCE_SQUARED > RADIUS * RADIUS)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return 3;
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Belongs in region D by default
|
// Belongs in region D by default
|
||||||
return 4;
|
return 4;
|
||||||
|
|
Loading…
Reference in New Issue