VTK  9.4.20251203
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
24#ifndef vtkProp3D_h
25#define vtkProp3D_h
26
27#include "vtkNew.h" // for ivar
28#include "vtkProp.h"
29#include "vtkRenderingCoreModule.h" // For export macro
30#include "vtkWeakPointer.h" // For vtkWeakPointer
31#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
32
33VTK_ABI_NAMESPACE_BEGIN
35class vtkMatrix4x4;
36class vtkRenderer;
37class vtkTransform;
38
39class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkProp3D : public vtkProp
40{
41public:
42 vtkTypeMacro(vtkProp3D, vtkProp);
43 void PrintSelf(ostream& os, vtkIndent indent) override;
44
48 void ShallowCopy(vtkProp* prop) override;
49
51
54 virtual void SetPosition(double x, double y, double z)
55 {
56 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
57 << y << "," << z << ")");
58 if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
59 {
60 this->Position[0] = x;
61 this->Position[1] = y;
62 this->Position[2] = z;
63 this->Modified();
64 this->IsIdentity = 0;
65 }
66 }
68
69 virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
70 vtkGetVectorMacro(Position, double, 3);
71 void AddPosition(double deltaPosition[3]);
72 void AddPosition(double deltaX, double deltaY, double deltaZ);
73
75
79 virtual void SetOrigin(double x, double y, double z)
80 {
81 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
82 << y << "," << z << ")");
83 if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
84 {
85 this->Origin[0] = x;
86 this->Origin[1] = y;
87 this->Origin[2] = z;
88 this->Modified();
89 this->IsIdentity = 0;
90 }
91 }
92 virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
93 vtkGetVectorMacro(Origin, double, 3);
95
97
101 virtual void SetScale(double x, double y, double z)
102 {
103 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
104 << y << "," << z << ")");
105 if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
106 {
107 this->Scale[0] = x;
108 this->Scale[1] = y;
109 this->Scale[2] = z;
110 this->Modified();
111 this->IsIdentity = 0;
112 }
113 }
114 virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
115 vtkGetVectorMacro(Scale, double, 3);
117
121 void SetScale(double s) { this->SetScale(s, s, s); }
122
124
137 void SetUserTransform(vtkLinearTransform* transform);
139 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
141
143
146 void SetUserMatrix(vtkMatrix4x4* matrix);
147 vtkMatrix4x4* GetUserMatrix();
149
151
156 virtual void GetMatrix(vtkMatrix4x4* result);
157 virtual void GetMatrix(double result[16]);
159
161
165 virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
167
172 virtual void SetPropertiesFromModelToWorldMatrix(vtkMatrix4x4* modelToWorld);
173
179
182 void GetBounds(double bounds[6]);
183 double* GetBounds() VTK_SIZEHINT(6) override = 0;
185
189 double* GetCenter() VTK_SIZEHINT(3);
190
194 double* GetXRange() VTK_SIZEHINT(2);
195
199 double* GetYRange() VTK_SIZEHINT(2);
200
204 double* GetZRange() VTK_SIZEHINT(2);
205
209 double GetLength();
210
218 void RotateX(double);
219
227 void RotateY(double);
228
236 void RotateZ(double);
237
244 void RotateWXYZ(double w, double x, double y, double z);
245
251 void SetOrientation(double x, double y, double z);
252
258 void SetOrientation(double orientation[3]);
259
261
267 double* GetOrientation() VTK_SIZEHINT(3);
268 void GetOrientation(double orentation[3]);
270
274 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
275
282 void AddOrientation(double x, double y, double z);
283
290 void AddOrientation(double orentation[3]);
291
302 void PokeMatrix(vtkMatrix4x4* matrix) override;
303
308 void InitPathTraversal() override;
309
313 vtkMTimeType GetMTime() override;
314
318 vtkMTimeType GetUserTransformMatrixMTime();
319
321
324 virtual void ComputeMatrix();
326
328
331 vtkMatrix4x4* GetMatrix() override
332 {
333 this->ComputeMatrix();
334 return this->Matrix;
335 }
337
339
342 vtkGetMacro(IsIdentity, vtkTypeBool);
344
346
355 {
356 WORLD = 0,
357 PHYSICAL = 1,
358 DEVICE = 2
359 };
360 void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(WORLD); }
361 void SetCoordinateSystemToPhysical() { this->SetCoordinateSystem(PHYSICAL); }
362 void SetCoordinateSystemToDevice() { this->SetCoordinateSystem(DEVICE); }
364 vtkGetMacro(CoordinateSystem, CoordinateSystems);
367
369
376
378
382 vtkSetMacro(CoordinateSystemDevice, int);
383 vtkGetMacro(CoordinateSystemDevice, int);
385
386protected:
388 ~vtkProp3D() override;
389
394 double Origin[3];
395 double Position[3];
396 double Orientation[3];
397 double Scale[3];
398 double Center[3];
400 double Bounds[6];
401 vtkProp3D* CachedProp3D; // support the PokeMatrix() method
403
405 CoordinateSystems CoordinateSystem = WORLD;
408
409private:
410 vtkProp3D(const vtkProp3D&) = delete;
411 void operator=(const vtkProp3D&) = delete;
412};
413
414VTK_ABI_NAMESPACE_END
415#endif
a simple class to control print indentation
Definition vtkIndent.h:29
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:58
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:40
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition vtkProp3D.h:54
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition vtkProp3D.h:406
void SetCoordinateSystem(CoordinateSystems val)
Specify the coordinate system that this prop is relative to.
vtkTimeStamp MatrixMTime
Definition vtkProp3D.h:393
void SetScale(double s)
Method to set the scale isotropically.
Definition vtkProp3D.h:121
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition vtkProp3D.h:114
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition vtkProp3D.h:407
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:402
void AddPosition(double deltaPosition[3])
const char * GetCoordinateSystemAsString()
Specify the coordinate system that this prop is relative to.
vtkMatrix4x4 * UserMatrix
Definition vtkProp3D.h:391
virtual void SetPosition(double pos[3])
Definition vtkProp3D.h:69
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:79
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition vtkProp3D.h:101
~vtkProp3D() override
vtkTransform * Transform
Definition vtkProp3D.h:399
void SetCoordinateSystemToWorld()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:360
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:404
vtkMatrix4x4 * Matrix
Definition vtkProp3D.h:392
void SetCoordinateSystemToDevice()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:362
vtkProp3D * CachedProp3D
Definition vtkProp3D.h:401
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:361
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:355
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkLinearTransform * UserTransform
Definition vtkProp3D.h:390
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:92
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:47
abstract specification for renderers
Definition vtkRenderer.h:63
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(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)