VTK  9.3.0
vtkProp3D.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
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
41VTK_ABI_NAMESPACE_BEGIN
43class vtkMatrix4x4;
44class vtkRenderer;
45class vtkTransform;
46
47class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
48{
49public:
50 vtkTypeMacro(vtkProp3D, vtkProp);
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
56 void ShallowCopy(vtkProp* prop) override;
57
59
62 virtual void SetPosition(double x, double y, double z)
63 {
64 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
65 << y << "," << z << ")");
66 if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
67 {
68 this->Position[0] = x;
69 this->Position[1] = y;
70 this->Position[2] = z;
71 this->Modified();
72 this->IsIdentity = 0;
73 }
74 };
76
77 virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
78 vtkGetVectorMacro(Position, double, 3);
79 void AddPosition(double deltaPosition[3]);
80 void AddPosition(double deltaX, double deltaY, double deltaZ);
81
83
87 virtual void SetOrigin(double x, double y, double z)
88 {
89 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
90 << y << "," << z << ")");
91 if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
92 {
93 this->Origin[0] = x;
94 this->Origin[1] = y;
95 this->Origin[2] = z;
96 this->Modified();
97 this->IsIdentity = 0;
98 }
99 };
100 virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
101 vtkGetVectorMacro(Origin, double, 3);
103
105
109 virtual void SetScale(double x, double y, double z)
110 {
111 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
112 << y << "," << z << ")");
113 if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
114 {
115 this->Scale[0] = x;
116 this->Scale[1] = y;
117 this->Scale[2] = z;
118 this->Modified();
119 this->IsIdentity = 0;
120 }
121 };
122 virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
123 vtkGetVectorMacro(Scale, double, 3);
125
129 void SetScale(double s) { this->SetScale(s, s, s); }
130
132
145 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
147
149
155
157
162 virtual void GetMatrix(vtkMatrix4x4* result);
163 virtual void GetMatrix(double result[16]);
165
167
171 virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
173
179
185
188 void GetBounds(double bounds[6]);
189 double* GetBounds() VTK_SIZEHINT(6) override = 0;
191
195 double* GetCenter() VTK_SIZEHINT(3);
196
200 double* GetXRange() VTK_SIZEHINT(2);
201
205 double* GetYRange() VTK_SIZEHINT(2);
206
210 double* GetZRange() VTK_SIZEHINT(2);
211
215 double GetLength();
216
224 void RotateX(double);
225
233 void RotateY(double);
234
242 void RotateZ(double);
243
250 void RotateWXYZ(double w, double x, double y, double z);
251
257 void SetOrientation(double x, double y, double z);
258
264 void SetOrientation(double orientation[3]);
265
267
273 double* GetOrientation() VTK_SIZEHINT(3);
274 void GetOrientation(double orentation[3]);
276
280 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
281
288 void AddOrientation(double x, double y, double z);
289
296 void AddOrientation(double orentation[3]);
297
308 void PokeMatrix(vtkMatrix4x4* matrix) override;
309
314 void InitPathTraversal() override;
315
319 vtkMTimeType GetMTime() override;
320
324 vtkMTimeType GetUserTransformMatrixMTime();
325
327
330 virtual void ComputeMatrix();
332
334
337 vtkMatrix4x4* GetMatrix() override
338 {
339 this->ComputeMatrix();
340 return this->Matrix;
341 }
343
345
348 vtkGetMacro(IsIdentity, vtkTypeBool);
350
352
361 {
362 WORLD = 0,
363 PHYSICAL = 1,
364 DEVICE = 2
365 };
366 void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(WORLD); }
367 void SetCoordinateSystemToPhysical() { this->SetCoordinateSystem(PHYSICAL); }
368 void SetCoordinateSystemToDevice() { this->SetCoordinateSystem(DEVICE); }
370 vtkGetMacro(CoordinateSystem, CoordinateSystems);
373
375
382
384
388 vtkSetMacro(CoordinateSystemDevice, int);
389 vtkGetMacro(CoordinateSystemDevice, int);
391
392protected:
394 ~vtkProp3D() override;
395
400 double Origin[3];
401 double Position[3];
402 double Orientation[3];
403 double Scale[3];
404 double Center[3];
406 double Bounds[6];
407 vtkProp3D* CachedProp3D; // support the PokeMatrix() method
409
411 CoordinateSystems CoordinateSystem = WORLD;
414
415private:
416 vtkProp3D(const vtkProp3D&) = delete;
417 void operator=(const vtkProp3D&) = delete;
418};
419
420VTK_ABI_NAMESPACE_END
421#endif
a simple class to control print indentation
Definition vtkIndent.h:38
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:60
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:48
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition vtkProp3D.h:62
virtual void GetMatrix(double result[16])
Return a reference to the Prop3D's 4x4 composite matrix.
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition vtkProp3D.h:412
void SetCoordinateSystem(CoordinateSystems val)
Specify the coordinate system that this prop is relative to.
vtkTimeStamp MatrixMTime
Definition vtkProp3D.h:399
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:129
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition vtkProp3D.h:122
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition vtkProp3D.h:413
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 ...
vtkTypeBool IsIdentity
Definition vtkProp3D.h:408
void AddPosition(double deltaPosition[3])
const char * GetCoordinateSystemAsString()
Specify the coordinate system that this prop is relative to.
vtkMatrix4x4 * UserMatrix
Definition vtkProp3D.h:397
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
virtual void SetPosition(double pos[3])
Definition vtkProp3D.h:77
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:87
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition vtkProp3D.h:109
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
~vtkProp3D() override
vtkTransform * Transform
Definition vtkProp3D.h:405
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:366
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:410
void SetUserMatrix(vtkMatrix4x4 *matrix)
The UserMatrix can be used in place of UserTransform.
vtkMatrix4x4 * Matrix
Definition vtkProp3D.h:398
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:368
vtkProp3D * CachedProp3D
Definition vtkProp3D.h:407
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:367
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:361
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:396
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:100
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:52
abstract specification for renderers
Definition vtkRenderer.h:68
record modification and/or execution time
describes linear transformations via a 4x4 matrix
a weak reference to a vtkObject.
int vtkTypeBool
Definition vtkABI.h:64
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270
#define VTK_SIZEHINT(...)