[vtkusers] vtkPolyLine create a line

Jochen jochen.kling at email.de
Thu May 24 07:08:12 EDT 2012


Hi,

here's a fragmentary code snippet on how to construct a rectangle with
polylines. Maybe it helps to understand the mechanismn.

    /* fragmentary code snippet to produce a polyline-rectangle */

    vtkPoints points;
    vtkCellArray lines;
    vtkPolyData polyData;
    vtkPolyDataMapper polyDataMapper;
    vtkActor rectangle;

    ....
    // instantiate abobe declared objects
    ....

    points->SetNumberOfPoints(4);
    points->SetPoint(0, 0, 0, 0);
    points->SetPoint(1, 0, 0, 0);
    points->SetPoint(2, 0, 0, 0);
    points->SetPoint(3, 0, 0, 0);
    
    lines->InsertNextCell(5);
    lines->InsertCellPoint(0);
    lines->InsertCellPoint(1);
    lines->InsertCellPoint(2);
    lines->InsertCellPoint(3);
    lines->InsertCellPoint(0);
    
    polyData->SetPoints(points);
    polyData->SetLines(lines);
    
    polyDataMapper->SetInput(polyData);
    rectangle->SetMapper(polyDataMapper);
      
    // add actor rectangle to your renderer
    ...


with best regards
Jochen

--
View this message in context: http://vtk.1045678.n5.nabble.com/vtkPolyLine-create-a-line-tp5713351p5713354.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list