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 // .NAME vtkMatrixToHomogeneousTransform - convert a matrix to a transform
17 // .SECTION Description
18 // This is a very simple class which allows a vtkMatrix4x4 to be used in
19 // place of a vtkHomogeneousTransform or vtkAbstractTransform.  For example,
20 // if you use it as a proxy between a matrix and vtkTransformPolyDataFilter
21 // then any modifications to the matrix will automatically be reflected in
22 // the output of the filter.
23 // .SECTION See Also
24 // vtkPerspectiveTransform vtkMatrix4x4 vtkMatrixToLinearTransform
25 
26 #ifndef vtkMatrixToHomogeneousTransform_h
27 #define vtkMatrixToHomogeneousTransform_h
28 
29 #include "vtkCommonTransformsModule.h" // For export macro
30 #include "vtkHomogeneousTransform.h"
31 
32 class vtkMatrix4x4;
33 
34 class VTKCOMMONTRANSFORMS_EXPORT vtkMatrixToHomogeneousTransform : public vtkHomogeneousTransform
35 {
36  public:
37   static vtkMatrixToHomogeneousTransform *New();
38   vtkTypeMacro(vtkMatrixToHomogeneousTransform,vtkHomogeneousTransform);
39   void PrintSelf (ostream& os, vtkIndent indent);
40 
41   // Set the input matrix.  Any modifications to the matrix will be
42   // reflected in the transformation.
43   virtual void SetInput(vtkMatrix4x4*);
44   vtkGetObjectMacro(Input,vtkMatrix4x4);
45 
46   // Description:
47   // The input matrix is left as-is, but the transformation matrix
48   // is inverted.
49   void Inverse();
50 
51   // Description:
52   // Get the MTime: this is the bit of magic that makes everything work.
53   unsigned long GetMTime();
54 
55   // Description:
56   // Make a new transform of the same type.
57   vtkAbstractTransform *MakeTransform();
58 
59 protected:
60   vtkMatrixToHomogeneousTransform();
61   ~vtkMatrixToHomogeneousTransform();
62 
63   void InternalUpdate();
64   void InternalDeepCopy(vtkAbstractTransform *transform);
65 
66   int InverseFlag;
67   vtkMatrix4x4 *Input;
68 private:
69   vtkMatrixToHomogeneousTransform(const vtkMatrixToHomogeneousTransform&);  // Not implemented.
70   void operator=(const vtkMatrixToHomogeneousTransform&);  // Not implemented.
71 };
72 
73 #endif
74