VTK  9.6.1
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
23
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 }
67
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
141
143
149
151
156 virtual void GetMatrix(vtkMatrix4x4* result);
157 virtual void GetMatrix(double result[16]);
159
161
165 virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
167
173
177
179
182 void GetBounds(double bounds[6]);
183 double* GetBounds() VTK_SIZEHINT(6) override = 0;
185
190
195
200
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
268 void GetOrientation(double orentation[3]);
270
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
314
319
321
324 virtual void ComputeMatrix();
326
328
332 {
333 this->ComputeMatrix();
334 return this->Matrix;
335 }
336
337
339
342 vtkGetMacro(IsIdentity, vtkTypeBool);
344
346
355 {
356 WORLD = 0,
359 };
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
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.
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition vtkProp3D.h:54
double * GetOrientation()
Returns the orientation of the Prop3D as s vector of X,Y and Z rotation.
double * GetZRange()
Get the Prop3D's z range in world coordinates.
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition vtkProp3D.h:406
void SetCoordinateSystem(CoordinateSystems val)
Specify the coordinate system that this prop is relative to.
double Scale[3]
Definition vtkProp3D.h:397
vtkTimeStamp MatrixMTime
Definition vtkProp3D.h:393
void SetOrientation(double x, double y, double z)
Sets the orientation of the Prop3D.
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:121
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition vtkProp3D.h:114
void RotateX(double)
Rotate the Prop3D in degrees about the X axis using the right hand rule.
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition vtkProp3D.h:407
double Center[3]
Definition vtkProp3D.h:398
double GetLength()
Get the length of the diagonal of the bounding box.
void AddPosition(double deltaX, double deltaY, double deltaZ)
double * GetCenter()
Get the center of the bounding box in world coordinates.
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])
double Bounds[6]
Definition vtkProp3D.h:400
void RotateWXYZ(double w, double x, double y, double z)
Rotate the Prop3D in degrees about an arbitrary axis specified by the last three arguments.
const char * GetCoordinateSystemAsString()
Specify the coordinate system that this prop is relative to.
vtkMatrix4x4 * UserMatrix
Definition vtkProp3D.h:391
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
virtual void SetPosition(double pos[3])
Definition vtkProp3D.h:69
double * GetXRange()
Get the Prop3D's x range in world coordinates.
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
void PokeMatrix(vtkMatrix4x4 *matrix) override
This method modifies the vtkProp3D so that its transformation state is set to the matrix specified.
double Orientation[3]
Definition vtkProp3D.h:396
~vtkProp3D() override
vtkTransform * Transform
Definition vtkProp3D.h:399
virtual void GetModelToWorldMatrix(vtkMatrix4x4 *result)
Return a reference to the Prop3D's Model to World matrix.
void RotateY(double)
Rotate the Prop3D in degrees about the Y axis using the right hand rule.
double * GetOrientationWXYZ()
Returns the WXYZ orientation of the Prop3D.
double * GetYRange()
Get the Prop3D's y range in world coordinates.
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
void SetUserMatrix(vtkMatrix4x4 *matrix)
The UserMatrix can be used in place of UserTransform.
CoordinateSystems CoordinateSystem
Definition vtkProp3D.h:405
double Position[3]
Definition vtkProp3D.h:395
vtkMatrix4x4 * Matrix
Definition vtkProp3D.h:392
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: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 GetBounds(double bounds[6])
Return a reference to the Prop3D's composite transform.
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
void AddOrientation(double x, double y, double z)
Add to the current orientation.
double Origin[3]
Definition vtkProp3D.h:394
vtkMTimeType GetMTime() override
Get the vtkProp3D's mtime.
vtkLinearTransform * UserTransform
Definition vtkProp3D.h:390
virtual void ComputeMatrix()
Generate the matrix based on ivars.
vtkMTimeType GetUserTransformMatrixMTime()
Get the modified time of the user matrix or user transform.
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition vtkProp3D.h:92
void InitPathTraversal() override
Overload vtkProp's method for setting up assembly paths.
virtual void SetPropertiesFromModelToWorldMatrix(vtkMatrix4x4 *modelToWorld)
Set the position, scale, orientation from a provided model to world matrix.
void RotateZ(double)
Rotate the Prop3D in degrees about the Z axis using the right hand rule.
abstract specification for renderers
Definition vtkRenderer.h:64
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:323
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)