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

Method GetRotatedId

Filters/General/vtkAxisAlignedTransformFilter.cxx:660–694  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

658
659//----------------------------------------------------------------------------
660int vtkAxisAlignedTransformFilter::GetRotatedId(
661 int id, int rotationMatrix[3][3], int newDims[3], int dims[3], int Tvec[3], bool transposed)
662{
663 int x, y, z;
664 if (transposed)
665 {
666 z = id % std::max(newDims[2] - 1, 1);
667 y = (id / (std::max(newDims[2] - 1, 1))) % std::max(newDims[1] - 1, 1);
668 x = id / std::max(newDims[2] - 1, 1) / std::max(newDims[1] - 1, 1);
669 }
670 else
671 {
672 x = id % std::max(newDims[0] - 1, 1);
673 y = (id / (std::max(newDims[0] - 1, 1))) % std::max(newDims[1] - 1, 1);
674 z = id / std::max(newDims[0] - 1, 1) / std::max(newDims[1] - 1, 1);
675 }
676
677 int newX =
678 rotationMatrix[0][0] * x + rotationMatrix[1][0] * y + rotationMatrix[2][0] * z + Tvec[0];
679 int newY =
680 rotationMatrix[0][1] * x + rotationMatrix[1][1] * y + rotationMatrix[2][1] * z + Tvec[1];
681 int newZ =
682 rotationMatrix[0][2] * x + rotationMatrix[1][2] * y + rotationMatrix[2][2] * z + Tvec[2];
683
684 if (transposed)
685 {
686 return newX * std::max(dims[2] - 1, 1) * std::max(dims[1] - 1, 1) +
687 newY * std::max(dims[2] - 1, 1) + newZ;
688 }
689 else
690 {
691 return newZ * std::max(dims[0] - 1, 1) * std::max(dims[1] - 1, 1) +
692 newY * std::max(dims[0] - 1, 1) + newX;
693 }
694}
695
696//----------------------------------------------------------------------------
697vtkAxisAlignedTransformFilter::Axis vtkAxisAlignedTransformFilter::FindNormalAxis(int dims[3])

Callers 2

ProcessHTGMethod · 0.95

Calls 1

maxFunction · 0.50

Tested by

no test coverage detected