| 1410 | } |
| 1411 | |
| 1412 | void vtkLoopBooleanPolyDataFilter::Impl::ThresholdRegions(vtkPolyData** surfaces) |
| 1413 | { |
| 1414 | vtkPoints* points[4]; |
| 1415 | vtkCellArray* cells[4]; |
| 1416 | vtkIntArray* boundaryPoints[4]; |
| 1417 | vtkIntArray* boundaryCells[4]; |
| 1418 | vtkIntArray* booleanCells[4]; |
| 1419 | |
| 1420 | for (int i = 0; i < 4; i++) |
| 1421 | { |
| 1422 | points[i] = vtkPoints::New(); |
| 1423 | cells[i] = vtkCellArray::New(); |
| 1424 | boundaryPoints[i] = vtkIntArray::New(); |
| 1425 | boundaryCells[i] = vtkIntArray::New(); |
| 1426 | booleanCells[i] = vtkIntArray::New(); |
| 1427 | } |
| 1428 | |
| 1429 | for (int i = 0; i < 2; i++) |
| 1430 | { |
| 1431 | int numCells = this->Mesh[i]->GetNumberOfCells(); |
| 1432 | for (int j = 0; j < numCells; j++) |
| 1433 | { |
| 1434 | int value = this->BooleanArray[i]->GetValue(j); |
| 1435 | vtkIdType npts; |
| 1436 | const vtkIdType* pts; |
| 1437 | this->Mesh[i]->GetCellPoints(j, npts, pts); |
| 1438 | if (value < 0) |
| 1439 | { |
| 1440 | vtkSmartPointer<vtkIdList> newPointIds = vtkSmartPointer<vtkIdList>::New(); |
| 1441 | newPointIds->SetNumberOfIds(3); |
| 1442 | for (int k = 0; k < npts; k++) |
| 1443 | { |
| 1444 | double pt[3]; |
| 1445 | this->Mesh[i]->GetPoint(pts[k], pt); |
| 1446 | vtkIdType newId = points[3 * i]->InsertNextPoint(pt); |
| 1447 | newPointIds->SetId(k, newId); |
| 1448 | boundaryPoints[3 * i]->InsertValue(newId, this->BoundaryPointArray[i]->GetValue(pts[k])); |
| 1449 | } |
| 1450 | vtkIdType cellId = cells[3 * i]->InsertNextCell(newPointIds); |
| 1451 | boundaryCells[3 * i]->InsertValue(cellId, this->BoundaryCellArray[i]->GetValue(j)); |
| 1452 | booleanCells[3 * i]->InsertValue(cellId, this->BooleanArray[i]->GetValue(j)); |
| 1453 | } |
| 1454 | if (value > 0) |
| 1455 | { |
| 1456 | vtkSmartPointer<vtkIdList> newPointIds = vtkSmartPointer<vtkIdList>::New(); |
| 1457 | newPointIds->SetNumberOfIds(3); |
| 1458 | for (int k = 0; k < npts; k++) |
| 1459 | { |
| 1460 | double pt[3]; |
| 1461 | this->Mesh[i]->GetPoint(pts[k], pt); |
| 1462 | vtkIdType newId = points[i + 1]->InsertNextPoint(pt); |
| 1463 | newPointIds->SetId(k, newId); |
| 1464 | boundaryPoints[i + 1]->InsertValue(newId, this->BoundaryPointArray[i]->GetValue(pts[k])); |
| 1465 | } |
| 1466 | vtkIdType cellId = cells[i + 1]->InsertNextCell(newPointIds); |
| 1467 | boundaryCells[i + 1]->InsertValue(cellId, this->BoundaryCellArray[i]->GetValue(j)); |
| 1468 | booleanCells[i + 1]->InsertValue(cellId, this->BooleanArray[i]->GetValue(j)); |
| 1469 | } |
no test coverage detected