前言:本博文主要研究在VTK中如何實作倒角,并附源碼。
一波三折的過程,終于有了結果。回過頭看看自己做了好多無用功。
1. 沿邊界生成圓柱體進行布爾減操作(行不通,vtkBooleanOperationPolyDataFilter出錯)
vtkNew<vtkPoints> plPts;
vtkPolyLineSource* pl = vtkPolyLineSource::New();
for (vtkIdType id = 0; id < npts; id++)
{
plPts->InsertNextPoint(inPts->GetPoint(pts[id]));
pl->SetPoints(plPts);
}
vtkTubeFilter* tube = vtkTubeFilter::New();
tube->SetInputConnection(pl->GetOutputPort());
tube->SetRadius(2.);
tube->SetNumberOfSides(100);
tube->CappingOn();
tube->SetSidesShareVertices(true);
tube->Update();
2. 沿邊界的每條線段進行剪切體的建立,進而疊