show the mesh and id of the point farthest from the other mesh

This commit is contained in:
papush! 2022-03-30 09:36:00 +02:00
parent f4597b0144
commit 52f26364fd
3 changed files with 16 additions and 2 deletions

View File

@ -142,6 +142,8 @@ int main(int argc, char **argv) {
maxDistanceFilter->Update();
std::cerr << "Max distance: " << maxDistanceFilter->GetMaxDist() << "\n"
<< "Max dist point id: " << maxDistanceFilter->GetMaxId()
<< " in " << (maxDistanceFilter->GetMaxInput() == 0 ? "tetMesh\n" : "polyMesh\n")
<< "Average min angle: " << dihedralAnglesFilter->GetAverageMinDegrees() << "\n"
<< "Min min angle: " << dihedralAnglesFilter->GetMinMinDegrees() << "\n";

View File

@ -51,7 +51,11 @@ vtkTypeBool MaxDistanceFilter::RequestData(vtkInformation *request,
double vec[3];
double dist;
closestPolyMeshPoint(input2, point, tree2, links2, vec, &dist);
MaxDist = std::max(dist, MaxDist);
if (dist > MaxDist) {
MaxDist = dist;
MaxId = i;
MaxInput = 0;
}
}
for (vtkIdType i = 0; i < input2->GetNumberOfPoints(); i++) {
vtkIdType nCells = links2->GetNcells(i);
@ -61,7 +65,11 @@ vtkTypeBool MaxDistanceFilter::RequestData(vtkInformation *request,
double vec[3];
double dist;
closestPolyMeshPoint(input1, point, tree1, links1, vec, &dist);
MaxDist = std::max(dist, MaxDist);
if (dist > MaxDist) {
MaxDist = dist;
MaxId = i;
MaxInput = 1;
}
}
return true;
}

View File

@ -14,9 +14,13 @@ public:
vtkInformationVector **inputVector,
vtkInformationVector *outputVector) override;
vtkGetMacro(MaxDist, double);
vtkGetMacro(MaxId, vtkIdType);
vtkGetMacro(MaxInput, vtkIdType);
protected:
double MaxDist;
vtkIdType MaxId;
vtkIdType MaxInput;
};