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

Method UpdateWorldToDataMatrix

Rendering/Image/vtkImageResliceMapper.cxx:475–493  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Update the WorldToData transformation matrix, which is just the inverse of the vtkProp3D matrix.

Source from the content-addressed store, hash-verified

473// Update the WorldToData transformation matrix, which is just the
474// inverse of the vtkProp3D matrix.
475void vtkImageResliceMapper::UpdateWorldToDataMatrix(vtkImageSlice* prop)
476{
477 // copy the matrix, but only if it has changed (we do this to
478 // preserve the modified time of the matrix)
479 double tmpmat[16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
480 if (!prop->GetIsIdentity())
481 {
482 vtkMatrix4x4::Invert(*prop->GetMatrix()->Element, tmpmat);
483 }
484 double* mat = *this->WorldToDataMatrix->Element;
485 for (int i = 0; i < 16; i++)
486 {
487 if (mat[i] != tmpmat[i])
488 {
489 this->WorldToDataMatrix->DeepCopy(tmpmat);
490 break;
491 }
492 }
493}
494
495//------------------------------------------------------------------------------
496// Update the SliceToWorld transformation matrix

Callers 1

UpdateResliceMatrixMethod · 0.95

Calls 3

InvertFunction · 0.50
GetMatrixMethod · 0.45
DeepCopyMethod · 0.45

Tested by

no test coverage detected