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

Function ApplyTranslation

Filters/General/vtkAxisAlignedTransformFilter.cxx:107–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105//------------------------------------------------------------------------------
106template <typename GridType>
107void ApplyTranslation(GridType* grid, double Translation[3])
108{
109 vtkDoubleArray* xCoordinate = vtkDoubleArray::SafeDownCast(grid->GetXCoordinates());
110 for (vtkIdType i = 0; i < xCoordinate->GetNumberOfTuples(); ++i)
111 {
112 xCoordinate->SetTuple1(i, xCoordinate->GetTuple1(i) + Translation[0]);
113 }
114 vtkDoubleArray* yCoordinate = vtkDoubleArray::SafeDownCast(grid->GetYCoordinates());
115 for (vtkIdType i = 0; i < yCoordinate->GetNumberOfTuples(); ++i)
116 {
117 yCoordinate->SetTuple1(i, yCoordinate->GetTuple1(i) + Translation[1]);
118 }
119 vtkDoubleArray* zCoordinate = vtkDoubleArray::SafeDownCast(grid->GetZCoordinates());
120 for (vtkIdType i = 0; i < zCoordinate->GetNumberOfTuples(); ++i)
121 {
122 zCoordinate->SetTuple1(i, zCoordinate->GetTuple1(i) + Translation[2]);
123 }
124}
125
126//------------------------------------------------------------------------------
127template <typename GridType>

Callers 2

ProcessHTGMethod · 0.85

Calls 6

SetTuple1Method · 0.80
GetTuple1Method · 0.80
GetXCoordinatesMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetYCoordinatesMethod · 0.45
GetZCoordinatesMethod · 0.45

Tested by

no test coverage detected