[vtkusers] HELP!! What am I doing wrong???

marisa aurelio asiram00 at hotmail.com
Fri Jul 4 11:05:10 EDT 2003


Hi vtkUsers,

I have 2 superquadrics that I add to a vtkActtorCollection and then try to 
visualize them.
But the only superquadrics I see is the last one that I add to my 
vtkActorCollection.

Why???  Above there's my code.

void main()
{
     vtkActorCollection *imageActorCollection = vtkActorCollection::New();
     int n_elipsoid = 2;

     for(int i = 0; i < n_elipsoid; i++)
     {
          vtkSuperquadricSource *Superquadric = 
vtkSuperquadricSource::New();
          vtkPolyDataMapper *eliMapper = vtkPolyDataMapper::New();
          vtkActor *SuperquadricActor = vtkActor::New();

          if(n_elipsoid == 1)
          {
               	Superquadric->SetThetaResolution( 100.0 );
               	Superquadric->SetPhiResolution( 100.0 );
               	Superquadric->SetPhiRoundness( 1 );
               	Superquadric->SetThetaRoundness(1);
               	Superquadric->SetScale(0.25,0.35,0.25);
          }
          else
          {
               	Superquadric->SetThetaResolution( 100.0 );
               	Superquadric->SetPhiResolution( 100.0 );
               	Superquadric->SetPhiRoundness( 1 );
               	Superquadric->SetThetaRoundness(1);
               	Superquadric->SetScale(0.5,0.6,0.5);
               
	SuperquadricActor->GetProperty()->SetRepresentationToWireframe();
          }

          eliMapper->SetInput(Superquadric->GetOutput());
          SuperquadricActor->SetMapper( eliMapper );

          imageActorCollection->AddItem(SuperquadricActor);
     }
     vtkRenderer* renderer = vtkRenderer::New();
     vtkRenderWindow* renWin = vtkRenderWindow::New();
     vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New();

     int number = imageActorCollection->GetNumberOfPaths();

     vtkActor *imageActor = vtkActor::New();

     imageActorCollection ->InitTraversal();

     while (imageActor = imageActorCollection ->GetNextActor())
    {
          renderer->AddActor(imageActor);
    }

     renWin->SetSize(500, 500);
     renWin->AddRenderer(renderer);
     iren->SetRenderWindow(renWin);

     renderer->SetBackground(0.4392, 0.5020, 0.5647);
     renWin->Render();
     iren->Start();
}


Thanks in advance,

Marisa

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*  
http://join.msn.com/?page=features/junkmail




More information about the vtkusers mailing list