36 #include <vtkCellArray.h> 38 #include <vtkPoints.h> 39 #include <vtkPolyData.h> 66 vtkSmartPointer<vtkPoints> points =
67 vtkSmartPointer<vtkPoints>::New();
74 double stepsize = 0.05;
75 double jaggedsize = 0.001;
79 double x = x0 + i * stepsize;
82 y += jaggedsize*std::pow(-1, i+1);
84 points->InsertPoint(i, x, y, z);
91 double x = x0 + i * stepsize;
92 double y = (i - n1 + 1)*stepsize;
94 y += jaggedsize*std::pow(-1, i+1);
96 points->InsertPoint(i, x, y, z);
101 while (i < n1 + n2 + n3)
103 double x = x0 + (i-n2)* stepsize;
104 double y = (i - (n1+n2) + 1)*(-stepsize);
106 y += jaggedsize*std::pow(-1, i+1);
108 points->InsertPoint(i, x, y, z);
114 vtkSmartPointer<vtkCellArray> lines =
115 vtkSmartPointer<vtkCellArray>::New();
118 for (
unsigned int i = 0; i < points->GetNumberOfPoints()-n3-1; ++i)
120 vtkSmartPointer<vtkLine> line =
121 vtkSmartPointer<vtkLine>::New();
122 line->GetPointIds()->SetId(0, i);
123 line->GetPointIds()->SetId(1, i + 1);
124 lines->InsertNextCell(line);
133 vtkSmartPointer<vtkLine> line =
134 vtkSmartPointer<vtkLine>::New();
135 line->GetPointIds()->SetId(0, i);
136 line->GetPointIds()->SetId(1, i + n2 +1);
137 lines->InsertNextCell(line);
140 for (
unsigned int i = points->GetNumberOfPoints() - n3; i < points->GetNumberOfPoints()-1; ++i)
142 vtkSmartPointer<vtkLine> line =
143 vtkSmartPointer<vtkLine>::New();
144 line->GetPointIds()->SetId(0, i);
145 line->GetPointIds()->SetId(1, i + 1);
146 lines->InsertNextCell(line);
151 vtkSmartPointer<vtkPolyData> linesPolyData =
152 vtkSmartPointer<vtkPolyData>::New();
155 linesPolyData->SetPoints(points);
158 linesPolyData->SetLines(lines);
160 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: -...