VTK  9.3.20240425
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
73#ifndef vtkProp3D_h
74#define vtkProp3D_h
75
76#include "vtkNew.h" // for ivar
77#include "vtkProp.h"
78#include "vtkRenderingCoreModule.h" // For export macro
79#include "vtkWeakPointer.h" // For vtkWeakPointer
80#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
81
82VTK_ABI_NAMESPACE_BEGIN
84class vtkMatrix4x4;
85class vtkRenderer;
86class vtkTransform;
87
88class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkProp3D : public vtkProp
89{
90public:
91 vtkTypeMacro(vtkProp3D, vtkProp);
92 void PrintSelf(ostream& os, vtkIndent indent) override;
93
97 void ShallowCopy(vtkProp* prop) override;
98
100
103 virtual void SetPosition(double x, double y, double z)
104 {
105 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
106 << y << "," << z << ")");
107 if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
108 {
109 this->Position[0] = x;
110 this->Position[1] = y;
111 this->Position[2] = z;
112 this->Modified();
113 this->IsIdentity = 0;
114 }
115 }
117
118 virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
119 vtkGetVectorMacro(Position, double, 3);
120 void AddPosition(double deltaPosition[3]);
121 void AddPosition(double deltaX, double deltaY, double deltaZ);
122
124
128 virtual void SetOrigin(double x, double y, double z)
129 {
130 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
131 << y << "," << z << ")");
132 if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
133 {
134 this->Origin[0] = x;
135 this->Origin[1] = y;
136 this->Origin[2] = z;
137 this->Modified();
138 this->IsIdentity = 0;
139 }
140 }
141 virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
142 vtkGetVectorMacro(Origin, double, 3);
144
146
150 virtual void SetScale(double x, double y, double z)
151 {
152 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
153 << y << "," << z << ")");
154 if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
155 {
156 this->Scale[0] = x;
157 this->Scale[1] = y;
158 this->Scale[2] = z;
159 this->Modified();
160 this->IsIdentity = 0;
161 }
162 }
163 virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
164 vtkGetVectorMacro(Scale, double, 3);
166
170 void SetScale(double s) { this->SetScale(s, s, s); }
171
173
186 void SetUserTransform(vtkLinearTransform* transform);
188 vtkGetObjectMacro(UserTransform, vtkLinearTransform);
190
192
195 void SetUserMatrix(vtkMatrix4x4* matrix);
196 vtkMatrix4x4* GetUserMatrix();
198
200
205 virtual void GetMatrix(vtkMatrix4x4* result);
206 virtual void GetMatrix(double result[16]);
208
210
214 virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
216
221 virtual void SetPropertiesFromModelToWorldMatrix(vtkMatrix4x4* modelToWorld);
222
228
231 void GetBounds(double bounds[6]);
232 double* GetBounds() VTK_SIZEHINT(6) override = 0;
234
238 double* GetCenter() VTK_SIZEHINT(3);
239
243 double* GetXRange() VTK_SIZEHINT(2);
244
248 double* GetYRange() VTK_SIZEHINT(2);
249
253 double* GetZRange() VTK_SIZEHINT(2);
254
258 double GetLength();
259
267 void RotateX(double);
268
276 void RotateY(double);
277
285 void RotateZ(double);
286
293 void RotateWXYZ(double w, double x, double y, double z);
294
300 void SetOrientation(double x, double y, double z);
301
307 void SetOrientation(double orientation[3]);
308
310
316 double* GetOrientation() VTK_SIZEHINT(3);
317 void GetOrientation(double orentation[3]);
319
323 double* GetOrientationWXYZ() VTK_SIZEHINT(4);
324
331 void AddOrientation(double x, double y, double z);
332
339 void AddOrientation(double orentation[3]);
340
351 void PokeMatrix(vtkMatrix4x4* matrix) override;
352
357 void InitPathTraversal() override;
358
362 vtkMTimeType GetMTime() override;
363
367 vtkMTimeType GetUserTransformMatrixMTime();
368
370
373 virtual void ComputeMatrix();
375
377
380 vtkMatrix4x4* GetMatrix() override
381 {
382 this->ComputeMatrix();
383 return this->Matrix;
384 }
386
388
391 vtkGetMacro(IsIdentity, vtkTypeBool);
393
395
404 {
405 WORLD = 0,
406 PHYSICAL = 1,
407 DEVICE = 2
408 };
409 void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(WORLD); }
410 void SetCoordinateSystemToPhysical() { this->SetCoordinateSystem(PHYSICAL); }
411 void SetCoordinateSystemToDevice() { this->SetCoordinateSystem(DEVICE); }
413 vtkGetMacro(CoordinateSystem, CoordinateSystems);
416
418
425
427
431 vtkSetMacro(CoordinateSystemDevice, int);
432 vtkGetMacro(CoordinateSystemDevice, int);
434
435protected:
437 ~vtkProp3D() override;
438
443 double Origin[3];
444 double Position[3];
445 double Orientation[3];
446 double Scale[3];
447 double Center[3];
449 double Bounds[6];
450 vtkProp3D* CachedProp3D; // support the PokeMatrix() method
452
454 CoordinateSystems CoordinateSystem = WORLD;
457
458private:
459 vtkProp3D(const vtkProp3D&) = delete;
460 void operator=(const vtkProp3D&) = delete;
461};
462
463VTK_ABI_NAMESPACE_END
464#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:160
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:89
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition vtkProp3D.h:103
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition vtkProp3D.h:455
void SetCoordinateSystem(CoordinateSystems val)
Specify the coordinate system that this prop is relative to.
vtkTimeStamp MatrixMTime
Definition vtkProp3D.h:442
void SetScale(double s)
Method to set the scale isotropically.
Definition vtkProp3D.h:170
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition vtkProp3D.h:163
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition vtkProp3D.h:456
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:451
void AddPosition(double deltaPosition[3])
const char * GetCoordinateSystemAsString()
Specify the coordinate system that this prop is relative to.
vtkMatrix4x4 * UserMatrix
Definition vtkProp3D.h:440
virtual void SetPosition(double pos[3])
Definition vtkProp3D.h:118
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:128
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition vtkProp3D.h:150
~vtkProp3D() override
vtkTransform * Transform
Definition vtkProp3D.h:448
void SetCoordinateSystemToWorld()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:409
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:453
vtkMatrix4x4 * Matrix
Definition vtkProp3D.h:441
void SetCoordinateSystemToDevice()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:411
vtkProp3D * CachedProp3D
Definition vtkProp3D.h:450
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:410
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition vtkProp3D.h:404
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkLinearTransform * UserTransform
Definition vtkProp3D.h:439
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:141
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
abstract specification for renderers
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)