I am writing a reader reading a multi-segment text file for Generic Mapping Tools.
It contains many 3-tuples
const polydata = vtkPolyData.newInstance({ name: data.pieces[idx] }); const pts = data.vset[idx]; const cellArray = []; let cnt=pts.length; cellArray.push(cnt); for(let i=0; i<cnt; i++) { cellArray.push(i); } polydata.getLines().setData(Uint16Array.from(cellArray)); polydata.getPoints().setData(Float32Array.from(pts), 3);
would appreciate a pointer to an example…
found it,
from How to manually create a polyData with multi line segments in vtk.js
the getLines() takes an array of [ total_pt_cnt, index of points ]