80 double closestPoint[3];
82 double dist2, minDist2;
84 vtkPolyLine* polyLine;
87 for (i=0; i<this->
Target->GetNumberOfCells(); i++)
89 polyLine = vtkPolyLine::SafeDownCast(this->
Target->GetCell(i));
94 weights =
new double[polyLine->GetNumberOfPoints()];
95 polyLine->EvaluatePosition(currentPoint,closestPoint,subId,parCoords,dist2,weights);
101 lineCellSubId = subId;
102 linePCoord = parCoords[0];
103 lineClosestPoint[0] = closestPoint[0];
104 lineClosestPoint[1] = closestPoint[1];
105 lineClosestPoint[2] = closestPoint[2];
116 double currentPoint[3], currentScalar;
118 vtkIdType currentEdge[2], steepestDescentEdge[2];
119 double steepestDescentS;
120 double previousPoint[3], lineClosestPoint[3];
122 int lineCellId, lineCellSubId;
127 input->GetPoint(seedId,seedPoint);
128 currentPoint[0] = seedPoint[0];
129 currentPoint[1] = seedPoint[1];
130 currentPoint[2] = seedPoint[2];
132 previousPoint[0] = seedPoint[0];
133 previousPoint[1] = seedPoint[1];
134 previousPoint[2] = seedPoint[2];
138 currentEdge[0] = seedId;
139 currentEdge[1] = seedId;
144 if (((this->
TargetArray->GetValue(currentEdge[0])!=-1) && (this->TargetArray->GetValue(currentEdge[1])!=-1)))
147 vector[0] = lineClosestPoint[0] - seedPoint[0];
148 vector[1] = lineClosestPoint[1] - seedPoint[1];
149 vector[2] = lineClosestPoint[2] - seedPoint[2];
159 if (currentScalar==0.0)
167 this->
GetSteepestDescent(input,currentEdge,currentS,steepestDescentEdge,steepestDescentS);
169 currentEdge[0] = steepestDescentEdge[0];
170 currentEdge[1] = steepestDescentEdge[1];
171 currentS = steepestDescentS;
173 previousPoint[0] = currentPoint[0];
174 previousPoint[1] = currentPoint[1];
175 previousPoint[2] = currentPoint[2];
179 double edgePoint0[3], edgePoint1[3];
180 input->GetPoint(currentEdge[0], edgePoint0);
181 input->GetPoint(currentEdge[1], edgePoint1);
182 currentPoint[0] = edgePoint0[0] * (1.0 - currentS) + edgePoint1[0] * currentS;
183 currentPoint[1] = edgePoint0[1] * (1.0 - currentS) + edgePoint1[1] * currentS;
184 currentPoint[2] = edgePoint0[2] * (1.0 - currentS) + edgePoint1[2] * currentS;
187 currentScalar = this->
DescentArray->GetTuple1(currentEdge[0]) * (1.0 - currentS) + this->
DescentArray->GetTuple1(currentEdge[1]) * currentS;
193 vtkInformation *vtkNotUsed(request),
194 vtkInformationVector **inputVector,
195 vtkInformationVector *outputVector)
197 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
198 vtkInformation *outInfo = outputVector->GetInformationObject(0);
200 vtkPolyData *input = vtkPolyData::SafeDownCast(
201 inInfo->Get(vtkDataObject::DATA_OBJECT()));
202 vtkPolyData *output = vtkPolyData::SafeDownCast(
203 outInfo->Get(vtkDataObject::DATA_OBJECT()));
205 vtkIdType i, j, k, h, l, m;
207 vtkIdType npts, targetNpts, *cells;
208 const vtkIdType *pts;
209 const vtkIdType *targetPts;
214 vtkErrorMacro(
"Descent array name not specified.");
218 if (!input->GetPointData()->GetArray(this->DescentArrayName))
220 vtkErrorMacro(<<
"Descent array with name specified does not exist!");
226 vtkErrorMacro(<<
"No seeds specified!");
232 vtkErrorMacro(<<
"No target specified!");
238 vtkErrorMacro(<<
"No edge array name specified!");
242 if (!this->
Target->GetPointData()->GetArray(this->EdgeArrayName))
244 vtkErrorMacro(<<
"Edge array with name specified does not exist in target!");
281 this->
TargetVectors->SetNumberOfTuples(input->GetNumberOfPoints());
282 this->
TargetCellIds->SetNumberOfTuples(input->GetNumberOfPoints());
283 this->
TargetPCoords->SetNumberOfTuples(input->GetNumberOfPoints());
295 this->
TargetArray->SetNumberOfTuples(input->GetNumberOfPoints());
298 this->
Target->BuildCells();
300 for (h=this->
Target->GetNumberOfCells()-1; h>=0; h--)
302 this->
Target->GetCellPoints(h,targetNpts,targetPts);
303 for (l=0; l<targetNpts; l++)
307 input->GetPointCells(
static_cast<vtkIdType
>(this->
EdgeArray->GetComponent(targetPts[l],m)),ncells,cells);
308 for (j=0; j<ncells; j++)
310 input->GetCellPoints(cells[j],npts,pts);
311 for (k=0; k<npts; k++)
320 for (i=0; i<this->
Seeds->GetNumberOfIds(); i++)
322 poleId = this->
Seeds->GetId(i);
326 output->CopyStructure(input);
327 output->GetPointData()->PassData(input->GetPointData());
328 output->GetCellData()->PassData(input->GetCellData());