The code to reproduce my problem is:
vtkSmartPointer<vtkLineSource> lineSource = vtkSmartPointer<vtkLineSource>::New();
lineSource->SetPoint1(0, 0, 0);
lineSource->SetPoint2(10, 0, 0);
vtkSmartPointer<vtkTubeFilter> tubeFilter = vtkSmartPointer<vtkTubeFilter>::New();
tubeFilter->SetInputConnection(lineSource->GetOutputPort());
tubeFilter->SetRadius(4);
/////////////////////////////////////////////////////////////////////////////
tubeFilter->SetNumberOfSides(50); // key code
/////////////////////////////////////////////////////////////////////////////
tubeFilter->SetCapping(1);
tubeFilter->Update();
vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New();
vtkSmartPointer<vtkPoints> vps = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolygon> polygon = vtkSmartPointer<vtkPolygon>::New();
polygon->GetPointIds()->SetNumberOfIds(3);
vps->InsertNextPoint(0, 0, 0);
polygon->GetPointIds()->SetId(0, 0);
vps->InsertNextPoint(10, 0, 0);
polygon->GetPointIds()->SetId(1, 1);
vps->InsertNextPoint(10, 10, 0);
polygon->GetPointIds()->SetId(2, 2);
vtkSmartPointer<vtkCellArray> polygons = vtkSmartPointer<vtkCellArray>::New();
polygons->InsertNextCell(polygon);
polydata->SetPoints(vps);
polydata->SetPolys(polygons);
vtkSmartPointer<vtkTriangleFilter> tri1 = vtkSmartPointer<vtkTriangleFilter>::New();
tri1->SetInputData(tubeFilter->GetOutput());
tri1->Update();
vtkSmartPointer<vtkTriangleFilter> tri2 = vtkSmartPointer<vtkTriangleFilter>::New();
tri2->SetInputData(polydata);
tri2->Update();
vtkSmartPointer<vtkIntersectionPolyDataFilter> intersection = vtkSmartPointer<vtkIntersectionPolyDataFilter>::New();
intersection->SetInputData(0, tri1->GetOutput());
intersection->SetInputData(1, tri2->GetOutput());
intersection->Update();
A bug is reported:
However, if I change tubeFilter->SetNumberOfSides(50);
to tubeFilter->SetNumberOfSides(49);
, everything is OK.
How can I fix this bug? Any suggestion is appreciated~~~