Write a sphere to a VTP file

From KitwarePublic
Revision as of 13:09, 11 April 2009 by Daviddoria (talk | contribs) (New page: <source lang="cpp"> #include <vtkSphereSource.h> void WriteSphere(const string &OutputFilename) { vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New(); spher...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

<source lang="cpp">

  1. include <vtkSphereSource.h>

void WriteSphere(const string &OutputFilename) { vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New(); sphere->SetCenter(0.0, 0.0, 0.0); sphere->SetRadius(5.0);

vtkSmartPointer<vtkPolyData> pdata = sphere->GetOutput();

//write the file vtkSmartPointer<vtkXMLPolyDataWriter> writer = vtkSmartPointer<vtkXMLPolyDataWriter>::New(); writer->SetInput(pdata);

writer->SetFileName(OutputFilename.c_str()); writer->Write();

} </source>