MCPcopy Create free account
hub / github.com/Kitware/VTK / RequestData

Method RequestData

Filters/Modeling/vtkHausdorffDistancePointSetFilter.cxx:41–207  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

39
40//------------------------------------------------------------------------------
41int vtkHausdorffDistancePointSetFilter::RequestData(vtkInformation* vtkNotUsed(request),
42 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
43{
44 // Get the info objects
45 vtkInformation* inInfoA = inputVector[0]->GetInformationObject(0);
46 vtkInformation* inInfoB = inputVector[1]->GetInformationObject(0);
47 vtkInformation* outInfoA = outputVector->GetInformationObject(0);
48 vtkInformation* outInfoB = outputVector->GetInformationObject(1);
49
50 if (inInfoA == nullptr || inInfoB == nullptr)
51 {
52 return 0;
53 }
54
55 // Get the input
56 vtkPointSet* inputA = vtkPointSet::SafeDownCast(inInfoA->Get(vtkDataObject::DATA_OBJECT()));
57 vtkPointSet* inputB = vtkPointSet::SafeDownCast(inInfoB->Get(vtkDataObject::DATA_OBJECT()));
58 vtkPointSet* outputA = vtkPointSet::SafeDownCast(outInfoA->Get(vtkDataObject::DATA_OBJECT()));
59 vtkPointSet* outputB = vtkPointSet::SafeDownCast(outInfoB->Get(vtkDataObject::DATA_OBJECT()));
60
61 if (inputA->GetNumberOfPoints() == 0 || inputB->GetNumberOfPoints() == 0)
62 {
63 return 0;
64 }
65
66 // Re-initialize the distances
67 this->RelativeDistance[0] = 0.0;
68 this->RelativeDistance[1] = 0.0;
69 this->HausdorffDistance = 0.0;
70
71 // TODO: using vtkStaticCellLocator, vtkStaticPointLocator is going to be much faster.
72 // Need to investigate and replace if appropriate.
73 vtkSmartPointer<vtkKdTreePointLocator> pointLocatorA =
74 vtkSmartPointer<vtkKdTreePointLocator>::New();
75 vtkSmartPointer<vtkKdTreePointLocator> pointLocatorB =
76 vtkSmartPointer<vtkKdTreePointLocator>::New();
77
78 vtkSmartPointer<vtkCellLocator> cellLocatorA = vtkSmartPointer<vtkCellLocator>::New();
79 vtkSmartPointer<vtkCellLocator> cellLocatorB = vtkSmartPointer<vtkCellLocator>::New();
80
81 if (this->TargetDistanceMethod == POINT_TO_POINT)
82 {
83 pointLocatorA->SetDataSet(inputA);
84 pointLocatorA->BuildLocator();
85 pointLocatorB->SetDataSet(inputB);
86 pointLocatorB->BuildLocator();
87 }
88 else
89 {
90 cellLocatorA->SetDataSet(inputA);
91 cellLocatorA->BuildLocator();
92 cellLocatorB->SetDataSet(inputB);
93 cellLocatorB->BuildLocator();
94 }
95
96 double dist;
97 double currentPoint[3];
98 double closestPoint[3];

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
CheckAbortMethod · 0.80
NewFunction · 0.50
sqrtFunction · 0.50
powFunction · 0.50
maxFunction · 0.50
GetMethod · 0.45
GetNumberOfPointsMethod · 0.45
SetDataSetMethod · 0.45
BuildLocatorMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected