1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkMatrixToLinearTransform.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   vtkMatrixToLinearTransform
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 vtkLinearTransform 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  * vtkTransform vtkMatrix4x4 vtkMatrixToHomogeneousTransform
27 */
28 
29 #ifndef vtkMatrixToLinearTransform_h
30 #define vtkMatrixToLinearTransform_h
31 
32 #include "vtkCommonTransformsModule.h" // For export macro
33 #include "vtkLinearTransform.h"
34 
35 class vtkMatrix4x4;
36 
37 class VTKCOMMONTRANSFORMS_EXPORT vtkMatrixToLinearTransform : public vtkLinearTransform
38 {
39  public:
40   static vtkMatrixToLinearTransform *New();
41   vtkTypeMacro(vtkMatrixToLinearTransform,vtkLinearTransform);
42   void PrintSelf (ostream& os, vtkIndent indent) override;
43 
44   //@{
45   /**
46    * Set the input matrix.  Any modifications to the matrix will be
47    * reflected in the transformation.
48    */
49   virtual void SetInput(vtkMatrix4x4*);
50   vtkGetObjectMacro(Input,vtkMatrix4x4);
51   //@}
52 
53   /**
54    * The input matrix is left as-is, but the transformation matrix
55    * is inverted.
56    */
57   void Inverse() override;
58 
59   /**
60    * Get the MTime: this is the bit of magic that makes everything work.
61    */
62   vtkMTimeType GetMTime() override;
63 
64   /**
65    * Make a new transform of the same type.
66    */
67   vtkAbstractTransform *MakeTransform() override;
68 
69 protected:
70   vtkMatrixToLinearTransform();
71   ~vtkMatrixToLinearTransform() override;
72 
73   void InternalUpdate() override;
74   void InternalDeepCopy(vtkAbstractTransform *transform) override;
75 
76   int InverseFlag;
77   vtkMatrix4x4 *Input;
78 private:
79   vtkMatrixToLinearTransform(const vtkMatrixToLinearTransform&) = delete;
80   void operator=(const vtkMatrixToLinearTransform&) = delete;
81 };
82 
83 #endif
84