Skip to content
Snippets Groups Projects
Commit 4d7cd473 authored by mattijs's avatar mattijs
Browse files

use average when merging points to prevent truncation error

parent 43705d78
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,16 @@ bool Foam::mergePoints ...@@ -40,6 +40,16 @@ bool Foam::mergePoints
const point& origin const point& origin
) )
{ {
point compareOrigin = origin;
if (origin == point(VGREAT, VGREAT, VGREAT))
{
if (points.size() > 0)
{
compareOrigin = sum(points)/points.size();
}
}
// Create a old to new point mapping array // Create a old to new point mapping array
pointMap.setSize(points.size()); pointMap.setSize(points.size());
pointMap = -1; pointMap = -1;
...@@ -56,7 +66,7 @@ bool Foam::mergePoints ...@@ -56,7 +66,7 @@ bool Foam::mergePoints
const scalar mergeTolSqr = sqr(mergeTol); const scalar mergeTolSqr = sqr(mergeTol);
// Sort points by magSqr // Sort points by magSqr
SortableList<scalar> sortedMagSqr(magSqr(points - origin)); SortableList<scalar> sortedMagSqr(magSqr(points - compareOrigin));
bool hasMerged = false; bool hasMerged = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment