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 
317  vtkMatrix4x4* GetMatrix() override
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
vtkProp::GetMatrix
virtual vtkMatrix4x4 * GetMatrix()
Definition: vtkProp.h:163
vtkProp3D::SetPosition
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:73
vtkProp3D::IsIdentity
int IsIdentity
Definition: vtkProp3D.h:347
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:43
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkObject::Modified
virtual void Modified()
Update the modification time for this object.
vtkProp3D::SetPosition
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:58
vtkProp3D::SetScale
virtual void SetScale(double scale[3])
Definition: vtkProp3D.h:118
vtkProp3D::CachedProp3D
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:346
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkProp.h
vtkLinearTransform
abstract superclass for linear transformations
Definition: vtkLinearTransform.h:31
vtkObjectBase::GetClassName
const char * GetClassName() const
Return the class name as a string.
vtkProp::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:45
vtkProp3D::Transform
vtkTransform * Transform
Definition: vtkProp3D.h:344
vtkProp3D::SetOrigin
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:83
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:35
vtkProp3D::UserMatrix
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:336
vtkProp3D::SetScale
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:105
vtkProp::GetBounds
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:132
vtkProp::ShallowCopy
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkX3D::orientation
@ orientation
Definition: vtkX3D.h:268
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:67
vtkProp3D::Matrix
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:337
vtkProp3D::SetOrigin
virtual void SetOrigin(const double pos[3])
Definition: vtkProp3D.h:96
vtkProp3D::UserTransform
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:335
vtkProp3D::MatrixMTime
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:338
vtkProp3D::SetScale
void SetScale(double s)
Method to set the scale isotropically.
Definition: vtkProp3D.h:125
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:293