public void InitializeFaces() { vtkCleanPolyData Clean = vtkCleanPolyData.New(); Clean.SetInputConnection(AppendFaces.GetOutputPort()); Clean.Update(); Faces = Clean.GetOutput(); }
public void SetPosition(double[] xyz1, double[] xyz2) { vtkPoints points = vtkPoints.New(); points.InsertPoint(0, xyz1[0], xyz1[1], xyz1[2]); points.InsertPoint(1, xyz2[0], xyz2[1], xyz2[2]); vtkCellArray lines = vtkCellArray.New(); lines.InsertNextCell(2); lines.InsertCellPoint(0); lines.InsertCellPoint(1); vtkPolyData profileData = new vtkPolyData(); profileData.SetPoints(points); profileData.SetLines(lines); profileData.SetVerts(lines); profileData.Update(); vtkCleanPolyData cleanFilter = new vtkCleanPolyData(); cleanFilter.SetInput(profileData); cleanFilter.Update(); vtkTubeFilter profileTubes = new vtkTubeFilter(); profileTubes.SetNumberOfSides(10); profileTubes.SetInput(cleanFilter.GetOutput()); //profileTubes.SetVaryRadiusToVaryRadiusByVector(); profileTubes.SetRadius(1); profileTubes.SetInputArrayToProcess(1, 0, 0, 0, "vectors"); //vtkPolyDataMapper profileMapper = new vtkPolyDataMapper(); //profileMapper.SetInputConnection(profileTubes.GetOutputPort()); vtkPolyDataMapper mapper = vtkPolyDataMapper.New(); mapper.SetInput(profileTubes.GetOutput()); centerLineActor.SetMapper(mapper); centerLineActor.GetProperty().SetOpacity(0.5); }
public static vtkPolyData Create(List <double[]> xyz1, double radius) { vtkPoints points = new vtkPoints(); for (int index = 0; index < xyz1.Count; index++) { double[] doubles = xyz1[index]; points.InsertPoint(index, doubles[0], doubles[1], doubles[2]); } vtkCellArray lines = new vtkCellArray(); lines.InsertNextCell(xyz1.Count); for (int index = 0; index < xyz1.Count; index++) { lines.InsertCellPoint(index); } vtkPolyData profileData = new vtkPolyData(); profileData.SetPoints(points); profileData.SetLines(lines); profileData.SetVerts(lines); profileData.Update(); vtkCleanPolyData cleanFilter = new vtkCleanPolyData(); cleanFilter.SetInput(profileData); cleanFilter.Update(); vtkTubeFilter profileTubes = new vtkTubeFilter(); profileTubes.SetNumberOfSides(10); profileTubes.SetInput(cleanFilter.GetOutput()); //profileTubes.SetVaryRadiusToVaryRadiusByVector(); profileTubes.SetRadius(radius); profileTubes.SetInputArrayToProcess(1, 0, 0, 0, "vectors"); return(profileTubes.GetOutput()); }