1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkMatrixToHomogeneousTransform.h
5 
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13 
14 =========================================================================*/
15 
16 /**
17  * @class   vtkMatrixToHomogeneousTransform
18  * @brief   convert a matrix to a transform
19  *
20  * This is a very simple class which allows a vtkMatrix4x4 to be used in
21  * place of a vtkHomogeneousTransform or vtkAbstractTransform.  For example,
22  * if you use it as a proxy between a matrix and vtkTransformPolyDataFilter
23  * then any modifications to the matrix will automatically be reflected in
24  * the output of the filter.
25  * @sa
26  * vtkPerspectiveTransform vtkMatrix4x4 vtkMatrixToLinearTransform
27  */
28 
29 #ifndef vtkMatrixToHomogeneousTransform_h
30 #define vtkMatrixToHomogeneousTransform_h
31 
32 #include "vtkCommonTransformsModule.h" // For export macro
33 #include "vtkHomogeneousTransform.h"
34 
35 class vtkMatrix4x4;
36 
37 class VTKCOMMONTRANSFORMS_EXPORT vtkMatrixToHomogeneousTransform : public vtkHomogeneousTransform
38 {
39 public:
40   static vtkMatrixToHomogeneousTransform* New();
41   vtkTypeMacro(vtkMatrixToHomogeneousTransform, vtkHomogeneousTransform);
42   void PrintSelf(ostream& os, vtkIndent indent) override;
43 
44   // Set the input matrix.  Any modifications to the matrix will be
45   // reflected in the transformation.
46   virtual void SetInput(vtkMatrix4x4*);
47   vtkGetObjectMacro(Input, vtkMatrix4x4);
48 
49   /**
50    * The input matrix is left as-is, but the transformation matrix
51    * is inverted.
52    */
53   void Inverse() override;
54 
55   /**
56    * Get the MTime: this is the bit of magic that makes everything work.
57    */
58   vtkMTimeType GetMTime() override;
59 
60   /**
61    * Make a new transform of the same type.
62    */
63   vtkAbstractTransform* MakeTransform() override;
64 
65 protected:
66   vtkMatrixToHomogeneousTransform();
67   ~vtkMatrixToHomogeneousTransform() override;
68 
69   void InternalUpdate() override;
70   void InternalDeepCopy(vtkAbstractTransform* transform) override;
71 
72   int InverseFlag;
73   vtkMatrix4x4* Input;
74 
75 private:
76   vtkMatrixToHomogeneousTransform(const vtkMatrixToHomogeneousTransform&) = delete;
77   void operator=(const vtkMatrixToHomogeneousTransform&) = delete;
78 };
79 
80 #endif
81