Hi there, I push some points in vtkPoints
and generate vtkCellArray
to get a track of mouse with vtkActor2D
and vtkPolydataMapper2D
to clip the body. Before I execute clipping volume, I found that the overlapping of polygon is showed like the picture above.
What I want is like this, to detect the overlapping points and unregister them
(the original site is How to only render one vtkRender in vtkRenderWindow with two vtkRenders - Development - VTK)
Could you give me some advice to deal with the polydata? I tried to use vtkCleanPolydata
to update but make no sense.
Here is some of my code:
m_pTitleRenderer->SetLayer(1);
m_pBMRenderer->SetDisplayPoint(fx, fy, 0);
double worldcoortemp[4];
m_pBMRenderer->DisplayToWorld();
m_pBMRenderer->GetWorldPoint(worldcoortemp);
wVector2<float> temp;
temp.x = fx;
temp.y = fy;
m_fSaveClipPoints.push_back(temp);
m_pPoints = vtkSmartPointer<vtkPoints>::New();
for (int i = 0; i < m_fSaveClipPoints.size(); i++) {
m_pPoints->InsertNextPoint(m_fSaveClipPoints[i].x, m_fSaveClipPoints[i].y, 0.0);
}
int pointnum = m_pPoints->GetNumberOfPoints();
m_pDisplayPlane = vtkSmartPointer<vtkCellArray>::New();
m_pDisplayPlane->InsertNextCell(m_pPoints->GetNumberOfPoints() + 1);
for (int i = 0; i < m_fSaveClipPoints.size(); i++) {
m_pDisplayPlane->InsertCellPoint(i);
}
m_pDisplayPlane->InsertCellPoint(0); // start points
int cellnum = m_pDisplayPlane->GetNumberOfCells();
// polydata
m_pPolygonTrack->SetPoints(m_pPoints);
m_pPolygonTrack->SetPolys(m_pDisplayPlane);
////// It seems some processing here to deal with the polygon
// polyline property setting
vtkNew<vtkProperty2D> _ptpro;
_ptpro->SetLineWidth(5);
_ptpro->SetColor(1.0, 1.0, 0);
_ptpro->SetOpacity(0.4);
_ptpro->SetPointSize(5);
m_pDisplayActor->SetProperty(_ptpro);
m_pDisplayMapper->SetInputData(m_pPolygonTrack);
m_pDisplayActor->SetMapper(m_pDisplayMapper);
m_pTitleRenderer->AddActor(m_pDisplayActor);
m_pRenderWnd->Render();
m_nPointCount++;
Thanks for any advice!!!