Make lines in .vtp file

557 views Asked by At

I want to visualize a graph in 3d in paraview. This requires me to have points and edges connecting the points. I know how to make the points but can't seem to figure out how to make the edges.

Currently I can make .vtp files with points and associated vectors. I want to know how to modify my .vtp files to include these edges as well.

Thanks for any help!

1

There are 1 answers

0
David Doria On BEST ANSWER

You should use a vtkLineSource:

  vtkSmartPointer<vtkLineSource> lineSource = 
    vtkSmartPointer<vtkLineSource>::New();
  lineSource->SetPoint1(p0);
  lineSource->SetPoint2(p1);
  lineSource->Update();

lineSource->GetOutput() will give you a polydata that you can then write with a vtkXMLPolyDataWriter. See a full example here: http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Line