Draw some lines with VTK

Can someone point me in the right direction how to draw multiple lines that seem connected? I found vtkLineboth its functions SetPoint1and SetPoint2. Then I found vtkPolyLine, but for this there is no function to add, insert or set. The same for vtkPolyVertex.

Is there a basic function that allows me to just click on a point at the end of my internal data and just display it? Or, if there is no such function / object, what is the way here?

RELATED: I don't like vtk too much. Is there a visualization tool, possibly with disabilities, that is easier to use?

Thanks in advance

+3
source share
1

vtkPoints, , , , vtkPolyData vtkUnstructuredGrid ( vtkDataSet; vtkDataSet vtkPoints, ). vtkDataSet , (mapper- > actor- > renderer...)

:

vtkPoints *pts = vtkPoints::New();
pts->InsertNextPoint(1,1,1);
...
pts->InsertNextPoint(5,5,5);

vtkPolyData *polydata = vtkPolyData::New();
polydata->Allocate();
vtkIdType connectivity[2];
connectivity[0] = 0;
connectivity[1] = 3;
polydata->InsertNextCell(VTK_LINE,2,connectivity); //Connects the first and fourth point we inserted into a line

vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(polydata);

// And so on, need actor and renderer now

vtkPoints: http://www.vtk.org/doc/release/5.4/html/a01250.html

vtkPoints (Tests), , . .

, vtk, , , .

+6

Source: https://habr.com/ru/post/1730073/


All Articles