Change logic for calculating whether there was an intersection

This commit is contained in:
Matt Williams 2014-01-11 19:55:56 +00:00
parent 1d7d66a1de
commit af308cb187

View File

@ -56,14 +56,14 @@ namespace PolyVox
edge.fraction = static_cast<float>(vA - threshold) / static_cast<float>(vA - vB); edge.fraction = static_cast<float>(vA - threshold) / static_cast<float>(vA - vB);
if(edge.fraction > 1.0 || edge.fraction < 0.0) if(std::min(vA,vB) <= threshold && std::max(vA,vB) > threshold)
{ {
edge.intersects = false; edge.intersects = true;
return edge;
} }
else else
{ {
edge.intersects = true; edge.intersects = false;
return edge;
} }
edge.normal = (gA * edge.fraction + gB * (1.0f-edge.fraction)); edge.normal = (gA * edge.fraction + gB * (1.0f-edge.fraction));