VTK
vtkProp3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkProp3D.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 =========================================================================*/
32 #ifndef vtkProp3D_h
33 #define vtkProp3D_h
34 
35 #include "vtkRenderingCoreModule.h" // For export macro
36 #include "vtkProp.h"
37 
38 class vtkRenderer;
39 class vtkTransform;
40 class vtkLinearTransform;
41 
43 {
44 public:
45  vtkTypeMacro(vtkProp3D,vtkProp);
46  void PrintSelf(ostream& os, vtkIndent indent);
47 
49  void ShallowCopy(vtkProp *prop);
50 
52 
53  virtual void SetPosition(double x, double y, double z)
54  {
55  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
56  "): setting Position to (" << x << "," << y << "," <<
57  z << ")");
58  if ((this->Position[0] != x)||
59  (this->Position[1] != y)||
60  (this->Position[2] != z))
61  {
62  this->Position[0] = x;
63  this->Position[1] = y;
64  this->Position[2] = z;
65  this->Modified();
66  this->IsIdentity = 0;
67  }
68  };
70 
71  virtual void SetPosition(double pos[3])
72  { this->SetPosition(pos[0], pos[1], pos[2]); }
73  vtkGetVectorMacro(Position, double, 3);
74  void AddPosition(double deltaPosition[3]);
75  void AddPosition(double deltaX, double deltaY, double deltaZ);
76 
78 
80  virtual void SetOrigin(double x, double y, double z)
81  {
82  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
83  "): setting Origin to (" << x << "," << y << "," <<
84  z << ")");
85  if ((this->Origin[0] != x)||
86  (this->Origin[1] != y)||
87  (this->Origin[2] != z))
88  {
89  this->Origin[0] = x;
90  this->Origin[1] = y;
91  this->Origin[2] = z;
92  this->Modified();
93  this->IsIdentity = 0;
94  }
95  };
96  virtual void SetOrigin(const double pos[3])
97  { this->SetOrigin(pos[0], pos[1], pos[2]); }
98  vtkGetVectorMacro(Origin, double, 3);
100 
102 
105  virtual void SetScale(double x, double y, double z)
106  {
107  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
108  "): setting Scale to (" << x << "," << y << "," <<
109  z << ")");
110  if (this->Scale[0] != x ||
111  this->Scale[1] != y ||
112  this->Scale[2] != z )
113  {
114  this->Scale[0] = x;
115  this->Scale[1] = y;
116  this->Scale[2] = z;
117  this->Modified();
118  this->IsIdentity = 0;
119  }
120  };
121  virtual void SetScale(double scale[3])
122  { this->SetScale(scale[0], scale[1], scale[2]); }
123  vtkGetVectorMacro(Scale, double, 3);
125 
127 
128  void SetScale(double s)
129  { this->SetScale(s, s, s); }
131 
133 
142  void SetUserTransform(vtkLinearTransform *transform);
143  vtkGetObjectMacro(UserTransform, vtkLinearTransform);
145 
147 
148  void SetUserMatrix(vtkMatrix4x4 *matrix);
149  vtkMatrix4x4 *GetUserMatrix();
151 
153 
156  virtual void GetMatrix(vtkMatrix4x4 *m);
157  virtual void GetMatrix(double m[16]);
159 
164  void GetBounds(double bounds[6]);
165  virtual double *GetBounds() = 0;
167 
169  double *GetCenter();
170 
172  double *GetXRange();
173 
175  double *GetYRange();
176 
178  double *GetZRange();
179 
181  double GetLength();
182 
188  void RotateX(double);
189 
195  void RotateY(double);
196 
202  void RotateZ(double);
203 
207  void RotateWXYZ(double w, double x, double y, double z);
208 
212  void SetOrientation(double x, double y, double z);
213 
217  void SetOrientation(double orientation[3]);
218 
220 
224  double *GetOrientation();
225  void GetOrientation(double orentation[3]);
227 
229  double *GetOrientationWXYZ();
230 
234  void AddOrientation(double x, double y, double z);
235 
239  void AddOrientation(double orentation[3]);
240 
249  void PokeMatrix(vtkMatrix4x4 *matrix);
250 
253  void InitPathTraversal();
254 
256  unsigned long int GetMTime();
257 
259  unsigned long int GetUserTransformMatrixMTime();
260 
262  virtual void ComputeMatrix();
263 
265 
267  {
268  this->ComputeMatrix();
269  return this->Matrix;
270  }
272 
274 
275  vtkGetMacro(IsIdentity, int);
277 
278 protected:
279  vtkProp3D();
280  ~vtkProp3D();
281 
286  double Origin[3];
287  double Position[3];
288  double Orientation[3];
289  double Scale[3];
290  double Center[3];
292  double Bounds[6];
293  vtkProp3D *CachedProp3D; //support the PokeMatrix() method
295 private:
296  vtkProp3D(const vtkProp3D&); // Not implemented.
297  void operator=(const vtkProp3D&); // Not implemented.
298 };
299 
300 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
int IsIdentity
Definition: vtkProp3D.h:294
virtual vtkMatrix4x4 * GetMatrix()
Definition: vtkProp.h:150
void PrintSelf(ostream &os, vtkIndent indent)
vtkTransform * Transform
Definition: vtkProp3D.h:291
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:38
virtual void ShallowCopy(vtkProp *prop)
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:283
record modification and/or execution time
Definition: vtkTimeStamp.h:34
void SetScale(double s)
Definition: vtkProp3D.h:128
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:42
virtual double * GetBounds()
Definition: vtkProp.h:120
virtual void SetPosition(double x, double y, double z)
Definition: vtkProp3D.h:53
virtual unsigned long GetMTime()
a simple class to control print indentation
Definition: vtkIndent.h:38
const char * GetClassName() const
virtual void Modified()
virtual void SetOrigin(double x, double y, double z)
Definition: vtkProp3D.h:80
virtual void SetOrigin(const double pos[3])
Definition: vtkProp3D.h:96
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:71
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:282
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:293
#define VTKRENDERINGCORE_EXPORT
virtual void PokeMatrix(vtkMatrix4x4 *vtkNotUsed(matrix))
Definition: vtkProp.h:149
virtual void SetScale(double scale[3])
Definition: vtkProp3D.h:121
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:285
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:284
vtkMatrix4x4 * GetMatrix()
Definition: vtkProp3D.h:266
virtual void InitPathTraversal()
abstract superclass for linear transformations
virtual void SetScale(double x, double y, double z)
Definition: vtkProp3D.h:105