Write a plane to a VTP file

From KitwarePublic
Jump to navigationJump to search
#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();

}