Aller au contenu

VTK

Depi Wikipedya, ansiklopedi lib

VTK (pou Visualization ToolKit nan angle) se yon biblyotèk klas C++ lib (OpenSource) pou wè (vizyalize) done 2D/3D epitou trètman imaj. Li kapab itilize anlè anpil machin epi anpil sistèm (tankou Linux, Windows, Mac, Sun ...), li miltiplafòm.

Se antrepriz Kitware Inc. ki ap edite l.

Li disponib nan langaj enfòmatik sa yo :

C++ : desine yon sfè, yon boul

#include "vtkSphereSource.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkRenderWindow.h"
#include "vtkRenderer.h"
#include "vtkRenderWindowInteractor.h"

void main ()
{

  // create sphere geometry
  vtkSphereSource *sphere = vtkSphereSource::New();
  sphere->SetRadius(1.0);
  sphere->SetThetaResolution(18);
  sphere->SetPhiResolution(18);

  // map to graphics library
  vtkPolyDataMapper *map = vtkPolyDataMapper::New();
  map->SetInput(sphere->GetOutput());

  // actor coordinates geometry, properties, transformation
  vtkActor *aSphere = vtkActor::New();
  aSphere->SetMapper(map);
  aSphere->GetProperty()->SetColor(0,0,1); // sphere color blue

  // a renderer and render window
  vtkRenderer *ren1 = vtkRenderer::New();
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer(ren1);

  // an interactor
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renWin);

  // add the actor to the scene
  ren1->AddActor(aSphere);
  ren1->SetBackground(1,1,1); // Background color white

  // render an image (lights and cameras are created automatically)
  renWin->Render();

  // begin mouse interaction
  iren->Start();
}

Kèk referans sou li

[modifye | modifye kòd]
  • (en) W.J. Schroeder, L.S. Avila, W. Hoffman, Visualizing with VTK: A tutorial, IEEE Transaction on Computer Graphics and Applications, 2000, 20(5), pp20-27. [1]
  • (en) Carsten Zerbst, Scientific visualization with VTK and Tcl, Linux Magazine issue 16, 2002, pp60-63. [2]
  • (en) Drew McCormack, Developing Visualization Applications with Cocoa and VTK, part1, part2, 2003 [3] [4]