------------------------------------------------------------------------------
| 87 | |
| 88 | //------------------------------------------------------------------------------ |
| 89 | vtkIdType vtkHyperTreeGridGeometricLocator::RecursiveSearch( |
| 90 | vtkHyperTreeGridNonOrientedGeometryCursor* cursor, const double pt[3]) |
| 91 | { |
| 92 | if (cursor->IsMasked() || |
| 93 | (this->HTG->HasAnyGhostCells() && |
| 94 | this->HTG->GetGhostCells()->GetTuple1(cursor->GetGlobalNodeIndex()))) |
| 95 | { |
| 96 | return -1; |
| 97 | } |
| 98 | if (this->CheckLeafOrChildrenMasked(cursor)) |
| 99 | { |
| 100 | return cursor->GetGlobalNodeIndex(); |
| 101 | } |
| 102 | |
| 103 | const double* origin = cursor->GetOrigin(); |
| 104 | if (origin == nullptr) |
| 105 | { |
| 106 | vtkErrorMacro("Cursor has no origin"); |
| 107 | return -1; |
| 108 | } |
| 109 | const double* size = cursor->GetSize(); |
| 110 | if (size == nullptr) |
| 111 | { |
| 112 | vtkErrorMacro("Cursor has no size"); |
| 113 | return -1; |
| 114 | } |
| 115 | |
| 116 | double normalizedPt[3]; |
| 117 | for (unsigned int d = 0; d < 3; d++) |
| 118 | { |
| 119 | normalizedPt[d] = (size[d] == 0.0) ? 0.0 : (pt[d] - origin[d]) / size[d]; |
| 120 | } |
| 121 | |
| 122 | const unsigned int bf = this->HTG->GetBranchFactor(); |
| 123 | const unsigned int dim = this->HTG->GetDimension(); |
| 124 | // Reorder the point according to the actual orientation of the HTG. |
| 125 | // This is because this->FindChildIndex only process the first dimension |
| 126 | // as this make the algorithm easier. |
| 127 | if (dim == 1) |
| 128 | { |
| 129 | std::swap(normalizedPt[0], normalizedPt[this->HTG->GetOrientation()]); |
| 130 | } |
| 131 | else if (dim == 2) |
| 132 | { |
| 133 | unsigned int axisx, axisy; |
| 134 | this->HTG->Get2DAxes(axisx, axisy); |
| 135 | std::swap(normalizedPt[0], normalizedPt[axisx]); |
| 136 | std::swap(normalizedPt[1], normalizedPt[axisy]); |
| 137 | } |
| 138 | vtkIdType childIndex = this->FindChildIndex(dim, bf, normalizedPt); |
| 139 | cursor->ToChild(childIndex); |
| 140 | return this->RecursiveSearch(cursor, pt); |
| 141 | } |
| 142 | |
| 143 | //------------------------------------------------------------------------------ |
| 144 | vtkIdType vtkHyperTreeGridGeometricLocator::FindCell(const double point[3], double tol, |
no test coverage detected