#include <vtkProperty.h>
#include <vtkAutoInit.h>
#include <vtkObject.h>
VTK_MODULE_INIT(vtkRenderingOpenGL2)
VTK_MODULE_INIT(vtkInteractionStyle)
VTK_MODULE_INIT(vtkRenderingFreeType)
#include <QDebug>
#include <iostream>
#include <vtkSmartPointer.h>
#include <vtkSphereSource.h>
#include <vtkActor.h>
#include <vtkConeSource.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkLight.h>
#include <vtkCamera.h>
#include <vtkActor2D.h>
#include <vtkRendererCollection.h>
#include <vtkImageTracerWidget.h>
#include <vtkPolyDataNormals.h>
#include <vtkPlanes.h>
using namespace std;
int main(int argc, char *argv[])
{
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> cellArray = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPolyDataMapper> planeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkActor> planeActor = vtkSmartPointer<vtkActor>::New();
vtkSmartPointer<vtkRenderer> renderer = vtkSmartPointer<vtkRenderer>::New();
vtkSmartPointer<vtkRenderWindow> renderWindow = vtkSmartPointer<vtkRenderWindow>::New();
vtkSmartPointer<vtkImageTracerWidget> tracerWidget = vtkSmartPointer<vtkImageTracerWidget>::New();
renderWindow->AddRenderer( renderer );
//-----------start create plane------------------
points->InsertPoint(0, 0, 0, 0);
points->InsertPoint(1, 1, 0, 0);
points->InsertPoint(2, 0, 1, 0);
points->InsertPoint(3, 0, 0, 0);
tracerWidget->InitializeHandles(points);
tracerWidget->GetPath(polyData);
// polyData->SetPoints( points );
// vtkIdType cellId1[4] = { 0, 1, 2 };
// cellArray->InsertNextCell(3, cellId1);
// polyData->SetPolys( cellArray );
planeMapper->SetInputData( polyData );
planeActor->SetMapper( planeMapper );
planeActor->GetProperty()->SetColor( 1,1,1 );
renderer->AddActor( planeActor );
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor = vtkSmartPointer<vtkRenderWindowInteractor>::New();
renderWindowInteractor->SetRenderWindow( renderWindow );
renderer->GetActiveCamera()->ParallelProjectionOn();
renderer->ResetCamera();
renderWindow->Render();
renderWindowInteractor->Start();
return 0;
}