| 5751 | //------------------------------------------------------------------------------ |
| 5752 | |
| 5753 | void vtkBoxClipDataSet::ClipBoxInOut1D(vtkPoints* newPoints, vtkGenericCell* cell, |
| 5754 | vtkIncrementalPointLocator* locator, vtkCellArray** lines, vtkPointData* inPD, |
| 5755 | vtkPointData** outPD, vtkCellData* inCD, vtkIdType cellId, vtkCellData** outCD) |
| 5756 | { |
| 5757 | vtkIdType cellType = cell->GetCellType(); |
| 5758 | vtkIdList* cellIds = cell->GetPointIds(); |
| 5759 | vtkCellArray* arrayline = vtkCellArray::New(); |
| 5760 | vtkPoints* cellPts = cell->GetPoints(); |
| 5761 | vtkIdType npts = cellPts->GetNumberOfPoints(); |
| 5762 | std::vector<vtkIdType> cellptId(npts); |
| 5763 | vtkIdType iid[2]; |
| 5764 | const vtkIdType* v_id = nullptr; |
| 5765 | vtkIdType ptId; |
| 5766 | vtkIdType tab_id[2]; |
| 5767 | vtkIdType ptsline = 2; |
| 5768 | |
| 5769 | int i, j; |
| 5770 | unsigned int allInside; |
| 5771 | unsigned int planes; |
| 5772 | unsigned int cutInd; |
| 5773 | |
| 5774 | double value; |
| 5775 | double t; |
| 5776 | double v[3], x[3]; |
| 5777 | double v_line[2][3]; |
| 5778 | |
| 5779 | for (i = 0; i < npts; i++) |
| 5780 | { |
| 5781 | cellptId[i] = cellIds->GetId(i); |
| 5782 | } |
| 5783 | |
| 5784 | // Convert all 1d cells to single line. |
| 5785 | this->CellGrid(cellType, npts, cellptId.data(), arrayline); |
| 5786 | |
| 5787 | unsigned int totalnewline = arrayline->GetNumberOfCells(); |
| 5788 | for (unsigned int idlinenew = 0; idlinenew < totalnewline; idlinenew++) |
| 5789 | { |
| 5790 | arrayline->GetNextCell(ptsline, v_id); |
| 5791 | |
| 5792 | for (allInside = 1, i = 0; i < 2; i++) |
| 5793 | { |
| 5794 | ptId = cellIds->GetId(v_id[i]); |
| 5795 | cellPts->GetPoint(v_id[i], v); |
| 5796 | |
| 5797 | if (!((v[0] >= this->BoundBoxClip[0][0]) && (v[0] <= this->BoundBoxClip[0][1]) && |
| 5798 | (v[1] >= this->BoundBoxClip[1][0]) && (v[1] <= this->BoundBoxClip[1][1]) && |
| 5799 | (v[2] >= this->BoundBoxClip[2][0]) && (v[2] <= this->BoundBoxClip[2][1]))) |
| 5800 | { |
| 5801 | // outside |
| 5802 | allInside = 0; |
| 5803 | } |
| 5804 | |
| 5805 | if (locator->InsertUniquePoint(v, iid[i])) |
| 5806 | { |
| 5807 | outPD[0]->CopyData(inPD, ptId, iid[i]); |
| 5808 | outPD[1]->CopyData(inPD, ptId, iid[i]); |
| 5809 | } |
| 5810 | } |
no test coverage detected