Here’s an example:
const points = vtkPoints.newInstance();
const polyData= vtkPolyData.newInstance();
const polyDataActor = vtkActor.newInstance();
polyData.setPoints(points);
sphereSource = vtkSphereSource.newInstance({
radius: 0.25,
phiResolution: 10,
thetaResolution: 10,
});
polyDataMapper = vtkGlyph3DMapper.newInstance({
orient: false,
scaling: false,
scaleMode: vtkGlyph3DMapper.ScaleModes.SCALE_BY_CONSTANT,
});
polyDataMapper.setInputData(polyData, 0);
polyDataMapper.setInputConnection(sphereSource.getOutputPort(), 1);
polyDataActor.setMapper(polyDataMapper);
polyDataActor.getProperty().setPointSize(5);
points.insertNextPoint([435,50,180]);
points.dataChange();
polyData.modified();
renderWindow.render();
Why can’t the point be rendered when dynamically adding a point? When dynamically adding two points, it can be rendered normally.
points.insertNextPoint([435,50,180]);
points.insertNextPoint([438,50,181]);
There is another question, why not render the out-point cloud when the z coordinate value of multiple points is the same, only add 0.00001 to the z value of a point to render the out-point cloud:
points.insertNextPoint([435,50,180]);
points.insertNextPoint([438,50,180]);