VTK  9.7.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
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 
33 VTK_ABI_NAMESPACE_BEGIN
34 class vtkLinearTransform;
35 class vtkMatrix4x4;
36 class vtkRenderer;
37 class vtkTransform;
38 
39 class VTKRENDERINGCORE_EXPORT VTK_MARSHALAUTO vtkProp3D : public vtkProp
40 {
41 public:
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 
178 
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); }
363  void SetCoordinateSystem(CoordinateSystems val);
364  vtkGetMacro(CoordinateSystem, CoordinateSystems);
365  const char* GetCoordinateSystemAsString();
367 
369 
373  void SetCoordinateSystemRenderer(vtkRenderer* ren);
374  vtkRenderer* GetCoordinateSystemRenderer();
376 
378 
382  vtkSetMacro(CoordinateSystemDevice, int);
383  vtkGetMacro(CoordinateSystemDevice, int);
385 
386 protected:
387  vtkProp3D();
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 
409 private:
410  vtkProp3D(const vtkProp3D&) = delete;
411  void operator=(const vtkProp3D&) = delete;
412 };
413 
414 VTK_ABI_NAMESPACE_END
415 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
void GetBounds(T a, double bds[6])
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:354
vtkTransform * Transform
Definition: vtkProp3D.h:399
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
void SetCoordinateSystemToWorld()
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:360
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:391
record modification and/or execution time
Definition: vtkTimeStamp.h:24
void SetScale(double s)
Method to set the scale isotropically.
Definition: vtkProp3D.h:121
abstract specification for renderers
Definition: vtkRenderer.h:63
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:50
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:39
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition: vtkProp3D.h:406
int vtkTypeBool
Definition: vtkABI.h:64
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:54
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeBool IsIdentity
Definition: vtkProp3D.h:402
a simple class to control print indentation
Definition: vtkIndent.h:28
const char * GetClassName() const
Return the class name as a string.
virtual void Modified()
Update the modification time for this object.
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:79
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:92
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:69
#define VTK_SIZEHINT(...)
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:361
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:390
#define VTK_MARSHALEXCLUDE(reason)
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:401
int CoordinateSystemDevice
Definition: vtkProp3D.h:404
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:114
#define VTK_MARSHALAUTO
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:393
void SetCoordinateSystemToDevice()
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:362
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition: vtkProp3D.h:407
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:392
abstract superclass for linear transformations
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:101
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL