[vtkusers] newbie question
Francois Bertel
francois.bertel at kitware.com
Tue Jul 25 16:45:30 EDT 2006
Hi Bernard,
Before sphere.GetOutput();, call sphere.Update();
sphere.SetThetaResolution() and sphere.SetPhiResolution() just change the value of some protected variable on the SphereSource object but do not update the output dataset.
With the PolyDataMapper, it is done implicitely because it is triggered by some render event that starts updating the pipeline (render() is called on the mapper
which itself calls update() on its source).
Regards.
Bernard Giroux wrote:
> 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
>
>
>
>
> _______________________________________________
> This is the private VTK discussion list.Please keep messages on-topic.
> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
--
François Bertel, PhD | Kitware Inc. Suite 204
1 (518) 371 3971 x113 | 28 Corporate Drive
| Clifton Park NY 12065, USA
More information about the vtkusers
mailing list