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=========================================================================*/
45#ifndef vtkProp3D_h
46#define vtkProp3D_h
47
48#include "vtkNew.h" // for ivar
49#include "vtkProp.h"
50#include "vtkRenderingCoreModule.h" // For export macro
51#include "vtkWeakPointer.h" // For vtkWeakPointer
52
54class vtkMatrix4x4;
55class vtkRenderer;
56class vtkTransform;
57
58class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
59{
60public:
61 vtkTypeMacro(vtkProp3D, vtkProp);
62 void PrintSelf(ostream& os, vtkIndent indent) override;
63
67 void ShallowCopy(vtkProp* prop) override;
68
70
73 virtual void SetPosition(double x, double y, double z)
74 {
75 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
76 << y << "," << z << ")");
77 if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
78 {
79 this->Position[0] = x;
80 this->Position[1] = y;
81 this->Position[2] = z;
82 this->Modified();
83 this->IsIdentity = 0;
84 }
85 };
87
88 virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
89 vtkGetVectorMacro(Position, double, 3);
90 void AddPosition(double deltaPosition[3]);
91 void AddPosition(double deltaX, double deltaY, double deltaZ);
92
94
98 virtual void SetOrigin(double x, double y, double z)
99 {
100 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
101 << y << "," << z << ")");
102 if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
103 {
104 this->Origin[0] = x;
105 this->Origin[1] = y;
106 this->Origin[2] = z;
107 this->Modified();
108 this->IsIdentity = 0;
109 }
110 };
111 virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
112 vtkGetVectorMacro(Origin, double, 3);
114
116
120 virtual void SetScale(double x, double y, double z)
121 {
122 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
123 << y << "," << z << ")");
124 if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
125 {
126 this->Scale[0] = x;
127 this->Scale[1] = y;
128 this->Scale[2] = z;
129 this->Modified();
130 this->IsIdentity = 0;
131 }
132 };
133 virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
134 vtkGetVectorMacro(Scale, double, 3);
136
140 void SetScale(double s) { this->SetScale(s, s, s); }
141
143
156 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
158
160
166
168
173 virtual void GetMatrix(vtkMatrix4x4* result);
174 virtual void GetMatrix(double result[16]);
176
178
182 virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
184
190
196
199 void GetBounds(double bounds[6]);
200 double* GetBounds() VTK_SIZEHINT(6) override = 0;
202
206 double* GetCenter() VTK_SIZEHINT(3);
207
211 double* GetXRange() VTK_SIZEHINT(2);
212
216 double* GetYRange() VTK_SIZEHINT(2);
217
221 double* GetZRange() VTK_SIZEHINT(2);
222
226 double GetLength();
227
235 void RotateX(double);
236
244 void RotateY(double);
245
253 void RotateZ(double);
254
261 void RotateWXYZ(double w, double x, double y, double z);
262
268 void SetOrientation(double x, double y, double z);
269
275 void SetOrientation(double orientation[3]);
276
278
284 double* GetOrientation() VTK_SIZEHINT(3);
285 void GetOrientation(double orentation[3]);
287
291 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
292
299 void AddOrientation(double x, double y, double z);
300
307 void AddOrientation(double orentation[3]);
308
319 void PokeMatrix(vtkMatrix4x4* matrix) override;
320
325 void InitPathTraversal() override;
326
330 vtkMTimeType GetMTime() override;
331
335 vtkMTimeType GetUserTransformMatrixMTime();
336
338
341 virtual void ComputeMatrix();
343
345
348 vtkMatrix4x4* GetMatrix() override
349 {
350 this->ComputeMatrix();
351 return this->Matrix;
352 }
354
356
359 vtkGetMacro(IsIdentity, int);
361
363
372 {
373 WORLD = 0,
374 PHYSICAL = 1,
375 DEVICE = 2
376 };
377 void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(WORLD); }
378 void SetCoordinateSystemToPhysical() { this->SetCoordinateSystem(PHYSICAL); }
379 void SetCoordinateSystemToDevice() { this->SetCoordinateSystem(DEVICE); }
381 vtkGetMacro(CoordinateSystem, CoordinateSystems);
384
386
393
395
399 vtkSetMacro(CoordinateSystemDevice, int);
400 vtkGetMacro(CoordinateSystemDevice, int);
402
403protected:
405 ~vtkProp3D() override;
406
411 double Origin[3];
412 double Position[3];
413 double Orientation[3];
414 double Scale[3];
415 double Center[3];
417 double Bounds[6];
418 vtkProp3D* CachedProp3D; // support the PokeMatrix() method
420
422 CoordinateSystems CoordinateSystem = WORLD;
425
426private:
427 vtkProp3D(const vtkProp3D&) = delete;
428 void operator=(const vtkProp3D&) = delete;
429};
430
431#endif
a simple class to control print indentation
Definition vtkIndent.h:49
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:71
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:59
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition vtkProp3D.h:73
virtual void GetMatrix(double result[16])
Return a reference to the Prop3D's 4x4 composite matrix.
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition vtkProp3D.h:423
void SetCoordinateSystem(CoordinateSystems val)
Specify the coordinate system that this prop is relative to.
vtkTimeStamp MatrixMTime
Definition vtkProp3D.h:410
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:140
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition vtkProp3D.h:133
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition vtkProp3D.h:424
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:408
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
virtual void SetPosition(double pos[3])
Definition vtkProp3D.h:88
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:98
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition vtkProp3D.h:120
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
~vtkProp3D() override
vtkTransform * Transform
Definition vtkProp3D.h:416
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:377
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:421
void SetUserMatrix(vtkMatrix4x4 *matrix)
The UserMatrix can be used in place of UserTransform.
int IsIdentity
Definition vtkProp3D.h:419
vtkMatrix4x4 * Matrix
Definition vtkProp3D.h:409
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:379
vtkProp3D * CachedProp3D
Definition vtkProp3D.h:418
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:378
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:372
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:407
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:111
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:66
abstract specification for renderers
Definition vtkRenderer.h:82
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(...)