[vtkusers] Addition of polylines
forzakim
forzakim at yahoo.co.jp
Wed Aug 21 21:49:01 EDT 2002
Hello all,
I create a vtkPolyData object by manual operation and am going to create a
polyline. I want to add a cell(LINE) periodically. However, nothing is
displayed.
In initialization
vtkRenderer *ren = vtkRenderer::New();
vtkRenderWindow *renWin = vtkRenderWindow::New();
renWin->AddRenderer(ren);
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
vtkPoints *polyPoints = vtkPoints::New();
vtkCellArray *polyCells = vtkCellArray::New();
vtkPolyData *polyline = vtkPolyData::New();
polyline->SetPoints(polyPoints);
polyline->SetLines(polyCells);
vtkPolyDataMapper *polyMapper = vtkPolyDataMapper::New();
polyMapper->SetInput(polyline);
vtkActor *polyActor = vtkActor::New();
polyActor->SetMapper(polyMapper);
ren->AddActor(polyActor);
In every scan
vtkPoints *Points = (vtkPoints*)(polyline->GetPoints());
vtkCellArray *Cells = (vtkCellArray*)(polyline->GetLines());
vtkIdType ptIds[2], cellId;
ptIds[0] = Points->InsertNextPoint(&polydata[pt][0]);
ptIds[1] = Points->InsertNextPoint(&polydata[pt+1][0]);
cellId = Cells->InsertNextCell(2, ptIds);
polyline->Update();
pt++;
Any help will be appreciated.
Regards.
forzakim
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/
More information about the vtkusers
mailing list