[vtkusers] problems using vtk

Joao Guilherme Maia de Menezes guilhermemdm at hotmail.com
Mon Mar 6 15:55:35 EST 2006


I have this class Circle to write a circle in a VTK-Qt application, and I 
would like to produce a file in which every point (pixel) inside the circle 
is equal a 1 and every point outside the circle is equal to 0. How can I 
produce this binary matrix in this file?

Circle::Circle(QWidget *parent) : QWidget(parent) {
	// cria a esfera
	 vtkGlyphSource2D* circle = vtkGlyphSource2D::New();
         circle->SetGlyphTypeToSquare();
         circle->SetScale(2);
	 circle->SetScale2(10);
         circle->FilledOn();

	// create a mapper
	vtkPolyDataMapper *circleMapper = vtkPolyDataMapper::New();
	circleMapper -> SetInput(circle->GetOutput());

	//create an actor to represent the points
	vtkActor *circleActor = vtkActor::New();
	circleActor -> SetMapper( circleMapper );
	circleActor -> GetProperty() -> SetColor(0, 1, 0);

	// Create the Renderer and assign actors to it
	vtkRenderer *circleRenderer = vtkRenderer::New();
	circleRenderer -> AddActor( circleActor );
	circleRenderer -> SetBackground( .1, .1, .1);

	//create the render window which will show up on the screen
	vtkQtRenderWindow *circleRenderWindow = new vtkQtRenderWindow(parent);
	circleRenderWindow -> AddRenderer( circleRenderer );
	circleRenderWindow -> setGeometry(300, 10, 400, 400);
	circleRenderWindow -> show();
}

_________________________________________________________________
MSN Messenger: converse com os seus amigos online. 
http://messenger.msn.com.br




More information about the vtkusers mailing list