[vtkusers] newbie question

Bernard Giroux giroux at geo.polymtl.ca
Tue Jul 25 16:35:50 EDT 2006


Hi,

I am trying to retreive the triangular facets of a sphere created  
using a vtkSphereSource.  I work in java, and use the following steps:

public class TestPolyData {

	static public void main(String[] args) {
		System.loadLibrary("vtkCommonJava");
		System.loadLibrary("vtkFilteringJava");
		System.loadLibrary("vtkIOJava");
		System.loadLibrary("vtkImagingJava");
		System.loadLibrary("vtkGraphicsJava");
		System.loadLibrary("vtkRenderingJava");
		try {
			System.loadLibrary("vtkHybridJava");
		} catch (Throwable e) {
			System.out.println("cannot load vtkHybrid, skipping...");
		}
		try {
			System.loadLibrary("vtkVolumeRenderingJava");
		} catch (Throwable e) {
			System.out.println("cannot load vtkVolumeRendering, skipping...");
		}

		vtkSphereSource sphere = new vtkSphereSource();
		sphere.SetThetaResolution(36);
		sphere.SetPhiResolution(18);
		vtkPolyData pts = sphere.GetOutput();

		System.out.printf("Number of points: %d\n", pts.GetNumberOfPoints());
		System.out.printf("Number of cells: %d\n", pts.GetNumberOfCells());

	}
}

There must be some steps missing because the output is

Number of points: 0
Number of cells: 0

If I pipe the output of the sphere object to a PolyDataMapper an then  
to an actor, it appears correctly on the screen.

Any help appreciated.


---
Bernard Giroux, ing., Ph.D.
Associé de recherche

http://geo.polymtl.ca/~giroux







More information about the vtkusers mailing list