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

Method ComputeBounds

Rendering/VolumeOpenGL2/vtkVolumeTexture.cxx:976–1136  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

974
975//------------------------------------------------------------------------------
976void vtkVolumeTexture::ComputeBounds(VolumeBlock* block)
977{
978 vtkImageData* imData = vtkImageData::SafeDownCast(block->DataSet);
979 vtkRectilinearGrid* rGrid = vtkRectilinearGrid::SafeDownCast(block->DataSet);
980 double spacing[3];
981 double origin[3];
982 double* direction = nullptr;
983 if (imData)
984 {
985 imData->GetSpacing(spacing); /// TODO could be causing inf issue on streaming
986 imData->GetExtent(block->Extents);
987 imData->GetOrigin(origin);
988 direction = imData->GetDirectionMatrix()->GetData();
989 }
990 else if (rGrid)
991 {
992 double bounds[6];
993 int dims[3];
994 rGrid->GetBounds(bounds);
995 rGrid->GetDimensions(dims);
996 for (int cc = 0; cc < 3; ++cc)
997 {
998 spacing[cc] = (bounds[2 * cc + 1] - bounds[2 * cc]) / dims[cc];
999 origin[cc] = bounds[2 * cc];
1000 }
1001 rGrid->GetExtent(block->Extents);
1002 if (this->IsCellData)
1003 {
1004 for (int i = 0; i < 3; ++i)
1005 {
1006 // The block extents for rectilinear grids were not overridden before. // Hence, this
1007 // additional step of adjusting them here.
1008 block->Extents[2 * i + 1] -= 1;
1009 // Re-computing spacing with the updated extents/dimensions.
1010 spacing[i] = (bounds[2 * i + 1] - bounds[2 * i]) / (dims[i] - 1);
1011 }
1012 }
1013 }
1014
1015 int swapBounds[3];
1016 swapBounds[0] = (spacing[0] < 0);
1017 swapBounds[1] = (spacing[1] < 0);
1018 swapBounds[2] = (spacing[2] < 0);
1019
1020 // push corners through matrix to get bounding box
1021 int iMin, iMax, jMin, jMax, kMin, kMax;
1022 int* extent = block->Extents;
1023 iMin = extent[0];
1024 iMax = extent[1] + this->IsCellData;
1025 jMin = extent[2];
1026 jMax = extent[3] + this->IsCellData;
1027 kMin = extent[4];
1028 kMax = extent[5] + this->IsCellData;
1029 int ijkCorners[8][3] = { { iMin, jMin, kMin }, { iMax, jMin, kMin }, { iMin, jMax, kMin },
1030 { iMax, jMax, kMin }, { iMin, jMin, kMax }, { iMax, jMin, kMax }, { iMin, jMax, kMax },
1031 { iMax, jMax, kMax } };
1032 double xMin, xMax, yMin, yMax, zMin, zMax;
1033 xMin = yMin = zMin = VTK_DOUBLE_MAX;

Callers 1

CreateBlocksMethod · 0.95

Calls 9

minFunction · 0.50
maxFunction · 0.50
GetSpacingMethod · 0.45
GetExtentMethod · 0.45
GetOriginMethod · 0.45
GetDataMethod · 0.45
GetBoundsMethod · 0.45
GetDimensionsMethod · 0.45
GetPointMethod · 0.45

Tested by

no test coverage detected