46 vtkInformation *vtkNotUsed(request),
47 vtkInformationVector **inputVector,
48 vtkInformationVector *outputVector)
51 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
52 vtkInformation *outInfo = outputVector->GetInformationObject(0);
55 vtkPolyData *input = vtkPolyData::SafeDownCast(
56 inInfo->Get(vtkDataObject::DATA_OBJECT()));
57 vtkPolyData *output = vtkPolyData::SafeDownCast(
58 outInfo->Get(vtkDataObject::DATA_OBJECT()));
60 output->DeepCopy(input);
62 for (
int i=0; i<input->GetNumberOfCells(); i++)
64 vtkCell* line = input->GetCell(i);
65 if (line->GetCellType() != VTK_LINE && line->GetCellType() != VTK_POLY_LINE)
70 vtkPoints* smoothLinePoints = vtkPoints::New();
71 this->
SmoothLine(line->GetPoints(),smoothLinePoints,this->NumberOfSmoothingIterations,this->SmoothingFactor);
73 int numberOfLinePoints = smoothLinePoints->GetNumberOfPoints();
75 for (
int j=0; j<numberOfLinePoints; j++)
77 vtkIdType pointId = line->GetPointId(j);
78 output->GetPoints()->SetPoint(pointId,smoothLinePoints->GetPoint(j));
81 smoothLinePoints->Delete();
89 int numberOfPoints = linePoints->GetNumberOfPoints();
91 smoothLinePoints->DeepCopy(linePoints);
97 for (
int i=0; i<numberOfIterations; i++)
99 for (
int j=1; j<numberOfPoints-1; j++)
101 smoothLinePoints->GetPoint(j-1,point0);
102 smoothLinePoints->GetPoint(j ,point1);
103 smoothLinePoints->GetPoint(j+1,point2);
105 point1[0] += relaxation * (0.5 * (point0[0] + point2[0]) - point1[0]);
106 point1[1] += relaxation * (0.5 * (point0[1] + point2[1]) - point1[1]);
107 point1[2] += relaxation * (0.5 * (point0[2] + point2[2]) - point1[2]);
109 smoothLinePoints->SetPoint(j,point1);