VTK  9.2.5
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=========================================================================*/
36#ifndef vtkProp3D_h
37#define vtkProp3D_h
38
39#include "vtkNew.h" // for ivar
40#include "vtkProp.h"
41#include "vtkRenderingCoreModule.h" // For export macro
42#include "vtkWeakPointer.h" // For vtkWeakPointer
43
45class vtkMatrix4x4;
46class vtkRenderer;
47class vtkTransform;
48
49class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
50{
51public:
52 vtkTypeMacro(vtkProp3D, vtkProp);
53 void PrintSelf(ostream& os, vtkIndent indent) override;
54
58 void ShallowCopy(vtkProp* prop) override;
59
61
64 virtual void SetPosition(double x, double y, double z)
65 {
66 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
67 << y << "," << z << ")");
68 if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
69 {
70 this->Position[0] = x;
71 this->Position[1] = y;
72 this->Position[2] = z;
73 this->Modified();
74 this->IsIdentity = 0;
75 }
76 };
78
79 virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
80 vtkGetVectorMacro(Position, double, 3);
81 void AddPosition(double deltaPosition[3]);
82 void AddPosition(double deltaX, double deltaY, double deltaZ);
83
85
89 virtual void SetOrigin(double x, double y, double z)
90 {
91 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
92 << y << "," << z << ")");
93 if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
94 {
95 this->Origin[0] = x;
96 this->Origin[1] = y;
97 this->Origin[2] = z;
98 this->Modified();
99 this->IsIdentity = 0;
100 }
101 };
102 virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
103 vtkGetVectorMacro(Origin, double, 3);
105
107
111 virtual void SetScale(double x, double y, double z)
112 {
113 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
114 << y << "," << z << ")");
115 if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
116 {
117 this->Scale[0] = x;
118 this->Scale[1] = y;
119 this->Scale[2] = z;
120 this->Modified();
121 this->IsIdentity = 0;
122 }
123 };
124 virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
125 vtkGetVectorMacro(Scale, double, 3);
127
131 void SetScale(double s) { this->SetScale(s, s, s); }
132
134
147 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
149
151
157
159
164 virtual void GetMatrix(vtkMatrix4x4* result);
165 virtual void GetMatrix(double result[16]);
167
169
173 virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
175
181
187
190 void GetBounds(double bounds[6]);
191 double* GetBounds() VTK_SIZEHINT(6) override = 0;
193
197 double* GetCenter() VTK_SIZEHINT(3);
198
202 double* GetXRange() VTK_SIZEHINT(2);
203
207 double* GetYRange() VTK_SIZEHINT(2);
208
212 double* GetZRange() VTK_SIZEHINT(2);
213
217 double GetLength();
218
226 void RotateX(double);
227
235 void RotateY(double);
236
244 void RotateZ(double);
245
252 void RotateWXYZ(double w, double x, double y, double z);
253
259 void SetOrientation(double x, double y, double z);
260
266 void SetOrientation(double orientation[3]);
267
269
275 double* GetOrientation() VTK_SIZEHINT(3);
276 void GetOrientation(double orentation[3]);
278
282 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
283
290 void AddOrientation(double x, double y, double z);
291
298 void AddOrientation(double orentation[3]);
299
310 void PokeMatrix(vtkMatrix4x4* matrix) override;
311
316 void InitPathTraversal() override;
317
321 vtkMTimeType GetMTime() override;
322
326 vtkMTimeType GetUserTransformMatrixMTime();
327
329
332 virtual void ComputeMatrix();
334
336
339 vtkMatrix4x4* GetMatrix() override
340 {
341 this->ComputeMatrix();
342 return this->Matrix;
343 }
345
347
350 vtkGetMacro(IsIdentity, int);
352
354
363 {
364 WORLD = 0,
365 PHYSICAL = 1,
366 DEVICE = 2
367 };
368 void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(WORLD); }
369 void SetCoordinateSystemToPhysical() { this->SetCoordinateSystem(PHYSICAL); }
370 void SetCoordinateSystemToDevice() { this->SetCoordinateSystem(DEVICE); }
372 vtkGetMacro(CoordinateSystem, CoordinateSystems);
375
377
384
386
390 vtkSetMacro(CoordinateSystemDevice, int);
391 vtkGetMacro(CoordinateSystemDevice, int);
393
394protected:
396 ~vtkProp3D() override;
397
402 double Origin[3];
403 double Position[3];
404 double Orientation[3];
405 double Scale[3];
406 double Center[3];
408 double Bounds[6];
409 vtkProp3D* CachedProp3D; // support the PokeMatrix() method
411
413 CoordinateSystems CoordinateSystem = WORLD;
416
417private:
418 vtkProp3D(const vtkProp3D&) = delete;
419 void operator=(const vtkProp3D&) = delete;
420};
421
422#endif
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
Allocate and hold a VTK object.
Definition: vtkNew.h:62
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:50
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:64
virtual void GetMatrix(double result[16])
Return a reference to the Prop3D's 4x4 composite matrix.
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition: vtkProp3D.h:414
void SetCoordinateSystem(CoordinateSystems val)
Specify the coordinate system that this prop is relative to.
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:401
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:131
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:124
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition: vtkProp3D.h:415
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:399
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:79
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:89
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:111
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
~vtkProp3D() override
vtkTransform * Transform
Definition: vtkProp3D.h:407
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:368
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:412
void SetUserMatrix(vtkMatrix4x4 *matrix)
The UserMatrix can be used in place of UserTransform.
int IsIdentity
Definition: vtkProp3D.h:410
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:400
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:370
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:409
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:369
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:363
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:398
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:102
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:57
abstract specification for renderers
Definition: vtkRenderer.h:73
record modification and/or execution time
Definition: vtkTimeStamp.h:36
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
a weak reference to a vtkObject.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)