[vtkusers] vtkOBJReader

Bernhard Mayrhofer bernhard at wien-zentral.kolping.at
Wed Mar 10 08:28:56 EST 2004


Hi!
Thanks for your answers.
I still have problems. if i use following code, nPoints keeps 0.
If i use a eg. vtkPolyData *test, i can aquire the correct number ob points.
But with following code, this does not work.

vtkOBJReader *View = vtkOBJReader::New();
View->SetFileName("f:/models/test.obj");
nPoints=View->GetOutput()->GetNumberOfPoints();

Thanks
Bernhard


----- Original Message ----- 
From: "Veerapuram Varadhan" <v.varadhan at californiadigital.com>
To: "Chris Scharver" <scharver at evl.uic.edu>
Cc: "Bernhard" <bernhard at wien-zentral.kolping.at>; <vtkusers at vtk.org>
Sent: Tuesday, March 09, 2004 3:19 PM
Subject: Re: [vtkusers] vtkOBJReader


>
> The following piece of sample can get you required tuple from the
polydata.
>
> vtkPolyData* input = NULL;
> int nPoints = 0;
> float intensity_value = 0.00;
> float* coord = NULL;
>
> input = vtkOBJReader->GetOutput();
> nPoints = input->GetNumberOfPoints;
>
> for (int i = 0; i < nPoints; i++)
> {
>     // to get the co-ordinate corresponding to a point in polydata
>     coord = input->GetPoint(i);
>
>     // to get the intensity value corresponding to a point in polydata
>     intensity_value = input->GetPointData()->GetScalars()->GetTuple1(i);
> }
>
> Hope this helps,
> V. Varadhan.
>
>
> > On Mar 9, 2004, at 3:08 AM, Bernhard wrote:
> >
> >> I use the vtkOBJReader, i tried the example, but i don´t know, how i
> >> can access the points, tuples and cells in this output. How can i do
> >> this?
> >
> > vtkOBJReader's output is vtkPolyData. Once the file has been read into
> > the pipeline, you can access the vtkPolyData returned from
> > vtkOBJReader->GetOutput(). I usually run it through vtkPolyDataNormals
> > and vtkStripper before accessing the data.
> >
> > Hope this helps,
> > Chris
> >
> > --
> > Chris Scharver
> > Electronic Visualization Laboratory
> > The University of Illinois at Chicago
> > Ph: 312-996-3002   FAX: 312-413-7585
> > <http://www.evl.uic.edu/scharver/>
> >
> > _______________________________________________
> > This is the private VTK discussion list.
> > Please keep messages on-topic. Check the FAQ at:
> > <http://public.kitware.com/cgi-bin/vtkfaq>
> > Follow this link to subscribe/unsubscribe:
> > http://www.vtk.org/mailman/listinfo/vtkusers
> >
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>





More information about the vtkusers mailing list