[vtkusers] Confusion

Prashanth Udupa prashanth.udupa at gmail.com
Thu Nov 25 01:33:40 EST 2004


Hi,

When I run into problems like this; I would include the header file
for the subclass which is not being accepted. In this case I would
include "vtkPolyData.h".

This error message pops up when the compiler has no way to figure out
that vtkPolyData is a subclass of vtkDataSet. By including
vtkPolyData.h in the file where
"_sphereMapper->SetInput(_sphereSource->GetOutput());" is written; the
compiler is now in a position to figure out that vtkPolyData (of
_sphereSource->GetOutput()) is a subclass of vtkDataSet that
vtkDataSetMapper::SetInput() takes as parameter.

Hope this helps.

Regards,
Prashanth


On Wed, 24 Nov 2004 22:09:54 -0800 (PST), Albion Baucom
<baucom at biology.ucsc.edu> wrote:
> 
> Why does this code work?
> 
> -------------------------------------------------------
> 
> vtkSphereSource         *_sphereSource;
> vtkDataSetMapper        *_sphereMapper;
> 
> _sphereSource = vtkSphereSource::New();
> _sphereSource->SetThetaResolution(SPHERE_RESOLUTION);
> _sphereSource->SetPhiResolution(SPHERE_RESOLUTION);
> 
> _sphereMapper = vtkDataSetMapper::New();
> _sphereMapper->SetInput(_sphereSource->GetOutput());
> 
> -------------------------------------------------------
> 
> A vtkDataSetMapper has the following method:
> 
> void SetInput(vtkDataSet *input);
> 
> yet a vtkSphereSource returns the following from the GetOutput() method
> since it is subclassed from vtkPolyDataSource
> 
> vtkPolyData *GetOutput();
> 
> What puzzles me most (well is actually driving me insane >:0) is the code
> above is in an example called Animoltion that is available online, and it
> compiles. This is a use of vtk in Cocoa, here is the link to the source
> code
> 
> http://www.macdevcenter.com/mac/2003/02/11/examples/vtk.zip
> 
> So, if I try to use this code in my own project I get the following
> (expected) error
> 
> error: no matching function for call to
> 'vtkDataSetMapper'::SetInput(vtkPolyData *)
> 
> The Animoltion project uses the same VTK version (headers and libriares)
> as my project; I have them installed and simply point the paths to the
> same directories.
> 
> Under what circumstances should a vtkDataSetMapper accept as input a
> vtkPolyData? Why would the above code work? I'm confused.
> 
> What would be the standard way to render a sphere in a VTK view? I have
> been trying to use vtkPolyDataNormals to compute point normals from the
> sphereSource, and then pass the normal to a vtkPolyDataMapper, but that
> never displays my spheres.
> 
> Any help would be greatly appreciated.
> 
> Thanks
> 
> Albion
> 
> Albion E. Baucom
> http://rna.ucsc.edu/albion
> _______________________________________________
> 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
> 


-- 
Prashanth N Udupa
http://www.prashanthudupa.com/



More information about the vtkusers mailing list