///<summary> A Set Method for Static Variables </summary> public static void Setstreamer(vtkPolyDataStreamer toSet) { streamer = toSet; }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVStreamPolyData(String [] argv) { //Prefix Content is: "" NUMBER_OF_PIECES = 5; // Generate implicit model of a sphere[] //[] // Create renderer stuff[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // create pipeline that handles ghost cells[] sphere = new vtkSphereSource(); sphere.SetRadius((double)3); sphere.SetPhiResolution((int)100); sphere.SetThetaResolution((int)150); // sphere AddObserver StartEvent {tk_messageBox -message "Executing with piece [[sphere GetOutput] GetUpdatePiece]"}[] // Just playing with an alternative that is not currently used.[] //method moved // Just playing with an alternative that is not currently used.[] deci = new vtkDecimatePro(); deci.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort()); // this did not remove seams as I thought it would[] deci.BoundaryVertexDeletionOff(); //deci PreserveTopologyOn[] // Since quadric Clustering does not handle borders properly yet,[] // the pieces will have dramatic "eams"[] q = new vtkQuadricClustering(); q.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort()); q.SetNumberOfXDivisions((int)5); q.SetNumberOfYDivisions((int)5); q.SetNumberOfZDivisions((int)10); q.UseInputPointsOn(); streamer = new vtkPolyDataStreamer(); //streamer SetInputConnection [deci GetOutputPort][] streamer.SetInputConnection((vtkAlgorithmOutput)q.GetOutputPort()); //streamer SetInputConnection [pdn GetOutputPort][] streamer.SetNumberOfStreamDivisions((int)NUMBER_OF_PIECES); mapper = vtkPolyDataMapper.New(); mapper.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort()); mapper.ScalarVisibilityOff(); mapper.SetPiece((int)0); mapper.SetNumberOfPieces((int)2); mapper.ImmediateModeRenderingOn(); actor = new vtkActor(); actor.SetMapper((vtkMapper)mapper); actor.GetProperty().SetColor((double) 0.8300, 0.2400, 0.1000 ); // Add the actors to the renderer, set the background and size[] //[] ren1.GetActiveCamera().SetPosition((double)5,(double)5,(double)10); ren1.GetActiveCamera().SetFocalPoint((double)0,(double)0,(double)0); ren1.AddActor((vtkProp)actor); ren1.SetBackground((double)1,(double)1,(double)1); renWin.SetSize((int)300,(int)300); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }
/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVStreamPolyData(String [] argv) { //Prefix Content is: "" NUMBER_OF_PIECES = 5; // Generate implicit model of a sphere[] //[] // Create renderer stuff[] //[] ren1 = vtkRenderer.New(); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren1); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); // create pipeline that handles ghost cells[] sphere = new vtkSphereSource(); sphere.SetRadius((double)3); sphere.SetPhiResolution((int)100); sphere.SetThetaResolution((int)150); // sphere AddObserver StartEvent {tk_messageBox -message "Executing with piece [[sphere GetOutput] GetUpdatePiece]"}[] // Just playing with an alternative that is not currently used.[] //method moved // Just playing with an alternative that is not currently used.[] deci = new vtkDecimatePro(); deci.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort()); // this did not remove seams as I thought it would[] deci.BoundaryVertexDeletionOff(); //deci PreserveTopologyOn[] // Since quadric Clustering does not handle borders properly yet,[] // the pieces will have dramatic "eams"[] q = new vtkQuadricClustering(); q.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort()); q.SetNumberOfXDivisions((int)5); q.SetNumberOfYDivisions((int)5); q.SetNumberOfZDivisions((int)10); q.UseInputPointsOn(); streamer = new vtkPolyDataStreamer(); //streamer SetInputConnection [deci GetOutputPort][] streamer.SetInputConnection((vtkAlgorithmOutput)q.GetOutputPort()); //streamer SetInputConnection [pdn GetOutputPort][] streamer.SetNumberOfStreamDivisions((int)NUMBER_OF_PIECES); mapper = vtkPolyDataMapper.New(); mapper.SetInputConnection((vtkAlgorithmOutput)streamer.GetOutputPort()); mapper.ScalarVisibilityOff(); mapper.SetPiece((int)0); mapper.SetNumberOfPieces((int)2); mapper.ImmediateModeRenderingOn(); actor = new vtkActor(); actor.SetMapper((vtkMapper)mapper); actor.GetProperty().SetColor((double)0.8300, 0.2400, 0.1000); // Add the actors to the renderer, set the background and size[] //[] ren1.GetActiveCamera().SetPosition((double)5, (double)5, (double)10); ren1.GetActiveCamera().SetFocalPoint((double)0, (double)0, (double)0); ren1.AddActor((vtkProp)actor); ren1.SetBackground((double)1, (double)1, (double)1); renWin.SetSize((int)300, (int)300); iren.Initialize(); // render the image[] //[] // prevent the tk window from showing up then start the event loop[] //deleteAllVTKObjects(); }