fix mesh distance computation

This commit is contained in:
papush! 2022-03-24 15:13:57 +01:00
parent 0a7202dc57
commit 70afbbcdfc
3 changed files with 5 additions and 3 deletions

View File

@ -15,7 +15,6 @@ vtkIdType findClosestPoint(const double *point, vtkPointSet *pointSet) {
minPoint = i;
}
}
std::cerr << "closest: " << minPoint << "\n";
return minPoint;
}

View File

@ -44,6 +44,8 @@ vtkTypeBool MaxDistanceFilter::RequestData(vtkInformation *request,
links2->BuildLinks(input2);
MaxDist = 0;
for (vtkIdType i = 0; i < input1->GetNumberOfPoints(); i++) {
vtkIdType nCells = links1->GetNcells(i);
if (nCells == 0) continue;
double point[3];
input1->GetPoint(i, point);
double vec[3];
@ -52,6 +54,8 @@ vtkTypeBool MaxDistanceFilter::RequestData(vtkInformation *request,
MaxDist = std::max(dist, MaxDist);
}
for (vtkIdType i = 0; i < input2->GetNumberOfPoints(); i++) {
vtkIdType nCells = links2->GetNcells(i);
if (nCells == 0) continue;
double point[3];
input2->GetPoint(i, point);
double vec[3];

View File

@ -82,7 +82,7 @@ void ProjectSurfacePointsOnPoly::moveSurfacePoint(
auto affectedPoints = removeSurfacePoints(pointsInRadius, isSurface);
// tetMeshKdTree->FindPointsWithinRadius(distance * RadiusScale, point, affectedPoints);
if(distance > 0) for (vtkIdType j = 0; j < affectedPoints->GetNumberOfIds(); j++) {
for (vtkIdType j = 0; j < affectedPoints->GetNumberOfIds(); j++) {
vtkIdType affectedPointId = affectedPoints->GetId(j);
double affectedPoint[3];
tetMesh->GetPoint(affectedPointId, affectedPoint);
@ -97,7 +97,6 @@ void ProjectSurfacePointsOnPoly::moveSurfacePoint(
double motion[3] = {direction[0], direction[1], direction[2]};
double factor = 1. - std::sqrt(dist2) / (distance * RadiusScale);
vtkMath::MultiplyScalar(motion, factor);
//std::cout << std::sqrt(dist2) << " " << (distance * radiusScale) << " " << factor << "\n";
motionVectors[affectedPointId * 3 + 0] += motion[0];
motionVectors[affectedPointId * 3 + 1] += motion[1];
motionVectors[affectedPointId * 3 + 2] += motion[2];