You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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();
//vtkSmartPointer<vtkPolyDataBooleanFilter> booleanFilter = vtkSmartPointer<vtkPolyDataBooleanFilter>::New();
//booleanFilter->SetInputData(0, CubeSmoothFilter1->GetOutput());
//booleanFilter->SetInputData(1, OriginalData);
//booleanFilter->SetOperModeToUnion();
//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;
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:
but i met this error:
what can i do for this problem?
The text was updated successfully, but these errors were encountered: