From 7e4a6bb9aeba183451d7976c9fd5d0e08fcf13bb Mon Sep 17 00:00:00 2001 From: ftomei Date: Tue, 7 Jan 2025 17:45:21 +0100 Subject: [PATCH 1/3] version 2.0 --- pragaProject/pragaShell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pragaProject/pragaShell.cpp b/pragaProject/pragaShell.cpp index 8f793543e..e8fa0cb1c 100644 --- a/pragaProject/pragaShell.cpp +++ b/pragaProject/pragaShell.cpp @@ -900,7 +900,7 @@ int pragaBatch(PragaProject* myProject, QString scriptFileName) attachOutputToConsole(); #endif - myProject->logInfo("\nPRAGA v1.8.3"); + myProject->logInfo("\nPRAGA v2.0.0"); myProject->logInfo("Execute script: " + scriptFileName); if (scriptFileName == "") From d1f7e14b10e950bd0b7cd185146f1b0cf9d9cf01 Mon Sep 17 00:00:00 2001 From: ftomei Date: Fri, 10 Jan 2025 15:52:30 +0100 Subject: [PATCH 2/3] speed shepardSearchNeighbour --- interpolation/interpolation.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/interpolation/interpolation.cpp b/interpolation/interpolation.cpp index 967fa0153..64a2b504d 100644 --- a/interpolation/interpolation.cpp +++ b/interpolation/interpolation.cpp @@ -869,6 +869,22 @@ float shepardSearchNeighbour(vector &inputPoints, } } + // If the points are too few, double the check radius + if (shepardNeighbourPoints.size() <= SHEPARD_MIN_NRPOINTS) + { + float doubleRadius = shepardInitialRadius * 2; + for (unsigned int i=0; i < inputPoints.size(); i++) + { + if (inputPoints[i].distance <= doubleRadius && + inputPoints[i].distance > shepardInitialRadius && + inputPoints[i].index != settings->getIndexPointCV()) + { + shepardNeighbourPoints.push_back(inputPoints[i]); + nrValid++; + } + } + } + if (shepardNeighbourPoints.size() <= SHEPARD_MIN_NRPOINTS) { nrValid = sortPointsByDistance(SHEPARD_MIN_NRPOINTS + 1, inputPoints, outputPoints); From bd241202c9daf787fe8c4bfdb990e43ace95c765 Mon Sep 17 00:00:00 2001 From: ftomei Date: Fri, 10 Jan 2025 16:43:08 +0100 Subject: [PATCH 3/3] speed shepardSearchNeighbour --- interpolation/interpolation.cpp | 30 ++++++++------------------ interpolation/interpolationConstants.h | 4 ++-- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/interpolation/interpolation.cpp b/interpolation/interpolation.cpp index 64a2b504d..531ad1a4a 100644 --- a/interpolation/interpolation.cpp +++ b/interpolation/interpolation.cpp @@ -850,14 +850,11 @@ float shepardSearchNeighbour(vector &inputPoints, Crit3DInterpolationSettings* settings, vector &outputPoints) { - std::vector shepardNeighbourPoints; - - float radius; - unsigned int nrValid = 0; float shepardInitialRadius = computeShepardInitialRadius(settings->getPointsBoundingBoxArea(), unsigned(inputPoints.size()), SHEPARD_AVG_NRPOINTS); // define a first neighborhood inside initial radius + std::vector shepardNeighbourPoints; for (unsigned int i=0; i < inputPoints.size(); i++) { if (inputPoints[i].distance <= shepardInitialRadius && @@ -865,12 +862,11 @@ float shepardSearchNeighbour(vector &inputPoints, inputPoints[i].index != settings->getIndexPointCV()) { shepardNeighbourPoints.push_back(inputPoints[i]); - nrValid++; } } // If the points are too few, double the check radius - if (shepardNeighbourPoints.size() <= SHEPARD_MIN_NRPOINTS) + if (shepardNeighbourPoints.size() < SHEPARD_MIN_NRPOINTS) { float doubleRadius = shepardInitialRadius * 2; for (unsigned int i=0; i < inputPoints.size(); i++) @@ -880,29 +876,21 @@ float shepardSearchNeighbour(vector &inputPoints, inputPoints[i].index != settings->getIndexPointCV()) { shepardNeighbourPoints.push_back(inputPoints[i]); - nrValid++; } } + shepardInitialRadius = doubleRadius; } - if (shepardNeighbourPoints.size() <= SHEPARD_MIN_NRPOINTS) + float radius; + if (shepardNeighbourPoints.size() < SHEPARD_MIN_NRPOINTS) { - nrValid = sortPointsByDistance(SHEPARD_MIN_NRPOINTS + 1, inputPoints, outputPoints); - if (nrValid > SHEPARD_MIN_NRPOINTS) - { - radius = outputPoints[SHEPARD_MIN_NRPOINTS].distance; - outputPoints.pop_back(); - } - else - { - radius = outputPoints[nrValid-1].distance + float(EPSILON); - } + int nrPoints = sortPointsByDistance(SHEPARD_MIN_NRPOINTS, inputPoints, outputPoints); + radius = outputPoints[nrPoints-1].distance + float(EPSILON); } else if (shepardNeighbourPoints.size() > SHEPARD_MAX_NRPOINTS) { - nrValid = sortPointsByDistance(SHEPARD_MAX_NRPOINTS + 1, shepardNeighbourPoints, outputPoints); - radius = outputPoints[SHEPARD_MAX_NRPOINTS].distance; - outputPoints.pop_back(); + int nrPoints = sortPointsByDistance(SHEPARD_MAX_NRPOINTS, shepardNeighbourPoints, outputPoints); + radius = outputPoints[nrPoints-1].distance + float(EPSILON); } else { diff --git a/interpolation/interpolationConstants.h b/interpolation/interpolationConstants.h index d1805a21a..d5324a066 100644 --- a/interpolation/interpolationConstants.h +++ b/interpolation/interpolationConstants.h @@ -3,8 +3,8 @@ #define MIN_REGRESSION_POINTS 5 #define PEARSONSTANDARDTHRESHOLD 0.1 - #define SHEPARD_MIN_NRPOINTS 4 - #define SHEPARD_AVG_NRPOINTS 7 + #define SHEPARD_MIN_NRPOINTS 5 + #define SHEPARD_AVG_NRPOINTS 8 #define SHEPARD_MAX_NRPOINTS 10 #ifndef _STRING_