Write a plane to a VTP file

From KitwarePublic
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 <vtkPlaneSource.h>

void WritePlane(const string &OutputFilename) {

vtkSmartPointer<vtkPlaneSource> plane = vtkSmartPointer<vtkPlaneSource>::New(); plane->SetCenter(1.0, 0.0, 0.0); plane->SetNormal(1.0, 0.0, 0.0);

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

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

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

} </source>