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

Method CleanAndCheckInput

Filters/General/vtkIntersectionPolyDataFilter.cxx:2186–2226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2184}
2185
2186void vtkIntersectionPolyDataFilter::CleanAndCheckInput(vtkPolyData* pd, double tolerance)
2187{
2188 vtkSmartPointer<vtkCleanPolyData> cleaner = vtkSmartPointer<vtkCleanPolyData>::New();
2189 vtkSmartPointer<vtkTriangleFilter> triangulator = vtkSmartPointer<vtkTriangleFilter>::New();
2190 vtkSmartPointer<vtkPolyDataNormals> normaler = vtkSmartPointer<vtkPolyDataNormals>::New();
2191
2192 // vtkDebugMacro(<<"Cleaning");
2193 cleaner->SetInputData(pd);
2194 cleaner->ToleranceIsAbsoluteOn();
2195 cleaner->SetAbsoluteTolerance(tolerance);
2196 cleaner->Update();
2197 // vtkDebugMacro(<<"Triangulating");
2198 triangulator->SetInputData(cleaner->GetOutput());
2199 triangulator->Update();
2200 // vtkDebugMacro(<<"Getting Normals");
2201 normaler->SetInputData(triangulator->GetOutput());
2202 normaler->AutoOrientNormalsOn();
2203 normaler->SplittingOff();
2204 normaler->ComputeCellNormalsOn();
2205 normaler->Update();
2206
2207 const vtkIdType* cellPts;
2208 vtkIdType npts;
2209 double pt0[3], pt1[3], pt2[3];
2210 normaler->GetOutput()->GetPolys()->GetCellAtId(0, npts, cellPts);
2211 normaler->GetOutput()->GetPoints()->GetPoint(cellPts[0], pt0);
2212 normaler->GetOutput()->GetPoints()->GetPoint(cellPts[1], pt1);
2213 normaler->GetOutput()->GetPoints()->GetPoint(cellPts[2], pt2);
2214
2215 double v1[3], v2[3], cellNorm[3];
2216 for (int i = 0; i < 3; i++)
2217 {
2218 v1[i] = pt1[i] - pt0[i];
2219 v2[i] = pt2[i] - pt1[i];
2220 }
2221 vtkMath::Cross(v1, v2, cellNorm);
2222
2223 double arrayNormal[3];
2224 // vtkDebugMacro(<<"Getting Normal Array");
2225 normaler->GetOutput()->GetCellData()->GetNormals("Normals")->GetTuple(0, arrayNormal);
2226}
2227
2228//------------------------------------------------------------------------------
2229int vtkIntersectionPolyDataFilter::RequestData(vtkInformation* vtkNotUsed(request),

Callers 1

RequestDataMethod · 0.95

Calls 12

GetPolysMethod · 0.80
NewFunction · 0.50
CrossFunction · 0.50
SetInputDataMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45
GetCellAtIdMethod · 0.45
GetPointMethod · 0.45
GetPointsMethod · 0.45
GetTupleMethod · 0.45
GetNormalsMethod · 0.45
GetCellDataMethod · 0.45

Tested by

no test coverage detected