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

Method FindCellsWithinBounds

Common/DataModel/vtkStaticCellLocator.cxx:528–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526//------------------------------------------------------------------------------
527template <typename T>
528void CellProcessor<T>::FindCellsWithinBounds(double* bbox, vtkIdList* cells)
529{
530 vtkIdType binNum, numIds, jOffset, kOffset;
531 int i, j, k, ii, ijkMin[3], ijkMax[3];
532 double pMin[3], pMax[3];
533 const CellFragments<T>* ids;
534
535 // Initialize the list of cells
536 if (!cells)
537 {
538 return;
539 }
540 cells->Reset();
541
542 // Get the locator locations for the two extreme corners of the bounding box
543 pMin[0] = bbox[0];
544 pMin[1] = bbox[2];
545 pMin[2] = bbox[4];
546 pMax[0] = bbox[1];
547 pMax[1] = bbox[3];
548 pMax[2] = bbox[5];
549
550 this->Binner->GetBinIndices(pMin, ijkMin);
551 this->Binner->GetBinIndices(pMax, ijkMax);
552
553 // Loop over the block of bins and add cells that have not yet been visited.
554 for (k = ijkMin[2]; k <= ijkMax[2]; ++k)
555 {
556 kOffset = k * this->xyD;
557 for (j = ijkMin[1]; j <= ijkMax[1]; ++j)
558 {
559 jOffset = j * this->xD;
560 for (i = ijkMin[0]; i <= ijkMax[0]; ++i)
561 {
562 binNum = i + jOffset + kOffset;
563
564 if ((numIds = this->GetNumberOfIds(binNum)) > 0)
565 {
566 ids = this->GetIds(binNum);
567 for (ii = 0; ii < numIds; ii++)
568 {
569 // Could use query mechanism to speed up at some point
570 cells->InsertUniqueId(ids[ii].CellId);
571 } // for all points in bucket
572 } // if points in bucket
573 } // i-footprint
574 } // j-footprint
575 } // k-footprint
576}
577
578//------------------------------------------------------------------------------
579struct IntersectionInfo

Callers

nothing calls this directly

Calls 6

GetNumberOfIdsMethod · 0.95
GetIdsMethod · 0.95
BuildLocatorMethod · 0.95
InsertUniqueIdMethod · 0.80
ResetMethod · 0.45
GetBinIndicesMethod · 0.45

Tested by

no test coverage detected