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

Method GetSliceFromCamera

Rendering/Core/vtkImageSliceMapper.cxx:436–451  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

434
435//------------------------------------------------------------------------------
436int vtkImageSliceMapper::GetSliceFromCamera(double const* propMatrix, vtkCamera* camera)
437{
438 int orientation = this->Orientation;
439
440 double p[4] = { 0, 0, 0, 1 };
441 camera->GetFocalPoint(p);
442
443 // convert world coords to data coords
444 double mat[16];
445 vtkMatrix4x4::Invert(propMatrix, mat);
446 vtkMatrix4x4::MultiplyPoint(mat, p, p);
447 double slicepos = p[orientation] / p[3];
448
449 // round to get integer, add a tolerance to prefer rounding up
450 return vtkMath::Floor(slicepos + (0.5 + 7.62939453125e-06));
451}
452
453//------------------------------------------------------------------------------
454void vtkImageSliceMapper::GetSlicePlaneInDataCoords(

Callers 1

ProcessRequestMethod · 0.95

Calls 2

InvertFunction · 0.50
MultiplyPointFunction · 0.50

Tested by

no test coverage detected