VTK  9.2.6
vtkProp3D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkProp3D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
85 #ifndef vtkProp3D_h
86 #define vtkProp3D_h
87 
88 #include "vtkNew.h" // for ivar
89 #include "vtkProp.h"
90 #include "vtkRenderingCoreModule.h" // For export macro
91 #include "vtkWeakPointer.h" // For vtkWeakPointer
92 
93 class vtkLinearTransform;
94 class vtkMatrix4x4;
95 class vtkRenderer;
96 class vtkTransform;
97 
98 class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
99 {
100 public:
101  vtkTypeMacro(vtkProp3D, vtkProp);
102  void PrintSelf(ostream& os, vtkIndent indent) override;
103 
107  void ShallowCopy(vtkProp* prop) override;
108 
110 
113  virtual void SetPosition(double x, double y, double z)
114  {
115  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
116  << y << "," << z << ")");
117  if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
118  {
119  this->Position[0] = x;
120  this->Position[1] = y;
121  this->Position[2] = z;
122  this->Modified();
123  this->IsIdentity = 0;
124  }
125  };
127 
128  virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
129  vtkGetVectorMacro(Position, double, 3);
130  void AddPosition(double deltaPosition[3]);
131  void AddPosition(double deltaX, double deltaY, double deltaZ);
132 
134 
138  virtual void SetOrigin(double x, double y, double z)
139  {
140  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
141  << y << "," << z << ")");
142  if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
143  {
144  this->Origin[0] = x;
145  this->Origin[1] = y;
146  this->Origin[2] = z;
147  this->Modified();
148  this->IsIdentity = 0;
149  }
150  };
151  virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
152  vtkGetVectorMacro(Origin, double, 3);
154 
156 
160  virtual void SetScale(double x, double y, double z)
161  {
162  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
163  << y << "," << z << ")");
164  if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
165  {
166  this->Scale[0] = x;
167  this->Scale[1] = y;
168  this->Scale[2] = z;
169  this->Modified();
170  this->IsIdentity = 0;
171  }
172  };
173  virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
174  vtkGetVectorMacro(Scale, double, 3);
176 
180  void SetScale(double s) { this->SetScale(s, s, s); }
181 
183 
196  vtkGetObjectMacro(UserTransform, vtkLinearTransform);
198 
200 
206 
208 
213  virtual void GetMatrix(vtkMatrix4x4* result);
214  virtual void GetMatrix(double result[16]);
216 
218 
222  virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
224 
230 
236 
239  void GetBounds(double bounds[6]);
240  double* GetBounds() VTK_SIZEHINT(6) override = 0;
242 
246  double* GetCenter() VTK_SIZEHINT(3);
247 
251  double* GetXRange() VTK_SIZEHINT(2);
252 
256  double* GetYRange() VTK_SIZEHINT(2);
257 
261  double* GetZRange() VTK_SIZEHINT(2);
262 
266  double GetLength();
267 
275  void RotateX(double);
276 
284  void RotateY(double);
285 
293  void RotateZ(double);
294 
301  void RotateWXYZ(double w, double x, double y, double z);
302 
308  void SetOrientation(double x, double y, double z);
309 
315  void SetOrientation(double orientation[3]);
316 
318 
324  double* GetOrientation() VTK_SIZEHINT(3);
325  void GetOrientation(double orentation[3]);
327 
331  double* GetOrientationWXYZ() VTK_SIZEHINT(4);
332 
339  void AddOrientation(double x, double y, double z);
340 
347  void AddOrientation(double orentation[3]);
348 
359  void PokeMatrix(vtkMatrix4x4* matrix) override;
360 
365  void InitPathTraversal() override;
366 
370  vtkMTimeType GetMTime() override;
371 
375  vtkMTimeType GetUserTransformMatrixMTime();
376 
378 
381  virtual void ComputeMatrix();
383 
385 
388  vtkMatrix4x4* GetMatrix() override
389  {
390  this->ComputeMatrix();
391  return this->Matrix;
392  }
394 
396 
399  vtkGetMacro(IsIdentity, int);
401 
403 
412  {
413  WORLD = 0,
414  PHYSICAL = 1,
415  DEVICE = 2
416  };
417  void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(WORLD); }
418  void SetCoordinateSystemToPhysical() { this->SetCoordinateSystem(PHYSICAL); }
419  void SetCoordinateSystemToDevice() { this->SetCoordinateSystem(DEVICE); }
421  vtkGetMacro(CoordinateSystem, CoordinateSystems);
424 
426 
433 
435 
439  vtkSetMacro(CoordinateSystemDevice, int);
440  vtkGetMacro(CoordinateSystemDevice, int);
442 
443 protected:
445  ~vtkProp3D() override;
446 
451  double Origin[3];
452  double Position[3];
453  double Orientation[3];
454  double Scale[3];
455  double Center[3];
457  double Bounds[6];
458  vtkProp3D* CachedProp3D; // support the PokeMatrix() method
460 
462  CoordinateSystems CoordinateSystem = WORLD;
465 
466 private:
467  vtkProp3D(const vtkProp3D&) = delete;
468  void operator=(const vtkProp3D&) = delete;
469 };
470 
471 #endif
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract superclass for linear transformations
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:151
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:99
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:113
virtual void GetMatrix(double result[16])
Return a reference to the Prop3D's 4x4 composite matrix.
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition: vtkProp3D.h:463
const char * GetCoordinateSystemAsString()
Specify the coordinate system that this prop is relative to.
void SetCoordinateSystem(CoordinateSystems val)
Specify the coordinate system that this prop is relative to.
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:450
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:180
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:173
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition: vtkProp3D.h:464
void AddPosition(double deltaX, double deltaY, double deltaZ)
void AddPosition(double deltaPosition[3])
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:448
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:128
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:138
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:160
~vtkProp3D() override
vtkTransform * Transform
Definition: vtkProp3D.h:456
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:417
double * GetBounds() override=0
Return a reference to the Prop3D's composite transform.
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:461
void SetUserMatrix(vtkMatrix4x4 *matrix)
The UserMatrix can be used in place of UserTransform.
int IsIdentity
Definition: vtkProp3D.h:459
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:449
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:419
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:458
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:418
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:412
void GetBounds(double bounds[6])
Return a reference to the Prop3D's composite transform.
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkProp3D.
vtkRenderer * GetCoordinateSystemRenderer()
Specify the Renderer that the prop3d is relative to when the coordinate system is set to PHYSICAL or ...
vtkMatrix4x4 * GetUserMatrix()
The UserMatrix can be used in place of UserTransform.
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:447
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:151
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:76
abstract specification for renderers
Definition: vtkRenderer.h:182
record modification and/or execution time
Definition: vtkTimeStamp.h:55
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:170
@ orientation
Definition: vtkX3D.h:268
@ scale
Definition: vtkX3D.h:235
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
#define VTK_SIZEHINT(...)