MCPcopy Create free account
hub / github.com/Kitware/VTK / FindCell

Method FindCell

Common/DataModel/vtkHyperTreeGridGeometricLocator.cxx:144–181  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

142
143//------------------------------------------------------------------------------
144vtkIdType vtkHyperTreeGridGeometricLocator::FindCell(const double point[3], double tol,
145 vtkGenericCell* cell, int& subId, double pcoords[3], double* weights)
146{
147 // because vtkHyperTreeGridGeometricLocator::Search use internal tolerance we
148 // store the current one and will restore it after we're done
149 double previousTol = this->Tolerance;
150 this->Tolerance = tol;
151 vtkNew<vtkHyperTreeGridNonOrientedGeometryCursor> cursor;
152 vtkIdType globId = this->Search(point, cursor);
153 this->Tolerance = previousTol;
154
155 if (globId < 0)
156 {
157 return -1;
158 }
159 if (!this->ConstructCell(cursor, cell))
160 {
161 vtkErrorMacro("Failed to construct cell");
162 return -1;
163 }
164
165 double dist2 = 0.0;
166 double closestPoint[3];
167 int result = cell->EvaluatePosition(point, closestPoint, subId, pcoords, dist2, weights);
168 if (result < 0)
169 {
170 globId = -1;
171 }
172 else if (result == 0)
173 {
174 if (dist2 > tol * tol)
175 {
176 globId = -1;
177 }
178 }
179
180 return globId;
181}
182
183//------------------------------------------------------------------------------
184int vtkHyperTreeGridGeometricLocator::IntersectWithLine(const double p0[3], const double p1[3],

Callers 1

IntersectWithLineMethod · 0.95

Calls 3

SearchMethod · 0.95
ConstructCellMethod · 0.95
EvaluatePositionMethod · 0.45

Tested by

no test coverage detected