[vtkusers] How to draw multi color lines?

Hua Yuan hyuan10 at yahoo.com
Tue Mar 29 16:49:36 EST 2005


Hello everyone,
 
I am working on a problem that will show one to hundred thousnad of color curves.  There are about thirty points for each curves.  To do that I need to new hundred thousand maps and actors and it usually crashes after it shows about twenty thousand curves.  So I wonder if there is any better way to draw color curves.  The following is part of the code I generated. 
 
I really appreciate your help.
 
Thanks.
Hookemall
 
////////////////////////////////////////////////////////////
//the following is part of the code
  for(iLine=0;iLine<nLine;iLine++)
  {
   points      = vtkPoints::New();
   data        = vtkPolyData::New();
   pMapper     = vtkPolyDataMapper::New();
   pActor      = vtkActor::New();
   Lines       = vtkCellArray::New();
   ids         = vtkIdList::New();
   points->SetNumberOfPoints((int)nPoints);
   for(int i=0;i<nPoints;i++)
   {
    points->SetPoint(i,x3[i],y3[i],z[i]);
    ids->SetNumberOfIds(i);
    ids->InsertId(i,i);
    }
   Lines->InsertNextCell(ids);
   data->SetPoints(points);
   data->SetLines(Lines);
   data->Update();
   
    
    pMapper->SetInput(data);
   pMapper->Update();
   pActor->SetMapper(pMapper);
     getNewColors(iColor11,iColor22,iColor33);
   pActor->GetProperty()->SetColor(iColor1,iColor2,iColor3);
    
    this->ren->AddActor(pActor);
    Lines->Delete();
   pMapper->Delete();
   pActor->Delete();
   data->DeleteCells();
   data->Delete();
   points->Delete();
   ids->Delete();
   
  }

		
---------------------------------
Do you Yahoo!?
 Make Yahoo! your home page   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050329/4ae3ac48/attachment.htm>


More information about the vtkusers mailing list