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=========================================================================*/
42#ifndef vtkProp3D_h
43#define vtkProp3D_h
44
45#include "vtkProp.h"
46#include "vtkRenderingCoreModule.h" // For export macro
47
48class vtkRenderer;
49class vtkTransform;
51
52class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
53{
54public:
55 vtkTypeMacro(vtkProp3D, vtkProp);
56 void PrintSelf(ostream& os, vtkIndent indent) override;
57
61 void ShallowCopy(vtkProp* prop) override;
62
64
67 virtual void SetPosition(double x, double y, double z)
68 {
69 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
70 << y << "," << z << ")");
71 if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
72 {
73 this->Position[0] = x;
74 this->Position[1] = y;
75 this->Position[2] = z;
76 this->Modified();
77 this->IsIdentity = 0;
78 }
79 };
81
82 virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
83 vtkGetVectorMacro(Position, double, 3);
84 void AddPosition(double deltaPosition[3]);
85 void AddPosition(double deltaX, double deltaY, double deltaZ);
86
88
92 virtual void SetOrigin(double x, double y, double z)
93 {
94 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
95 << y << "," << z << ")");
96 if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
97 {
98 this->Origin[0] = x;
99 this->Origin[1] = y;
100 this->Origin[2] = z;
101 this->Modified();
102 this->IsIdentity = 0;
103 }
104 };
105 virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
106 vtkGetVectorMacro(Origin, double, 3);
108
110
114 virtual void SetScale(double x, double y, double z)
115 {
116 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
117 << y << "," << z << ")");
118 if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
119 {
120 this->Scale[0] = x;
121 this->Scale[1] = y;
122 this->Scale[2] = z;
123 this->Modified();
124 this->IsIdentity = 0;
125 }
126 };
127 virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
128 vtkGetVectorMacro(Scale, double, 3);
130
134 void SetScale(double s) { this->SetScale(s, s, s); }
135
137
150 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
152
154
160
162
167 virtual void GetMatrix(vtkMatrix4x4* result);
168 virtual void GetMatrix(double result[16]);
170
176
179 void GetBounds(double bounds[6]);
180 double* GetBounds() VTK_SIZEHINT(6) override = 0;
182
186 double* GetCenter() VTK_SIZEHINT(3);
187
191 double* GetXRange() VTK_SIZEHINT(2);
192
196 double* GetYRange() VTK_SIZEHINT(2);
197
201 double* GetZRange() VTK_SIZEHINT(2);
202
206 double GetLength();
207
215 void RotateX(double);
216
224 void RotateY(double);
225
233 void RotateZ(double);
234
241 void RotateWXYZ(double w, double x, double y, double z);
242
248 void SetOrientation(double x, double y, double z);
249
255 void SetOrientation(double orientation[3]);
256
258
264 double* GetOrientation() VTK_SIZEHINT(3);
265 void GetOrientation(double orentation[3]);
267
271 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
272
279 void AddOrientation(double x, double y, double z);
280
287 void AddOrientation(double orentation[3]);
288
299 void PokeMatrix(vtkMatrix4x4* matrix) override;
300
305 void InitPathTraversal() override;
306
310 vtkMTimeType GetMTime() override;
311
315 vtkMTimeType GetUserTransformMatrixMTime();
316
320 virtual void ComputeMatrix();
321
323
326 vtkMatrix4x4* GetMatrix() override
327 {
328 this->ComputeMatrix();
329 return this->Matrix;
330 }
332
334
337 vtkGetMacro(IsIdentity, int);
339
340protected:
342 ~vtkProp3D() override;
343
348 double Origin[3];
349 double Position[3];
350 double Orientation[3];
351 double Scale[3];
352 double Center[3];
354 double Bounds[6];
355 vtkProp3D* CachedProp3D; // support the PokeMatrix() method
357
358private:
359 vtkProp3D(const vtkProp3D&) = delete;
360 void operator=(const vtkProp3D&) = delete;
361};
362
363#endif
a simple class to control print indentation
Definition: vtkIndent.h:43
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:45
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:53
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:67
virtual void GetMatrix(double result[16])
Return a reference to the Prop3D's 4x4 composite matrix.
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:347
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:134
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:127
void AddPosition(double deltaX, double deltaY, double deltaZ)
void AddPosition(double deltaPosition[3])
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:345
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:82
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:92
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:114
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
~vtkProp3D() override
vtkTransform * Transform
Definition: vtkProp3D.h:353
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:356
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:346
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:355
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:344
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:105
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:42
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:64
@ orientation
Definition: vtkX3D.h:268
@ scale
Definition: vtkX3D.h:235
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)