VTK  9.1.0
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
39class vtkRenderer;
40class vtkTransform;
42
43class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
44{
45public:
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
141 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
143
145
151
153
158 virtual void GetMatrix(vtkMatrix4x4* result);
159 virtual void GetMatrix(double result[16]);
161
167
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
331protected:
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
349private:
350 vtkProp3D(const vtkProp3D&) = delete;
351 void operator=(const vtkProp3D&) = delete;
352};
353
354#endif
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
const char * GetClassName() const
Return the class name as a string.
virtual void Modified()
Update the modification time for this object.
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:44
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:58
virtual void GetMatrix(double result[16])
Return a reference to the Prop3D's 4x4 composite matrix.
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:338
virtual void GetMatrix(vtkMatrix4x4 *result)
Return a reference to the Prop3D's 4x4 composite matrix.
void SetScale(double s)
Method to set the scale isotropically.
Definition: vtkProp3D.h:125
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:118
void AddPosition(double deltaX, double deltaY, double deltaZ)
void AddPosition(double deltaPosition[3])
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:336
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:73
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:83
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:105
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
~vtkProp3D() override
vtkTransform * Transform
Definition: vtkProp3D.h:344
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetUserMatrix(vtkMatrix4x4 *matrix)
The UserMatrix can be used in place of UserTransform.
int IsIdentity
Definition: vtkProp3D.h:347
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:337
void SetUserTransform(vtkLinearTransform *transform)
In addition to the instance variables such as position and orientation, you can add an additional tra...
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:346
void GetBounds(double bounds[6])
Return a reference to the Prop3D's composite transform.
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:335
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:96
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:57
abstract specification for renderers
Definition: vtkRenderer.h:73
record modification and/or execution time
Definition: vtkTimeStamp.h:33
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:55
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)