From b8719c144ca530dc497fc4f60ac5cf862d05f97c Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 7 Oct 2015 14:04:05 +0300 Subject: [PATCH] Fix for the issue #1019 --- src/Model/Model_AttributeSelection.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index abbf60009..7bc7217dc 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -488,7 +488,7 @@ bool Model_AttributeSelection::update() } } } - double aBestFound = 0; // best percentage of found edges + int aBestFound = 0; // best number of found edges (not percentage: issue 1019) int aBestOrient = 0; // for the equal "BestFound" additional parameter is orientation for(int aFaceIndex = 0; aFaceIndex < aConstructionContext->facesNum(); aFaceIndex++) { int aFound = 0, aNotFound = 0, aSameOrientation = 0; @@ -517,12 +517,9 @@ bool Model_AttributeSelection::update() } } if (aFound + aNotFound != 0) { - double aSum = aFound + aNotFound; - // aSameOrientation: if edges are same, take where orientation is better - double aPercentage = double(aFound) / double(aFound + aNotFound); - if (aPercentage > aBestFound || - (aPercentage == aBestFound && aSameOrientation > aBestOrient)) { - aBestFound = aPercentage; + if (aFound > aBestFound || + (aFound == aBestFound && aSameOrientation > aBestOrient)) { + aBestFound = aFound; aBestOrient = aSameOrientation; aNewSelected = aConstructionContext->face(aFaceIndex); } -- 2.39.2