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

Method ComputeRowBounds

Rendering/Volume/vtkFixedPointVolumeRayCastMapper.cxx:1888–2265  ·  view source on GitHub ↗

Return 0 if our volume is outside the view frustum, 1 if it is in the view frustum.

Source from the content-addressed store, hash-verified

1886// Return 0 if our volume is outside the view frustum, 1 if it
1887// is in the view frustum.
1888int vtkFixedPointVolumeRayCastMapper::ComputeRowBounds(
1889 vtkRenderer* ren, int imageFlag, int rowBoundsFlag, int inputExtent[6])
1890{
1891 float voxelPoint[3];
1892 double viewPoint[8][4];
1893 int i, j, k;
1894 unsigned short* ucptr;
1895 float minX, minY, maxX, maxY, minZ, maxZ;
1896
1897 minX = 1.0;
1898 minY = 1.0;
1899 maxX = -1.0;
1900 maxY = -1.0;
1901 minZ = 1.0;
1902 maxZ = 0.0;
1903
1904 float bounds[6];
1905 int dim[3];
1906 dim[0] = inputExtent[1] - inputExtent[0] + 1;
1907 dim[1] = inputExtent[3] - inputExtent[2] + 1;
1908 dim[2] = inputExtent[5] - inputExtent[4] + 1;
1909
1910 bounds[0] = bounds[2] = bounds[4] = 0.0;
1911 bounds[1] = static_cast<float>(dim[0] - 1);
1912 bounds[3] = static_cast<float>(dim[1] - 1);
1913 bounds[5] = static_cast<float>(dim[2] - 1);
1914
1915 int insideFlag = 0;
1916 double camPos[4];
1917 ren->GetActiveCamera()->GetPosition(camPos);
1918 camPos[3] = 1.0;
1919 this->WorldToVoxelsMatrix->MultiplyPoint(camPos, camPos);
1920 if (camPos[3])
1921 {
1922 camPos[0] /= camPos[3];
1923 camPos[1] /= camPos[3];
1924 camPos[2] /= camPos[3];
1925 }
1926
1927 // If we have a simple crop box then we can tighten the bounds
1928 if (this->Cropping && this->CroppingRegionFlags == 0x2000)
1929 {
1930 bounds[0] = this->VoxelCroppingRegionPlanes[0];
1931 bounds[1] = this->VoxelCroppingRegionPlanes[1];
1932 bounds[2] = this->VoxelCroppingRegionPlanes[2];
1933 bounds[3] = this->VoxelCroppingRegionPlanes[3];
1934 bounds[4] = this->VoxelCroppingRegionPlanes[4];
1935 bounds[5] = this->VoxelCroppingRegionPlanes[5];
1936 }
1937
1938 if (camPos[0] >= bounds[0] && camPos[0] <= bounds[1] && camPos[1] >= bounds[2] &&
1939 camPos[1] <= bounds[3] && camPos[2] >= bounds[4] && camPos[2] <= bounds[5])
1940 {
1941 insideFlag = 1;
1942 }
1943
1944 // Copy the voxelsToView matrix to 16 floats
1945 float voxelsToViewMatrix[16];

Callers 2

Calls 9

GetActiveCameraMethod · 0.80
AllocateImageMethod · 0.80
CheckAbortStatusMethod · 0.80
minFunction · 0.50
maxFunction · 0.50
GetPositionMethod · 0.45
MultiplyPointMethod · 0.45
ClearImageMethod · 0.45
GetImageMethod · 0.45

Tested by

no test coverage detected