1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import vtk.*; import javax.swing.*; /** * Create a cone and display it in an application window. */ final public class JavaCone { public static void main(String s[]) { // Setup VTK rendering panel, this also loads VTK native libraries vtkPanel renWin = new vtkPanel(); // Setup cone rendering pipeline vtkConeSource cone = new vtkConeSource(); cone.SetResolution( 8 ); vtkPolyDataMapper coneMapper = new vtkPolyDataMapper(); coneMapper.SetInputConnection(cone.GetOutputPort()); vtkActor coneActor = new vtkActor(); coneActor.SetMapper(coneMapper); renWin.GetRenderer().AddActor(coneActor); renWin.GetRenderer().ResetCamera(); // Create the main application window JFrame frame = new JFrame( "JavaCone" ); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.add(renWin); frame.pack(); frame.setVisible( true ); } } |