Hey there, I’ve performed a boolean operation on my two polydata sets. Additionally, I’ve identified the intersection line between them. Next, I found the neighbors of the intersection points and saved them in a vtkPoints set named ‘FairingPoints’. Now, I’m attempting to use vtkCGALRegionFairing with this code:
vtkSmartPointer<vtkBooleanOperationPolyDataFilter> booleanFilter = vtkSmartPointer<vtkBooleanOperationPolyDataFilter>::New();
booleanFilter->SetInputData(0, CubeSmoothFilter1->GetOutput());
booleanFilter->SetInputData(1, OriginalData);
booleanFilter->SetOperationToUnion();
booleanFilter->Update();
vtkNew<vtkTriangleFilter> BooltriangleFilter;
BooltriangleFilter->SetInputData(booleanFilter->GetOutput());
BooltriangleFilter->Update();
vtkSmartPointer<vtkPolyData> BooleanPolydata;
BooleanPolydata = BooltriangleFilter->GetOutput();
vtkNew<vtkIdFilter> BoolId;
BoolId->SetInputData(BooleanPolydata);
BoolId->SetCellIds(false);
BoolId->SetCellIds(false);
BoolId->SetPointIds(true);
BoolId->SetPointIdsArrayName("PointIds");
BoolId->Update();
vtkSmartPointer<vtkDataSet> BooleanWithId;
BooleanWithId = BoolId->GetOutput();
cout << "Boolean Done!" << endl;
vtkNew<vtkPoints> FairingPoints;
// Create the control locator from foot points polydata set.
vtkNew<vtkPointLocator> ControlLocator;
ControlLocator->SetDataSet(BooleanPolydata);
ControlLocator->BuildLocator();
vtkSmartPointer<vtkIdList> closestPoints = vtkSmartPointer<vtkIdList>::New();
for (int i = 0; i < FootPointsPolydata->GetNumberOfPoints(); ++i) {
double queryPoint[3];
FootPointsPolydata->GetPoint(i, queryPoint);
ControlLocator->FindPointsWithinRadius(5, queryPoint, closestPoints);
for (vtkIdType j = 0; j < closestPoints->GetNumberOfIds(); ++j) {
vtkIdType id = closestPoints->GetId(j);
double point[3];
BooleanPolydata->GetPoint(id, point);
FairingPoints->InsertNextPoint(point);
}
}
vtkSmartPointer<vtkIntArray> ROIIdsArr = vtkSmartPointer<vtkIntArray>::New();
ROIIdsArr->SetNumberOfTuples(FairingPoints->GetNumberOfPoints());
//roi pointIds
// should be from main data
for (vtkIdType i = 0; i < FairingPoints->GetNumberOfPoints(); ++i)
{
double point[3];
FairingPoints->GetPoint(i, point);
vtkIdType pointId = BooleanWithId->FindPoint(point);
ROIIdsArr->SetTypedComponent(i, 0, pointId);
}
vtkNew<vtkIdTypeArray> arr;
arr->SetNumberOfTuples(ROIIdsArr->GetNumberOfValues());
for (vtkIdType idx = 0; idx < ROIIdsArr->GetNumberOfValues(); ++idx)
{
arr->SetValue(idx, ROIIdsArr->GetValue(idx));
}
// Create point selection for the ROI
vtkNew<vtkSelection> sel;
vtkNew<vtkSelectionNode> node;
sel->AddNode(node);
node->GetProperties()->Set(vtkSelectionNode::CONTENT_TYPE(), vtkSelectionNode::INDICES);
node->GetProperties()->Set(vtkSelectionNode::FIELD_TYPE(), vtkSelectionNode::POINT);
node->SetSelectionList(arr);
vtkNew<vtkCGALRegionFairing> fr;
fr->SetInputData(0, BooleanWithId);
fr->SetInputData(1, sel);
fr->UpdateAttributesOff();
fr->Update();
cout << "fairing Done!" << endl;
but i met this error:
CGAL error: assertion violation!
Expression : CGAL::is_triangle(he, m_pmesh)
File : E:\VTK\vcpkg\vcpkg\installed\x64-windows\include\CGAL/Weights/cotangent_weights.h
Line : 356
Explanation:
Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html
2024-07-18 11:29:28.149 ( 63.142s) [ ]vtkCGALRegionFairing.cx:103 ERR| vtkCGALRegionFairing (000001DEC454D2C0): CGAL Exception: CGAL ERROR: assertion violation!
Expr: CGAL::is_triangle(he, m_pmesh)
File: E:\VTK\vcpkg\vcpkg\installed\x64-windows\include\CGAL/Weights/cotangent_weights.h
Line: 356
2024-07-18 11:29:28.180 ( 63.174s) [ ] vtkExecutive.cxx:741 ERR| vtkCompositeDataPipeline (000001DEBE85A710): Algorithm vtkCGALRegionFairing (000001DEC454D2C0) returned failure for request: vtkInformation (000001DEBF27BF50)
Debug: Off
Modified Time: 2640979
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA
FORWARD_DIRECTION: 0
ALGORITHM_AFTER_FORWARD: 1
FROM_OUTPUT_PORT: 0
what can i do for this problem?