From 4e13f0afa5c6f3583de1d112454c1181d6de9ea7 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Sat, 11 Jan 2014 22:23:55 +0000 Subject: [PATCH] Checking for zero exactly gives better solutions to QEF --- .../include/PolyVoxCore/DualContouringSurfaceExtractor.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl index 545ab542..1523659c 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/DualContouringSurfaceExtractor.inl @@ -69,7 +69,7 @@ namespace PolyVox } edge.normal = (gA * edge.fraction + gB * (1.0f-edge.fraction)); - if(edge.normal.lengthSquared() > 0.000001f) + if(edge.normal.lengthSquared() != 0.0f) { edge.normal.normalise(); } @@ -141,7 +141,7 @@ namespace PolyVox const auto& vertexPosition = evaluateQEF(matrix, vector, rows) + massPoint; - if(cellVertexNormal.lengthSquared() > 0.000001f) + if(cellVertexNormal.lengthSquared() != 0.0f) { cellVertexNormal.normalise(); }