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...)
<source lang="cpp">
- 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>