------------------------------------------------------------------------------
| 1074 | |
| 1075 | //------------------------------------------------------------------------------ |
| 1076 | vtkIdType vtkCellLocator::FindCell(double x[3], double vtkNotUsed(tol2), vtkGenericCell* cell, |
| 1077 | int& subId, double pcoords[3], double* weights) |
| 1078 | { |
| 1079 | this->BuildLocator(); |
| 1080 | if (this->Tree == nullptr) |
| 1081 | { |
| 1082 | return -1; |
| 1083 | } |
| 1084 | // check if x outside of bounds |
| 1085 | if (!vtkAbstractCellLocator::IsInBounds(this->Bounds, x)) |
| 1086 | { |
| 1087 | return -1; |
| 1088 | } |
| 1089 | |
| 1090 | vtkIdList* cellIds; |
| 1091 | int ijk[3]; |
| 1092 | double dist2; |
| 1093 | vtkIdType idx, cellId; |
| 1094 | |
| 1095 | int leafStart = this->NumberOfOctants - |
| 1096 | this->NumberOfDivisions * this->NumberOfDivisions * this->NumberOfDivisions; |
| 1097 | |
| 1098 | // Find bucket point is in. |
| 1099 | this->GetBucketIndices(x, ijk); |
| 1100 | |
| 1101 | // Search the bucket that the point is in. |
| 1102 | if ((cellIds = this->Tree[leafStart + ijk[0] + ijk[1] * this->NumberOfDivisions + |
| 1103 | ijk[2] * this->NumberOfDivisions * this->NumberOfDivisions]) != nullptr) |
| 1104 | { |
| 1105 | // query each cell |
| 1106 | for (idx = 0; idx < cellIds->GetNumberOfIds(); ++idx) |
| 1107 | { |
| 1108 | // get the cell |
| 1109 | cellId = cellIds->GetId(idx); |
| 1110 | // check whether we could be close enough to the cell by |
| 1111 | // testing the cell bounds |
| 1112 | if (this->InsideCellBounds(x, cellId)) |
| 1113 | { |
| 1114 | this->DataSet->GetCell(cellId, cell); |
| 1115 | if (cell->EvaluatePosition(x, nullptr, subId, pcoords, dist2, weights) == 1) |
| 1116 | { |
| 1117 | return cellId; |
| 1118 | } |
| 1119 | } |
| 1120 | } |
| 1121 | } |
| 1122 | |
| 1123 | return -1; |
| 1124 | } |
| 1125 | |
| 1126 | //------------------------------------------------------------------------------ |
| 1127 | void vtkCellLocator::FindCellsWithinBounds(double* bbox, vtkIdList* cells) |
nothing calls this directly
no test coverage detected