1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkTransform.h,v $
6 Date: $Date: 2002/02/01 06:33:15 $
7 Version: $Revision: 1.1.1.1 $
10 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
12 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
13 The following terms apply to all files associated with the software unless
14 explicitly disclaimed in individual files. This copyright specifically does
15 not apply to the related textbook "The Visualization Toolkit" ISBN
16 013199837-4 published by Prentice Hall which is covered by its own copyright.
18 The authors hereby grant permission to use, copy, and distribute this
19 software and its documentation for any purpose, provided that existing
20 copyright notices are retained in all copies and that this notice is included
21 verbatim in any distributions. Additionally, the authors grant permission to
22 modify this software and its documentation for any purpose, provided that
23 such modifications are not distributed without the explicit consent of the
24 authors and that existing copyright notices are retained in all copies. Some
25 of the algorithms implemented by this software are patented, observe all
26 applicable patent law.
28 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
29 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
30 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
31 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
34 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
35 PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
36 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
37 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
40 =========================================================================*/
42 // .NAME vtkTransform - a general matrix transformation class
43 // .SECTION Description
44 // vtkTransform maintains a stack of 4x4 transformation matrices. A
45 // variety of methods are provided to manipulate the translation,
46 // scale, and rotation components of the matrix. Methods operate on
47 // the matrix at the top of the stack. Many objects, such as vtkActor and
48 // vtkCamera, use this class for performing their matrix operations.
49 // It is very important to realize that this class performs all of
50 // its operations in a right handed coordinate system with right
51 // handed rotations. Some other graphics libraries use left handed
52 // coordinate systems and rotations.
55 // By default the initial matrix is the identity matrix.
56 // .EXAMPLE XFormSph.cc
58 // vtkMatrix4x4 vtkTransformCollection vtkTransformFilter
59 // vtkTransformPolyDataFilter
61 #ifndef __vtkTransform_h
62 #define __vtkTransform_h
64 #include "vtkObject.h"
65 #include "vtkMatrix4x4.h"
66 #include "vtkPoints.h"
67 #include "vtkNormals.h"
68 #include "vtkVectors.h"
70 class VTK_EXPORT vtkTransform : public vtkObject
74 vtkTransform (const vtkTransform& t);
76 static vtkTransform *New() {return new vtkTransform;};
77 const char *GetClassName () {return "vtkTransform";};
78 void PrintSelf (ostream& os, vtkIndent indent);
79 vtkTransform &operator=(const vtkTransform &t);
86 void RotateX ( float angle);
87 void RotateY ( float angle);
88 void RotateZ (float angle);
89 void RotateWXYZ ( float angle, float x, float y, float z);
90 void Scale ( float x, float y, float z);
91 void Translate ( float x, float y, float z);
93 void GetTranspose (vtkMatrix4x4& transpose);
95 void GetInverse(vtkMatrix4x4& inverse);
96 float *GetOrientation();
97 void GetOrientation(float& rx, float& ry, float& rz);
98 float *GetOrientationWXYZ();
100 void GetPosition (float& x, float& y, float& z);
102 void GetScale (float& sx, float& sy, float& sz);
103 void SetMatrix(vtkMatrix4x4& m);
104 vtkMatrix4x4& GetMatrix();
105 void GetMatrix (vtkMatrix4x4& m);
106 void Concatenate (vtkMatrix4x4 & matrix);
107 void Multiply4x4 ( vtkMatrix4x4 & a, vtkMatrix4x4 & b, vtkMatrix4x4 & c);
108 void MultiplyPoint (float in[4],float out[4]);
109 void MultiplyPoints(vtkPoints *inPts, vtkPoints *outPts);
110 void MultiplyVectors(vtkVectors *inVectors, vtkVectors *outVectors);
111 void MultiplyNormals(vtkNormals *inNormals, vtkNormals *outNormals);
112 vtkSetVector4Macro(Point,float);
114 void GetPoint(float p[4]);
119 vtkMatrix4x4 **Stack;
120 vtkMatrix4x4 **StackBottom;
122 float Orientation[3];
126 inline void vtkTransform::MultiplyPoint (float in[4],float out[4])
128 this->Stack[0]->MultiplyPoint(in,out);