VTK  9.7.1
vtkAxisAlignedTransformFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
16 #ifndef vtkAxisAlignedTransformFilter_h
17 #define vtkAxisAlignedTransformFilter_h
18 
19 #include "vtkDataObjectAlgorithm.h"
20 
21 #include "vtkFiltersGeneralModule.h" // for export macro
22 
23 VTK_ABI_NAMESPACE_BEGIN
24 class vtkHyperTree;
25 class vtkHyperTreeGrid;
27 class vtkTransform;
28 class vtkImageData;
29 class vtkRectilinearGrid;
30 
31 class VTKFILTERSGENERAL_EXPORT vtkAxisAlignedTransformFilter : public vtkDataObjectAlgorithm
32 {
33 public:
35  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
41  enum Axis : int
42  {
43  X = 0,
44  Y = 1,
45  Z = 2
46  };
47 
51  enum Angle : int
52  {
53  ROT0 = 0,
54  ROT90 = 1,
55  ROT180 = 2,
56  ROT270 = 3
57  };
58 
60 
63  vtkSetVector3Macro(Translation, double);
64  vtkGetVectorMacro(Translation, double, 3);
66 
68 
71  vtkSetVector3Macro(Scale, double);
72  vtkGetVectorMacro(Scale, double, 3);
74 
76 
81  vtkSetClampMacro(RotationAngle, int, ROT0, ROT270);
82  vtkGetMacro(RotationAngle, int);
84 
86 
90  vtkSetClampMacro(RotationAxis, int, X, Z);
91  vtkGetMacro(RotationAxis, unsigned int);
93 
94 protected:
96  ~vtkAxisAlignedTransformFilter() override = default;
97 
102  vtkInformationVector* outputVector) override;
103 
107  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
108  vtkInformationVector* outputVector) override;
109 
110  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
111  vtkInformationVector* outputVector) override;
112  int FillInputPortInformation(int port, vtkInformation* info) override;
113 
114 private:
116  void operator=(const vtkAxisAlignedTransformFilter&) = delete;
117 
119 
122  bool ProcessGeneric(vtkDataObject* inputDataObject, vtkDataObject* outputDataObject);
123  bool ProcessHTG(vtkHyperTreeGrid* inputHTG, vtkHyperTreeGrid* outputHTG, int R[3][3]);
124  bool ProcessImageData(vtkImageData* inputID, vtkImageData* outputID, int R[3][3]);
125  bool ProcessRectilinearGrid(
126  vtkRectilinearGrid* inputRG, vtkRectilinearGrid* outputRG, int R[3][3]);
128 
132  bool Dispatch(vtkDataObject* inputDataObject, vtkDataObject* outputDataObject);
133 
138  void GetRotationMatrix(int axis, int rotation, int R[3][3]);
139 
143  int GetRotatedId(int id, int R[3][3], int newDims[3], int dims[3], int Tvec[3], bool transposed);
144 
148  void GetTransform(vtkTransform* transform);
149 
154  void ComputeCellScale(vtkDataArray* xCoords, vtkDataArray* yCoords, vtkDataArray* zCoords,
155  int dims[3], double scales[3]);
156 
161  void ApplyCellScale(vtkHyperTreeGridNonOrientedCursor* cursor, double scales[3]);
162 
167  vtkAxisAlignedTransformFilter::Axis FindNormalAxis(int dims[3]);
168 
173  std::vector<unsigned int> ComputePermutation(
174  unsigned int branchFactor, int axis, int normalAxis, int rotation, int dimension);
175 
180  void CopyAndRotate(vtkHyperTree* input, vtkHyperTree* output, vtkIdType inputIndex,
181  vtkIdType outputIndex, const std::vector<unsigned int>& permutation, unsigned int depth,
183 
188  vtkSmartPointer<vtkHyperTree> CreateNewRotatedHyperTree(
189  vtkHyperTreeGrid* htg, vtkHyperTree* dest, const std::vector<unsigned int>& permutation);
190 
191  // Transformation parameters
192  double Translation[3] = { 0.0, 0.0, 0.0 };
193  double Scale[3] = { 1.0, 1.0, 1.0 };
194  int RotationAngle = Angle::ROT0;
195  int RotationAxis = Axis::X;
196 };
197 
198 VTK_ABI_NAMESPACE_END
199 #endif
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
a dataset that is topologically regular with variable spacing in the three coordinate directions ...
Applies an axis-aligned affine transformation (translation, scaling, and rotation) ...
Axis
Enumeration for specifying the rotation axis.
Store vtkAlgorithm input/output information.
static vtkDataObjectAlgorithm * New()
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
vtkTypeBool ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
Angle
Enumeration for specifying the rotation angle.
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
int vtkIdType
Definition: vtkType.h:363
Objects for traversal a HyperTreeGrid.
int vtkTypeBool
Definition: vtkABI.h:64
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
Superclass for algorithms that produce only data object as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
A data object structured as a tree.
Definition: vtkHyperTree.h:170
Store zero or more vtkInformation instances.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
general representation of visualization data
Definition: vtkDataObject.h:55
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.