VTK生成三维网格坐标系

VTK生成三维网格坐标系_第1张图片

 

#include 

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#include "vtkAutoInit.h" 
VTK_MODULE_INIT(vtkRenderingOpenGL2);
VTK_MODULE_INIT(vtkInteractionStyle);
VTK_MODULE_INIT(vtkRenderingVolumeOpenGL2);
VTK_MODULE_INIT(vtkRenderingFreeType);

int main(int, char* [])
{
	vtkSmartPointer render = vtkSmartPointer::New();

	vtkSmartPointer cubeAxesActor = vtkSmartPointer::New();
	cubeAxesActor->SetCamera(render->GetActiveCamera());
	cubeAxesActor->SetXAxisRange(0, 1000);
	cubeAxesActor->SetYAxisRange(0, 1000);
	cubeAxesActor->SetZAxisRange(0, 1000);
	cubeAxesActor->SetScreenSize(6);
	cubeAxesActor->DrawXGridlinesOn();
	cubeAxesActor->DrawYGridlinesOn();
	cubeAxesActor->DrawZGridlinesOn();
	cubeAxesActor->SetGridLineLocation(2);
	cubeAxesActor->XAxisMinorTickVisibilityOff();
	cubeAxesActor->YAxisMinorTickVisibilityOff();
	cubeAxesActor->ZAxisMinorTickVisibilityOff();
	
	render->AddActor(cubeAxesActor);
	render->ResetCamera();
	render->ResetCameraClippingRange();

	vtkSmartPointer renWin = vtkSmartPointer::New();
	renWin->AddRenderer(render);
	renWin->SetSize(600, 600);

	vtkSmartPointer iren = vtkSmartPointer ::New();
	iren->SetRenderWindow(renWin);
	vtkSmartPointer style = vtkSmartPointer::New();
	iren->SetInteractorStyle(style);

	renWin->Render();
	iren->Start();

	return 0;
}

 

你可能感兴趣的:(VTK)