12 #ifndef __vtkPolyDataViewer_hxx 13 #define __vtkPolyDataViewer_hxx 26 void vtkPolyDataViewer::Add(
const vtkSmartPointer<vtkPolyData>& mesh,
const double opacity,
const std::vector<double>& hueRange,
bool useNormal,
const std::vector<double>& scalarRange,
bool lighting )
28 vtkSmartPointer<vtkLODActor> actor;
29 if (std::fabs(scalarRange[0]+1.0)<1e-8 && std::fabs(scalarRange[1]+1.0)<1e-8)
32 actor =
vtkPolyDataToActor(mesh, opacity, {hueRange[0], hueRange[1]}, useNormal, {scalarRange[0],scalarRange[1]}, lighting);
38 vtkSmartPointer<vtkCamera> camera =
Renderer->GetActiveCamera();
39 camera->Roll(
Angle[0]);
40 camera->Elevation(
Angle[1]);
71 vtkSmartPointer<vtkWindowToImageFilter> window2image= vtkWindowToImageFilter::New();
73 vtkSmartPointer<vtkPNGWriter> png_writer = vtkPNGWriter::New();
74 png_writer->SetInputConnection(window2image->GetOutputPort());
75 png_writer->SetFileName(pngfile.c_str());
vtkSmartPointer< vtkRenderWindowInteractor > Interactor
void RenderWindowUpdate()
void SavePNG(const std::string &pngfile)
void Add(const vtkSmartPointer< vtkPolyData > &mesh, const double opacity=1.0)
vtkSmartPointer< vtkLODActor > vtkPolyDataToActor(const vtkSmartPointer< vtkPolyData > &mesh, const double opacity=1.0, const std::vector< double > &hueRange={0.6667, 0.0}, bool useNormal=true, const std::vector< double > &scalarRange={-1.0,-1.0}, bool lighting=true)
vtkSmartPointer< vtkRenderer > Renderer
vtkSmartPointer< vtkRenderWindow > RenderWindow