Skip to content

Commit

Permalink
speed shepardSearchNeighbour
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Jan 10, 2025
1 parent 55fec0e commit d1f7e14
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions interpolation/interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,22 @@ float shepardSearchNeighbour(vector <Crit3DInterpolationDataPoint> &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);
Expand Down

0 comments on commit d1f7e14

Please sign in to comment.