From af308cb1876db164ab108d798729d4a04009bb69 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Sat, 11 Jan 2014 19:55:56 +0000 Subject: [PATCH] Change logic for calculating whether there was an intersection --- .../PolyVoxCore/DualContouringSurfaceExtractor.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl index a35ffaef..8c988f83 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl @@ -56,14 +56,14 @@ namespace PolyVox edge.fraction = static_cast(vA - threshold) / static_cast(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; - return edge; + edge.intersects = true; } else { - edge.intersects = true; + edge.intersects = false; + return edge; } edge.normal = (gA * edge.fraction + gB * (1.0f-edge.fraction));