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=========================================================================*/
82#ifndef vtkProp3D_h
83#define vtkProp3D_h
84
85#include "vtkProp.h"
86#include "vtkRenderingCoreModule.h" // For export macro
87
88class vtkRenderer;
89class vtkTransform;
91
92class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
93{
94public:
95 vtkTypeMacro(vtkProp3D, vtkProp);
96 void PrintSelf(ostream& os, vtkIndent indent) override;
97
101 void ShallowCopy(vtkProp* prop) override;
102
104
107 virtual void SetPosition(double x, double y, double z)
108 {
109 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
110 << y << "," << z << ")");
111 if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
112 {
113 this->Position[0] = x;
114 this->Position[1] = y;
115 this->Position[2] = z;
116 this->Modified();
117 this->IsIdentity = 0;
118 }
119 };
121
122 virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
123 vtkGetVectorMacro(Position, double, 3);
124 void AddPosition(double deltaPosition[3]);
125 void AddPosition(double deltaX, double deltaY, double deltaZ);
126
128
132 virtual void SetOrigin(double x, double y, double z)
133 {
134 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
135 << y << "," << z << ")");
136 if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
137 {
138 this->Origin[0] = x;
139 this->Origin[1] = y;
140 this->Origin[2] = z;
141 this->Modified();
142 this->IsIdentity = 0;
143 }
144 };
145 virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
146 vtkGetVectorMacro(Origin, double, 3);
148
150
154 virtual void SetScale(double x, double y, double z)
155 {
156 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
157 << y << "," << z << ")");
158 if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
159 {
160 this->Scale[0] = x;
161 this->Scale[1] = y;
162 this->Scale[2] = z;
163 this->Modified();
164 this->IsIdentity = 0;
165 }
166 };
167 virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
168 vtkGetVectorMacro(Scale, double, 3);
170
174 void SetScale(double s) { this->SetScale(s, s, s); }
175
177
190 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
192
194
200
202
207 virtual void GetMatrix(vtkMatrix4x4* result);
208 virtual void GetMatrix(double result[16]);
210
216
219 void GetBounds(double bounds[6]);
220 double* GetBounds() VTK_SIZEHINT(6) override = 0;
222
226 double* GetCenter() VTK_SIZEHINT(3);
227
231 double* GetXRange() VTK_SIZEHINT(2);
232
236 double* GetYRange() VTK_SIZEHINT(2);
237
241 double* GetZRange() VTK_SIZEHINT(2);
242
246 double GetLength();
247
255 void RotateX(double);
256
264 void RotateY(double);
265
273 void RotateZ(double);
274
281 void RotateWXYZ(double w, double x, double y, double z);
282
288 void SetOrientation(double x, double y, double z);
289
295 void SetOrientation(double orientation[3]);
296
298
304 double* GetOrientation() VTK_SIZEHINT(3);
305 void GetOrientation(double orentation[3]);
307
311 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
312
319 void AddOrientation(double x, double y, double z);
320
327 void AddOrientation(double orentation[3]);
328
339 void PokeMatrix(vtkMatrix4x4* matrix) override;
340
345 void InitPathTraversal() override;
346
350 vtkMTimeType GetMTime() override;
351
355 vtkMTimeType GetUserTransformMatrixMTime();
356
360 virtual void ComputeMatrix();
361
363
366 vtkMatrix4x4* GetMatrix() override
367 {
368 this->ComputeMatrix();
369 return this->Matrix;
370 }
372
374
377 vtkGetMacro(IsIdentity, int);
379
380protected:
382 ~vtkProp3D() override;
383
388 double Origin[3];
389 double Position[3];
390 double Orientation[3];
391 double Scale[3];
392 double Center[3];
394 double Bounds[6];
395 vtkProp3D* CachedProp3D; // support the PokeMatrix() method
397
398private:
399 vtkProp3D(const vtkProp3D&) = delete;
400 void operator=(const vtkProp3D&) = delete;
401};
402
403#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:145
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:93
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:107
virtual void GetMatrix(double result[16])
Return a reference to the Prop3D's 4x4 composite matrix.
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:387
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:174
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:167
void AddPosition(double deltaX, double deltaY, double deltaZ)
void AddPosition(double deltaPosition[3])
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:385
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:122
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:132
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:154
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
~vtkProp3D() override
vtkTransform * Transform
Definition: vtkProp3D.h:393
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:396
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:386
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:395
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:384
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:145
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
abstract specification for renderers
Definition: vtkRenderer.h:182
record modification and/or execution time
Definition: vtkTimeStamp.h:52
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:164
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)