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

Method FindClosestInsertedPoint

Common/DataModel/vtkIncrementalOctreePointLocator.cxx:223–254  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

221
222//------------------------------------------------------------------------------
223vtkIdType vtkIncrementalOctreePointLocator::FindClosestInsertedPoint(const double x[3])
224{
225 if (this->OctreeRootNode == nullptr || this->OctreeRootNode->GetNumberOfPoints() == 0 ||
226 this->OctreeRootNode->ContainsPoint(x) == 0)
227 {
228 return -1;
229 }
230
231 double miniDist2 = this->OctreeMaxDimSize * this->OctreeMaxDimSize * 4.0;
232 double elseDist2; // inter-node search
233 vtkIdType elsePntId; // inter-node search
234
235 vtkIncrementalOctreeNode* pLeafNode = this->GetLeafContainer(this->OctreeRootNode, x);
236 vtkIdType pointIndx = this->FindClosestPointInLeafNode(pLeafNode, x, &miniDist2);
237
238 if (miniDist2 > 0.0)
239 {
240 if (pLeafNode->GetDistance2ToInnerBoundary(x, this->OctreeRootNode) < miniDist2)
241 {
242 elsePntId =
243 this->FindClosestPointInSphereWithoutTolerance(x, miniDist2, pLeafNode, &elseDist2);
244 if (elseDist2 < miniDist2)
245 {
246 pointIndx = elsePntId;
247 miniDist2 = elseDist2;
248 }
249 }
250 }
251
252 pLeafNode = nullptr;
253 return pointIndx;
254}
255
256//------------------------------------------------------------------------------
257void vtkIncrementalOctreePointLocator::PrintSelf(ostream& os, vtkIndent indent)

Callers

nothing calls this directly

Tested by

no test coverage detected