15 #include <vtkCellArray.h> 17 #include <vtkPoints.h> 18 #include <vtkPolyData.h> 45 vtkSmartPointer<vtkPoints> points =
46 vtkSmartPointer<vtkPoints>::New();
53 double stepsize = 0.05;
54 double jaggedsize = 0.001;
58 double x = x0 + i * stepsize;
61 y += jaggedsize*std::pow(-1, i+1);
63 points->InsertPoint(i, x, y, z);
70 double x = x0 + i * stepsize;
71 double y = (i - n1 + 1)*stepsize;
73 y += jaggedsize*std::pow(-1, i+1);
75 points->InsertPoint(i, x, y, z);
80 while (i < n1 + n2 + n3)
82 double x = x0 + (i-n2)* stepsize;
83 double y = (i - (n1+n2) + 1)*(-stepsize);
85 y += jaggedsize*std::pow(-1, i+1);
87 points->InsertPoint(i, x, y, z);
93 vtkSmartPointer<vtkCellArray> lines =
94 vtkSmartPointer<vtkCellArray>::New();
97 for (
unsigned int i = 0; i < points->GetNumberOfPoints()-n3-1; ++i)
99 vtkSmartPointer<vtkLine> line =
100 vtkSmartPointer<vtkLine>::New();
101 line->GetPointIds()->SetId(0, i);
102 line->GetPointIds()->SetId(1, i + 1);
103 lines->InsertNextCell(line);
112 vtkSmartPointer<vtkLine> line =
113 vtkSmartPointer<vtkLine>::New();
114 line->GetPointIds()->SetId(0, i);
115 line->GetPointIds()->SetId(1, i + n2 +1);
116 lines->InsertNextCell(line);
119 for (
unsigned int i = points->GetNumberOfPoints() - n3; i < points->GetNumberOfPoints()-1; ++i)
121 vtkSmartPointer<vtkLine> line =
122 vtkSmartPointer<vtkLine>::New();
123 line->GetPointIds()->SetId(0, i);
124 line->GetPointIds()->SetId(1, i + 1);
125 lines->InsertNextCell(line);
130 vtkSmartPointer<vtkPolyData> linesPolyData =
131 vtkSmartPointer<vtkPolyData>::New();
134 linesPolyData->SetPoints(points);
137 linesPolyData->SetLines(lines);
139 return linesPolyData;
vtkSmartPointer< class vtkPolyData > vtkPolyDataPtr
vtkPolyDataPtr makeDummyCenterLine(int nfork1=100, int nfork2=100, int nfork3=100, int x0=0)
makeDummyCenterLine This function makes a vtkPolyDataPtr to a dummy centerline looking like a fork: -...