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 =========================================================================*/
33 #ifndef vtkProp3D_h
34 #define vtkProp3D_h
35 
36 #include "vtkRenderingCoreModule.h" // For export macro
37 #include "vtkProp.h"
38 
39 class vtkRenderer;
40 class vtkTransform;
41 class vtkLinearTransform;
42 
43 class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
44 {
45 public:
46  vtkTypeMacro(vtkProp3D,vtkProp);
47  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
48 
52  void ShallowCopy(vtkProp *prop) VTK_OVERRIDE;
53 
55 
58  virtual void SetPosition(double x, double y, double z)
59  {
60  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
61  "): setting Position to (" << x << "," << y << "," <<
62  z << ")");
63  if ((this->Position[0] != x)||
64  (this->Position[1] != y)||
65  (this->Position[2] != z))
66  {
67  this->Position[0] = x;
68  this->Position[1] = y;
69  this->Position[2] = z;
70  this->Modified();
71  this->IsIdentity = 0;
72  }
73  };
75 
76  virtual void SetPosition(double pos[3])
77  { this->SetPosition(pos[0], pos[1], pos[2]); }
78  vtkGetVectorMacro(Position, double, 3);
79  void AddPosition(double deltaPosition[3]);
80  void AddPosition(double deltaX, double deltaY, double deltaZ);
81 
83 
87  virtual void SetOrigin(double x, double y, double z)
88  {
89  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
90  "): setting Origin to (" << x << "," << y << "," <<
91  z << ")");
92  if ((this->Origin[0] != x)||
93  (this->Origin[1] != y)||
94  (this->Origin[2] != z))
95  {
96  this->Origin[0] = x;
97  this->Origin[1] = y;
98  this->Origin[2] = z;
99  this->Modified();
100  this->IsIdentity = 0;
101  }
102  };
103  virtual void SetOrigin(const double pos[3])
104  { this->SetOrigin(pos[0], pos[1], pos[2]); }
105  vtkGetVectorMacro(Origin, double, 3);
107 
109 
113  virtual void SetScale(double x, double y, double z)
114  {
115  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
116  "): setting Scale to (" << x << "," << y << "," <<
117  z << ")");
118  if (this->Scale[0] != x ||
119  this->Scale[1] != y ||
120  this->Scale[2] != z )
121  {
122  this->Scale[0] = x;
123  this->Scale[1] = y;
124  this->Scale[2] = z;
125  this->Modified();
126  this->IsIdentity = 0;
127  }
128  };
129  virtual void SetScale(double scale[3])
130  { this->SetScale(scale[0], scale[1], scale[2]); }
131  vtkGetVectorMacro(Scale, double, 3);
133 
137  void SetScale(double s)
138  { this->SetScale(s, s, s); }
139 
141 
153  void SetUserTransform(vtkLinearTransform *transform);
154  vtkGetObjectMacro(UserTransform, vtkLinearTransform);
156 
158 
161  void SetUserMatrix(vtkMatrix4x4 *matrix);
162  vtkMatrix4x4 *GetUserMatrix();
164 
166 
171  virtual void GetMatrix(vtkMatrix4x4 *m);
172  virtual void GetMatrix(double m[16]);
174 
183  void GetBounds(double bounds[6]);
184  double *GetBounds() VTK_OVERRIDE = 0;
186 
190  double *GetCenter();
191 
195  double *GetXRange();
196 
200  double *GetYRange();
201 
205  double *GetZRange();
206 
210  double GetLength();
211 
219  void RotateX(double);
220 
228  void RotateY(double);
229 
237  void RotateZ(double);
238 
245  void RotateWXYZ(double w, double x, double y, double z);
246 
252  void SetOrientation(double x, double y, double z);
253 
259  void SetOrientation(double orientation[3]);
260 
262 
268  double *GetOrientation();
269  void GetOrientation(double orentation[3]);
271 
275  double *GetOrientationWXYZ();
276 
283  void AddOrientation(double x, double y, double z);
284 
291  void AddOrientation(double orentation[3]);
292 
303  void PokeMatrix(vtkMatrix4x4 *matrix) VTK_OVERRIDE;
304 
309  void InitPathTraversal() VTK_OVERRIDE;
310 
314  vtkMTimeType GetMTime() VTK_OVERRIDE;
315 
319  vtkMTimeType GetUserTransformMatrixMTime();
320 
324  virtual void ComputeMatrix();
325 
327 
330  vtkMatrix4x4 *GetMatrix() VTK_OVERRIDE
331  {
332  this->ComputeMatrix();
333  return this->Matrix;
334  }
336 
338 
341  vtkGetMacro(IsIdentity, int);
343 
344 protected:
345  vtkProp3D();
346  ~vtkProp3D() VTK_OVERRIDE;
347 
352  double Origin[3];
353  double Position[3];
354  double Orientation[3];
355  double Scale[3];
356  double Center[3];
358  double Bounds[6];
359  vtkProp3D *CachedProp3D; //support the PokeMatrix() method
361 private:
362  vtkProp3D(const vtkProp3D&) VTK_DELETE_FUNCTION;
363  void operator=(const vtkProp3D&) VTK_DELETE_FUNCTION;
364 };
365 
366 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
int IsIdentity
Definition: vtkProp3D.h:360
virtual vtkMatrix4x4 * GetMatrix()
Definition: vtkProp.h:157
vtkTransform * Transform
Definition: vtkProp3D.h:357
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:300
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:349
record modification and/or execution time
Definition: vtkTimeStamp.h:32
void SetScale(double s)
Method to set the scale isotropically.
Definition: vtkProp3D.h:137
abstract specification for renderers
Definition: vtkRenderer.h:57
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:43
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:124
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:58
const char * GetClassName() const
Return the class name as a string.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual vtkMTimeType GetMTime()
Return this object&#39;s modified time.
virtual void Modified()
Update the modification time for this object.
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:87
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:103
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:76
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:348
vtkMatrix4x4 * GetMatrix() override
Get a pointer to an internal vtkMatrix4x4.
Definition: vtkProp3D.h:330
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:359
virtual void PokeMatrix(vtkMatrix4x4 *vtkNotUsed(matrix))
These methods are used by subclasses to place a matrix (if any) in the prop prior to rendering...
Definition: vtkProp.h:156
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:129
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:351
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:350
virtual void InitPathTraversal()
vtkProp and its subclasses can be picked by subclasses of vtkAbstractPicker (e.g., vtkPropPicker).
abstract superclass for linear transformations
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:113