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 =========================================================================*/
36 #ifndef vtkProp3D_h
37 #define vtkProp3D_h
38 
39 #include "vtkRenderingCoreModule.h" // For export macro
40 #include "vtkProp.h"
41 
42 class vtkRenderer;
43 class vtkTransform;
44 class vtkLinearTransform;
45 
46 class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
47 {
48 public:
49  vtkTypeMacro(vtkProp3D,vtkProp);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  void ShallowCopy(vtkProp *prop) override;
56 
58 
61  virtual void SetPosition(double x, double y, double z)
62  {
63  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
64  "): setting Position to (" << x << "," << y << "," <<
65  z << ")");
66  if ((this->Position[0] != x)||
67  (this->Position[1] != y)||
68  (this->Position[2] != z))
69  {
70  this->Position[0] = x;
71  this->Position[1] = y;
72  this->Position[2] = z;
73  this->Modified();
74  this->IsIdentity = 0;
75  }
76  };
78 
79  virtual void SetPosition(double pos[3])
80  { this->SetPosition(pos[0], pos[1], pos[2]); }
81  vtkGetVectorMacro(Position, double, 3);
82  void AddPosition(double deltaPosition[3]);
83  void AddPosition(double deltaX, double deltaY, double deltaZ);
84 
86 
90  virtual void SetOrigin(double x, double y, double z)
91  {
92  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
93  "): setting Origin to (" << x << "," << y << "," <<
94  z << ")");
95  if ((this->Origin[0] != x)||
96  (this->Origin[1] != y)||
97  (this->Origin[2] != z))
98  {
99  this->Origin[0] = x;
100  this->Origin[1] = y;
101  this->Origin[2] = z;
102  this->Modified();
103  this->IsIdentity = 0;
104  }
105  };
106  virtual void SetOrigin(const double pos[3])
107  { this->SetOrigin(pos[0], pos[1], pos[2]); }
108  vtkGetVectorMacro(Origin, double, 3);
110 
112 
116  virtual void SetScale(double x, double y, double z)
117  {
118  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
119  "): setting Scale to (" << x << "," << y << "," <<
120  z << ")");
121  if (this->Scale[0] != x ||
122  this->Scale[1] != y ||
123  this->Scale[2] != z )
124  {
125  this->Scale[0] = x;
126  this->Scale[1] = y;
127  this->Scale[2] = z;
128  this->Modified();
129  this->IsIdentity = 0;
130  }
131  };
132  virtual void SetScale(double scale[3])
133  { this->SetScale(scale[0], scale[1], scale[2]); }
134  vtkGetVectorMacro(Scale, double, 3);
136 
140  void SetScale(double s)
141  { this->SetScale(s, s, s); }
142 
144 
156  void SetUserTransform(vtkLinearTransform *transform);
157  vtkGetObjectMacro(UserTransform, vtkLinearTransform);
159 
161 
164  void SetUserMatrix(vtkMatrix4x4 *matrix);
165  vtkMatrix4x4 *GetUserMatrix();
167 
169 
174  virtual void GetMatrix(vtkMatrix4x4 *m);
175  virtual void GetMatrix(double m[16]);
177 
186  void GetBounds(double bounds[6]);
187  double *GetBounds() VTK_SIZEHINT(6) override = 0;
189 
193  double *GetCenter() VTK_SIZEHINT(3);
194 
198  double *GetXRange() VTK_SIZEHINT(2);
199 
203  double *GetYRange() VTK_SIZEHINT(2);
204 
208  double *GetZRange() VTK_SIZEHINT(2);
209 
213  double GetLength();
214 
222  void RotateX(double);
223 
231  void RotateY(double);
232 
240  void RotateZ(double);
241 
248  void RotateWXYZ(double w, double x, double y, double z);
249 
255  void SetOrientation(double x, double y, double z);
256 
262  void SetOrientation(double orientation[3]);
263 
265 
271  double *GetOrientation() VTK_SIZEHINT(3);
272  void GetOrientation(double orentation[3]);
274 
278  double *GetOrientationWXYZ() VTK_SIZEHINT(4);
279 
286  void AddOrientation(double x, double y, double z);
287 
294  void AddOrientation(double orentation[3]);
295 
306  void PokeMatrix(vtkMatrix4x4 *matrix) override;
307 
312  void InitPathTraversal() override;
313 
317  vtkMTimeType GetMTime() override;
318 
322  vtkMTimeType GetUserTransformMatrixMTime();
323 
327  virtual void ComputeMatrix();
328 
330 
334  {
335  this->ComputeMatrix();
336  return this->Matrix;
337  }
339 
341 
344  vtkGetMacro(IsIdentity, int);
346 
347 protected:
348  vtkProp3D();
349  ~vtkProp3D() override;
350 
355  double Origin[3];
356  double Position[3];
357  double Orientation[3];
358  double Scale[3];
359  double Center[3];
361  double Bounds[6];
362  vtkProp3D *CachedProp3D; //support the PokeMatrix() method
364 private:
365  vtkProp3D(const vtkProp3D&) = delete;
366  void operator=(const vtkProp3D&) = delete;
367 };
368 
369 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
int IsIdentity
Definition: vtkProp3D.h:363
virtual vtkMatrix4x4 * GetMatrix()
Definition: vtkProp.h:165
vtkTransform * Transform
Definition: vtkProp3D.h:360
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:302
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:352
record modification and/or execution time
Definition: vtkTimeStamp.h:35
void SetScale(double s)
Method to set the scale isotropically.
Definition: vtkProp3D.h:140
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:46
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:132
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:61
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:39
const char * GetClassName() const
Return the class name as a string.
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:90
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:106
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:79
#define VTK_SIZEHINT(...)
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:351
vtkMatrix4x4 * GetMatrix() override
Get a pointer to an internal vtkMatrix4x4.
Definition: vtkProp3D.h:333
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:362
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:164
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:132
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:354
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:353
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:116