+
+ public static vtkActor createLineActor(Tuple3d... p) {
+ vtkPoints linePoints = new vtkPoints();
+ linePoints.SetNumberOfPoints(p.length);
+
+ for (int i = 0; i < p.length; i++) {
+ Tuple3d p1 = p[i];
+ linePoints.InsertPoint(i,p1.x, p1.y, p1.z);
+
+ }
+ vtkUnstructuredGrid aLineGrid = new vtkUnstructuredGrid();
+ //aLineGrid.Allocate(1, 1);
+ for (int i = 0; i< p.length -1; i++) {
+ vtkLine aLine = new vtkLine();
+ aLine.GetPointIds().SetId(0, i);
+ aLine.GetPointIds().SetId(1, i+1);
+ aLineGrid.InsertNextCell(aLine.GetCellType(), aLine.GetPointIds());
+ aLine.GetPointIds().Delete();
+ aLine.Delete();
+ }
+
+ aLineGrid.SetPoints(linePoints);
+ vtkDataSetMapper aLineMapper = new vtkDataSetMapper();
+ aLineMapper.SetInputData(aLineGrid);
+ vtkActor aLineActor = new vtkActor();
+ aLineActor.SetMapper(aLineMapper);
+ //aLineActor.GetProperty().SetDiffuseColor(.2, 1, 1);
+
+ linePoints.Delete();
+
+ aLineGrid.Delete();
+ aLineMapper.Delete();
+
+ return aLineActor;
+ }