Skip to content

Instantly share code, notes, and snippets.

@ArchdukeTim
Created December 4, 2016 22:55
Show Gist options
  • Save ArchdukeTim/fccec51a8ace93e13a63e1597c83d4fc to your computer and use it in GitHub Desktop.
Save ArchdukeTim/fccec51a8ace93e13a63e1597c83d4fc to your computer and use it in GitHub Desktop.
while (change >= tolerance)
{
change = 0.0;
for (int i = 1; i < path.length - 1; i++)
{
for (int j = 0; j < path[i].length; j++)
{
double aux = newPath[i][j];
newPath[i][j] += (weight_data * (path[i][j] - newPath[i][j])) + (weight_smooth * (newPath[i - 1][j] + newPath[i + 1][j] - (2.0 * newPath[i][j])));
change += Math.abs(aux - newPath[i][j]);
}
}
}
while change >= tolerance:
change = 0.0
for i in range(1, len(path) - 1):
for j in range(0, len(path[i])):
aux = newPath[i][j]
index+=1
newPath[i][j] += (weight_data * (path[i][j] - newPath[i][j])) + (weight_smooth * (newPath[i - 1][j] + newPath[i + 1][j] - (2.0 * newPath[i][j])))
change += abs(aux - newPath[i][j])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment