fix mesh distance computation
This commit is contained in:
parent
0a7202dc57
commit
70afbbcdfc
@ -15,7 +15,6 @@ vtkIdType findClosestPoint(const double *point, vtkPointSet *pointSet) {
|
|||||||
minPoint = i;
|
minPoint = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cerr << "closest: " << minPoint << "\n";
|
|
||||||
return minPoint;
|
return minPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@ vtkTypeBool MaxDistanceFilter::RequestData(vtkInformation *request,
|
|||||||
links2->BuildLinks(input2);
|
links2->BuildLinks(input2);
|
||||||
MaxDist = 0;
|
MaxDist = 0;
|
||||||
for (vtkIdType i = 0; i < input1->GetNumberOfPoints(); i++) {
|
for (vtkIdType i = 0; i < input1->GetNumberOfPoints(); i++) {
|
||||||
|
vtkIdType nCells = links1->GetNcells(i);
|
||||||
|
if (nCells == 0) continue;
|
||||||
double point[3];
|
double point[3];
|
||||||
input1->GetPoint(i, point);
|
input1->GetPoint(i, point);
|
||||||
double vec[3];
|
double vec[3];
|
||||||
@ -52,6 +54,8 @@ vtkTypeBool MaxDistanceFilter::RequestData(vtkInformation *request,
|
|||||||
MaxDist = std::max(dist, MaxDist);
|
MaxDist = std::max(dist, MaxDist);
|
||||||
}
|
}
|
||||||
for (vtkIdType i = 0; i < input2->GetNumberOfPoints(); i++) {
|
for (vtkIdType i = 0; i < input2->GetNumberOfPoints(); i++) {
|
||||||
|
vtkIdType nCells = links2->GetNcells(i);
|
||||||
|
if (nCells == 0) continue;
|
||||||
double point[3];
|
double point[3];
|
||||||
input2->GetPoint(i, point);
|
input2->GetPoint(i, point);
|
||||||
double vec[3];
|
double vec[3];
|
||||||
|
@ -82,7 +82,7 @@ void ProjectSurfacePointsOnPoly::moveSurfacePoint(
|
|||||||
auto affectedPoints = removeSurfacePoints(pointsInRadius, isSurface);
|
auto affectedPoints = removeSurfacePoints(pointsInRadius, isSurface);
|
||||||
// tetMeshKdTree->FindPointsWithinRadius(distance * RadiusScale, point, affectedPoints);
|
// 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);
|
vtkIdType affectedPointId = affectedPoints->GetId(j);
|
||||||
double affectedPoint[3];
|
double affectedPoint[3];
|
||||||
tetMesh->GetPoint(affectedPointId, affectedPoint);
|
tetMesh->GetPoint(affectedPointId, affectedPoint);
|
||||||
@ -97,7 +97,6 @@ void ProjectSurfacePointsOnPoly::moveSurfacePoint(
|
|||||||
double motion[3] = {direction[0], direction[1], direction[2]};
|
double motion[3] = {direction[0], direction[1], direction[2]};
|
||||||
double factor = 1. - std::sqrt(dist2) / (distance * RadiusScale);
|
double factor = 1. - std::sqrt(dist2) / (distance * RadiusScale);
|
||||||
vtkMath::MultiplyScalar(motion, factor);
|
vtkMath::MultiplyScalar(motion, factor);
|
||||||
//std::cout << std::sqrt(dist2) << " " << (distance * radiusScale) << " " << factor << "\n";
|
|
||||||
motionVectors[affectedPointId * 3 + 0] += motion[0];
|
motionVectors[affectedPointId * 3 + 0] += motion[0];
|
||||||
motionVectors[affectedPointId * 3 + 1] += motion[1];
|
motionVectors[affectedPointId * 3 + 1] += motion[1];
|
||||||
motionVectors[affectedPointId * 3 + 2] += motion[2];
|
motionVectors[affectedPointId * 3 + 2] += motion[2];
|
||||||
|
Loading…
Reference in New Issue
Block a user