VTK  9.0.1
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 "vtkProp.h"
37 #include "vtkRenderingCoreModule.h" // For export macro
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) override;
48 
52  void ShallowCopy(vtkProp* prop) override;
53 
55 
58  virtual void SetPosition(double x, double y, double z)
59  {
60  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
61  << y << "," << z << ")");
62  if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
63  {
64  this->Position[0] = x;
65  this->Position[1] = y;
66  this->Position[2] = z;
67  this->Modified();
68  this->IsIdentity = 0;
69  }
70  };
72 
73  virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
74  vtkGetVectorMacro(Position, double, 3);
75  void AddPosition(double deltaPosition[3]);
76  void AddPosition(double deltaX, double deltaY, double deltaZ);
77 
79 
83  virtual void SetOrigin(double x, double y, double z)
84  {
85  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
86  << y << "," << z << ")");
87  if ((this->Origin[0] != x) || (this->Origin[1] != y) || (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]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
97  vtkGetVectorMacro(Origin, double, 3);
99 
101 
105  virtual void SetScale(double x, double y, double z)
106  {
107  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
108  << y << "," << z << ")");
109  if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
110  {
111  this->Scale[0] = x;
112  this->Scale[1] = y;
113  this->Scale[2] = z;
114  this->Modified();
115  this->IsIdentity = 0;
116  }
117  };
118  virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
119  vtkGetVectorMacro(Scale, double, 3);
121 
125  void SetScale(double s) { this->SetScale(s, s, s); }
126 
128 
140  void SetUserTransform(vtkLinearTransform* transform);
141  vtkGetObjectMacro(UserTransform, vtkLinearTransform);
143 
145 
148  void SetUserMatrix(vtkMatrix4x4* matrix);
149  vtkMatrix4x4* GetUserMatrix();
151 
153 
158  virtual void GetMatrix(vtkMatrix4x4* m);
159  virtual void GetMatrix(double m[16]);
161 
170  void GetBounds(double bounds[6]);
171  double* GetBounds() VTK_SIZEHINT(6) override = 0;
173 
177  double* GetCenter() VTK_SIZEHINT(3);
178 
182  double* GetXRange() VTK_SIZEHINT(2);
183 
187  double* GetYRange() VTK_SIZEHINT(2);
188 
192  double* GetZRange() VTK_SIZEHINT(2);
193 
197  double GetLength();
198 
206  void RotateX(double);
207 
215  void RotateY(double);
216 
224  void RotateZ(double);
225 
232  void RotateWXYZ(double w, double x, double y, double z);
233 
239  void SetOrientation(double x, double y, double z);
240 
246  void SetOrientation(double orientation[3]);
247 
249 
255  double* GetOrientation() VTK_SIZEHINT(3);
256  void GetOrientation(double orentation[3]);
258 
262  double* GetOrientationWXYZ() VTK_SIZEHINT(4);
263 
270  void AddOrientation(double x, double y, double z);
271 
278  void AddOrientation(double orentation[3]);
279 
290  void PokeMatrix(vtkMatrix4x4* matrix) override;
291 
296  void InitPathTraversal() override;
297 
301  vtkMTimeType GetMTime() override;
302 
306  vtkMTimeType GetUserTransformMatrixMTime();
307 
311  virtual void ComputeMatrix();
312 
314 
318  {
319  this->ComputeMatrix();
320  return this->Matrix;
321  }
323 
325 
328  vtkGetMacro(IsIdentity, int);
330 
331 protected:
332  vtkProp3D();
333  ~vtkProp3D() override;
334 
339  double Origin[3];
340  double Position[3];
341  double Orientation[3];
342  double Scale[3];
343  double Center[3];
345  double Bounds[6];
346  vtkProp3D* CachedProp3D; // support the PokeMatrix() method
348 
349 private:
350  vtkProp3D(const vtkProp3D&) = delete;
351  void operator=(const vtkProp3D&) = delete;
352 };
353 
354 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:47
int IsIdentity
Definition: vtkProp3D.h:347
virtual vtkMatrix4x4 * GetMatrix()
Definition: vtkProp.h:157
vtkTransform * Transform
Definition: vtkProp3D.h:344
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:293
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:336
record modification and/or execution time
Definition: vtkTimeStamp.h:32
void SetScale(double s)
Method to set the scale isotropically.
Definition: vtkProp3D.h:125
abstract specification for renderers
Definition: vtkRenderer.h:58
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:126
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:83
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:96
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:73
#define VTK_SIZEHINT(...)
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:335
vtkMatrix4x4 * GetMatrix() override
Get a pointer to an internal vtkMatrix4x4.
Definition: vtkProp3D.h:317
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:346
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:118
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:338
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:337
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:105