------------------------------------------------------------------------------
| 434 | |
| 435 | //------------------------------------------------------------------------------ |
| 436 | int 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 | //------------------------------------------------------------------------------ |
| 454 | void vtkImageSliceMapper::GetSlicePlaneInDataCoords( |
no test coverage detected