在鼠标点击的位置显示一个标记点:
步骤是:
获得鼠标点的坐标位置,然后以这个点为圆心画一个polygon,设置它的大小和颜色显示,作为actor添加进去渲染就可以了;
vtkSmartPointer<vtkRegularPolygonSource> polygonSource = vtkSmartPointer<vtkRegularPolygonSource>::New();
polygonSource->SetNumberOfSides(50);
polygonSource->SetRadius(4);
polygonSource->SetCenter(x, y, 0);//this part
vtkSmartPointer<vtkPolyDataMapper2D> mapper = vtkSmartPointer<vtkPolyDataMapper2D>::New();
mapper->SetInputConnection(polygonSource->GetOutputPort());
vtkSmartPointer<vtkActor2D> actor = vtkSmartPointer<vtkActor2D>::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetColor(1, 0, 0);
actor->GetProperty()->SetOpacity(1);