[vtkusers] vtkDataObject vs. vtkPointSet

David Lee Lambert lamber45 at cse.msu.edu
Mon Nov 21 18:57:08 EST 2005


(sorry about the resend; plain text this time...)

I'm trying to figure out how to use vtkXYPlotActor to display simple 2-D data 
I've generated myself.  I can see that it has a method "AddDataObjectInput" 
which takes a "vtkDataObject *".  I've also found the class vtkPointSet,  one of 
its subclasses.  However,  I get an error when I try to compile my simple 
program.  In one part of the program I read data from a file as follows:

      while (2==fscanf(f,"%lg%lg",&x,&y)) {

         points->InsertNextPoint(x,y,0.0);

      }

In another place,  I try to display that data:

              // "point set"
   vtkDataObject *point_set = vtkPointSet::New();
   point_set->SetPoints( demo_data->getPoints() );

                // actor
   vtkXYPlotActor *plot_actor = vtkXYPlotActor::New();
   plot_actor->AddDataObjectInput( point_set );

However,  I get an error during compilation:

demo2.cpp: In function ‘int main(int, char**)’:
demo2.cpp:74: error: ‘class vtkDataObject’ has no member named ‘SetPoints’

That makes sense,  because vtkPointSet is a subclass os vtkDataObject.  
However,  when I originally tried it with a more specific type for /point_set/,  
I got a different error:

demo2.cpp: In function ‘int main(int, char**)’:
demo2.cpp:73: error: invalid conversion from ‘vtkDataObject*’ to ‘vtkPointSet*’

What might I doing wrong?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 251 bytes
Desc: OpenPGP digital signature
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051121/4f1cbce4/attachment.pgp>


More information about the vtkusers mailing list