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

Method RequestData

Filters/General/vtkPointsMatchingTransformFilter.cxx:95–136  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

93
94//------------------------------------------------------------------------------
95int vtkPointsMatchingTransformFilter::RequestData(vtkInformation* vtkNotUsed(request),
96 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
97{
98 vtkSmartPointer<vtkPointSet> input = vtkPointSet::GetData(inputVector[0]);
99 vtkSmartPointer<vtkPointSet> output = vtkPointSet::GetData(outputVector);
100 if (!input)
101 {
102 vtkErrorMacro(<< "Invalid or missing input");
103 return 0;
104 }
105
106 // Build transform matrix
107 vtkNew<vtkMatrix4x4> srcInv;
108 srcInv->DeepCopy(this->SourceMatrix);
109 if (std::abs(srcInv->Determinant()) < 10e-4)
110 {
111 vtkWarningMacro("Source matrix is not invertible. Source points are likely coplanar.");
112 output->ShallowCopy(input);
113 return 1;
114 }
115 srcInv->Invert();
116 vtkNew<vtkMatrix4x4> transformMatrix;
117 vtkMatrix4x4::Multiply4x4(this->TargetMatrix, srcInv, transformMatrix);
118
119 if (this->RigidTransform)
120 {
121 vtkSmartPointer<vtkMatrix3x3> rotation = ::ExtractRotationFromMatrix4x4(transformMatrix);
122 rotation = ::PolarDecomposition(rotation);
123 ::SetRotationInMatrix4x4(rotation, transformMatrix);
124 }
125
126 // Apply the transform
127 vtkNew<vtkTransform> transform;
128 transform->SetMatrix(transformMatrix);
129 vtkNew<vtkTransformFilter> transformFilter;
130 transformFilter->SetInputData(input);
131 transformFilter->SetTransform(transform);
132 transformFilter->Update();
133
134 output->ShallowCopy(transformFilter->GetOutput());
135 return 1;
136}
137
138//------------------------------------------------------------------------------
139void vtkPointsMatchingTransformFilter::SetSourcePoint1(double x, double y, double z)

Callers

nothing calls this directly

Calls 14

PolarDecompositionFunction · 0.85
SetRotationInMatrix4x4Function · 0.85
GetDataFunction · 0.50
absFunction · 0.50
DeepCopyMethod · 0.45
DeterminantMethod · 0.45
ShallowCopyMethod · 0.45
InvertMethod · 0.45
SetMatrixMethod · 0.45
SetInputDataMethod · 0.45
SetTransformMethod · 0.45

Tested by

no test coverage detected