VTK  9.2.6
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 "vtkNew.h" // for ivar
37#include "vtkProp.h"
38#include "vtkRenderingCoreModule.h" // For export macro
39#include "vtkWeakPointer.h" // For vtkWeakPointer
40
42class vtkMatrix4x4;
43class vtkRenderer;
44class vtkTransform;
45
46class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
47{
48public:
49 vtkTypeMacro(vtkProp3D, vtkProp);
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
55 void ShallowCopy(vtkProp* prop) override;
56
58
61 virtual void SetPosition(double x, double y, double z)
62 {
63 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
64 << y << "," << z << ")");
65 if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
66 {
67 this->Position[0] = x;
68 this->Position[1] = y;
69 this->Position[2] = z;
70 this->Modified();
71 this->IsIdentity = 0;
72 }
73 };
75
76 virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
77 vtkGetVectorMacro(Position, double, 3);
78 void AddPosition(double deltaPosition[3]);
79 void AddPosition(double deltaX, double deltaY, double deltaZ);
80
82
86 virtual void SetOrigin(double x, double y, double z)
87 {
88 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
89 << y << "," << z << ")");
90 if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
91 {
92 this->Origin[0] = x;
93 this->Origin[1] = y;
94 this->Origin[2] = z;
95 this->Modified();
96 this->IsIdentity = 0;
97 }
98 };
99 virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
100 vtkGetVectorMacro(Origin, double, 3);
102
104
108 virtual void SetScale(double x, double y, double z)
109 {
110 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
111 << y << "," << z << ")");
112 if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
113 {
114 this->Scale[0] = x;
115 this->Scale[1] = y;
116 this->Scale[2] = z;
117 this->Modified();
118 this->IsIdentity = 0;
119 }
120 };
121 virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
122 vtkGetVectorMacro(Scale, double, 3);
124
128 void SetScale(double s) { this->SetScale(s, s, s); }
129
131
144 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
146
148
154
156
161 virtual void GetMatrix(vtkMatrix4x4* result);
162 virtual void GetMatrix(double result[16]);
164
166
170 virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
172
178
184
187 void GetBounds(double bounds[6]);
188 double* GetBounds() VTK_SIZEHINT(6) override = 0;
190
194 double* GetCenter() VTK_SIZEHINT(3);
195
199 double* GetXRange() VTK_SIZEHINT(2);
200
204 double* GetYRange() VTK_SIZEHINT(2);
205
209 double* GetZRange() VTK_SIZEHINT(2);
210
214 double GetLength();
215
223 void RotateX(double);
224
232 void RotateY(double);
233
241 void RotateZ(double);
242
249 void RotateWXYZ(double w, double x, double y, double z);
250
256 void SetOrientation(double x, double y, double z);
257
263 void SetOrientation(double orientation[3]);
264
266
272 double* GetOrientation() VTK_SIZEHINT(3);
273 void GetOrientation(double orentation[3]);
275
279 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
280
287 void AddOrientation(double x, double y, double z);
288
295 void AddOrientation(double orentation[3]);
296
307 void PokeMatrix(vtkMatrix4x4* matrix) override;
308
313 void InitPathTraversal() override;
314
318 vtkMTimeType GetMTime() override;
319
323 vtkMTimeType GetUserTransformMatrixMTime();
324
326
329 virtual void ComputeMatrix();
331
333
336 vtkMatrix4x4* GetMatrix() override
337 {
338 this->ComputeMatrix();
339 return this->Matrix;
340 }
342
344
347 vtkGetMacro(IsIdentity, int);
349
351
360 {
361 WORLD = 0,
362 PHYSICAL = 1,
363 DEVICE = 2
364 };
365 void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(WORLD); }
366 void SetCoordinateSystemToPhysical() { this->SetCoordinateSystem(PHYSICAL); }
367 void SetCoordinateSystemToDevice() { this->SetCoordinateSystem(DEVICE); }
369 vtkGetMacro(CoordinateSystem, CoordinateSystems);
372
374
381
383
387 vtkSetMacro(CoordinateSystemDevice, int);
388 vtkGetMacro(CoordinateSystemDevice, int);
390
391protected:
393 ~vtkProp3D() override;
394
399 double Origin[3];
400 double Position[3];
401 double Orientation[3];
402 double Scale[3];
403 double Center[3];
405 double Bounds[6];
406 vtkProp3D* CachedProp3D; // support the PokeMatrix() method
408
410 CoordinateSystems CoordinateSystem = WORLD;
413
414private:
415 vtkProp3D(const vtkProp3D&) = delete;
416 void operator=(const vtkProp3D&) = delete;
417};
418
419#endif
a simple class to control print indentation
Definition vtkIndent.h:34
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:56
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:47
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition vtkProp3D.h:61
virtual void GetMatrix(double result[16])
Return a reference to the Prop3D's 4x4 composite matrix.
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition vtkProp3D.h:411
void SetCoordinateSystem(CoordinateSystems val)
Specify the coordinate system that this prop is relative to.
vtkTimeStamp MatrixMTime
Definition vtkProp3D.h:398
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:128
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition vtkProp3D.h:121
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition vtkProp3D.h:412
void AddPosition(double deltaX, double deltaY, double deltaZ)
vtkRenderer * GetCoordinateSystemRenderer()
Specify the Renderer that the prop3d is relative to when the coordinate system is set to PHYSICAL or ...
void AddPosition(double deltaPosition[3])
const char * GetCoordinateSystemAsString()
Specify the coordinate system that this prop is relative to.
vtkMatrix4x4 * UserMatrix
Definition vtkProp3D.h:396
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
virtual void SetPosition(double pos[3])
Definition vtkProp3D.h:76
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:86
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition vtkProp3D.h:108
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
~vtkProp3D() override
vtkTransform * Transform
Definition vtkProp3D.h:404
virtual void GetModelToWorldMatrix(vtkMatrix4x4 *result)
Return a reference to the Prop3D's Model to World matrix.
void SetCoordinateSystemToWorld()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:365
void SetCoordinateSystemRenderer(vtkRenderer *ren)
Specify the Renderer that the prop3d is relative to when the coordinate system is set to PHYSICAL or ...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int CoordinateSystemDevice
Definition vtkProp3D.h:409
void SetUserMatrix(vtkMatrix4x4 *matrix)
The UserMatrix can be used in place of UserTransform.
int IsIdentity
Definition vtkProp3D.h:407
vtkMatrix4x4 * Matrix
Definition vtkProp3D.h:397
void SetUserTransform(vtkLinearTransform *transform)
In addition to the instance variables such as position and orientation, you can add an additional tra...
void SetCoordinateSystemToDevice()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:367
vtkProp3D * CachedProp3D
Definition vtkProp3D.h:406
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:366
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:360
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:395
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:99
virtual void SetPropertiesFromModelToWorldMatrix(vtkMatrix4x4 *modelToWorld)
Set the position, scale, orientation from a provided model to world matrix.
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:51
abstract specification for renderers
Definition vtkRenderer.h:67
record modification and/or execution time
describes linear transformations via a 4x4 matrix
a weak reference to a vtkObject.
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287
#define VTK_SIZEHINT(...)