72 double centerlinePoint[3];
95 vtkCell* centerline = input->GetCell(cellId);
97 if (centerline->GetCellType() != VTK_LINE && centerline->GetCellType() != VTK_POLY_LINE)
105 int numberOfCenterlinePoints = centerline->GetNumberOfPoints();
106 int numberOfCenterlineSubIds = centerline->GetNumberOfPoints() - 1;
108 double currentAbscissa = 0.0;
109 vtkDoubleArray* abscissas = vtkDoubleArray::New();
110 abscissas->InsertNextValue(currentAbscissa);
111 double point[3], previousPoint[3];
112 centerline->GetPoints()->GetPoint(0,previousPoint);
114 for (i=1; i<numberOfCenterlinePoints; i++)
116 centerline->GetPoints()->GetPoint(i,point);
117 currentAbscissa += sqrt(vtkMath::Distance2BetweenPoints(previousPoint,point));
118 abscissas->InsertNextValue(currentAbscissa);
119 previousPoint[0] = point[0];
120 previousPoint[1] = point[1];
121 previousPoint[2] = point[2];
124 double halfGapLength = this->
GapLength * 0.5;
126 double centerlinePointAbscissa = (1.0 - centerlinePCoord) * abscissas->GetValue(centerlineSubId) + centerlinePCoord * abscissas->GetValue(centerlineSubId+1);
129 int lastSubId = numberOfCenterlineSubIds - 1;
130 for (i=centerlineSubId; i<numberOfCenterlineSubIds; i++)
132 abscissa = abscissas->GetValue(i+1);
133 if (abscissa - centerlinePointAbscissa > halfGapLength)
139 double lastPCoord = (centerlinePointAbscissa + halfGapLength - abscissas->GetValue(lastSubId)) / (abscissas->GetValue(lastSubId+1) - abscissas->GetValue(lastSubId));
140 if (lastPCoord > 1.0)
142 lastPCoord = 1.0 - 1E-1;
146 for (i=centerlineSubId; i>=0; i--)
148 abscissa = abscissas->GetValue(i);
149 if (centerlinePointAbscissa - abscissa > halfGapLength)
155 double firstPCoord = (centerlinePointAbscissa - halfGapLength - abscissas->GetValue(firstSubId)) / (abscissas->GetValue(firstSubId+1) - abscissas->GetValue(firstSubId));
156 if (firstPCoord < 0.0)
158 firstPCoord = 0.0 + 1E-1;
161 this->
SubIds[0] = firstSubId;
162 this->
PCoords[0] = firstPCoord;
164 this->
SubIds[1] = lastSubId;
192 double centerlinePoint[3];
197 if (tubeFunctionValue2 > this->
Tolerance)
205 double centerlinePoint2[3];
228 vtkCell* centerline = input->GetCell(cellId);
230 if (centerline->GetCellType() != VTK_LINE && centerline->GetCellType() != VTK_POLY_LINE)
238 if (centerlineSubId > centerlineSubId2 || (centerlineSubId == centerlineSubId2 && centerlinePCoord > centerlinePCoord2))
240 this->
SubIds[0] = centerlineSubId;
241 this->
PCoords[0] = centerlinePCoord;
243 this->
SubIds[1] = centerlineSubId2;
244 this->
PCoords[1] = centerlinePCoord2;
248 this->
SubIds[0] = centerlineSubId2;
249 this->
PCoords[0] = centerlinePCoord2;
251 this->
SubIds[1] = centerlineSubId;
252 this->
PCoords[1] = centerlinePCoord;