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 =========================================================================*/
36 #ifndef vtkProp3D_h
37 #define vtkProp3D_h
38 
39 #include "vtkNew.h" // for ivar
40 #include "vtkProp.h"
41 #include "vtkRenderingCoreModule.h" // For export macro
42 #include "vtkWeakPointer.h" // For vtkWeakPointer
43 
44 class vtkLinearTransform;
45 class vtkMatrix4x4;
46 class vtkRenderer;
47 class vtkTransform;
48 
49 class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
50 {
51 public:
52  vtkTypeMacro(vtkProp3D, vtkProp);
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
58  void ShallowCopy(vtkProp* prop) override;
59 
61 
64  virtual void SetPosition(double x, double y, double z)
65  {
66  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Position to (" << x << ","
67  << y << "," << z << ")");
68  if ((this->Position[0] != x) || (this->Position[1] != y) || (this->Position[2] != z))
69  {
70  this->Position[0] = x;
71  this->Position[1] = y;
72  this->Position[2] = z;
73  this->Modified();
74  this->IsIdentity = 0;
75  }
76  };
78 
79  virtual void SetPosition(double pos[3]) { this->SetPosition(pos[0], pos[1], pos[2]); }
80  vtkGetVectorMacro(Position, double, 3);
81  void AddPosition(double deltaPosition[3]);
82  void AddPosition(double deltaX, double deltaY, double deltaZ);
83 
85 
89  virtual void SetOrigin(double x, double y, double z)
90  {
91  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Origin to (" << x << ","
92  << y << "," << z << ")");
93  if ((this->Origin[0] != x) || (this->Origin[1] != y) || (this->Origin[2] != z))
94  {
95  this->Origin[0] = x;
96  this->Origin[1] = y;
97  this->Origin[2] = z;
98  this->Modified();
99  this->IsIdentity = 0;
100  }
101  };
102  virtual void SetOrigin(const double pos[3]) { this->SetOrigin(pos[0], pos[1], pos[2]); }
103  vtkGetVectorMacro(Origin, double, 3);
105 
107 
111  virtual void SetScale(double x, double y, double z)
112  {
113  vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Scale to (" << x << ","
114  << y << "," << z << ")");
115  if (this->Scale[0] != x || this->Scale[1] != y || this->Scale[2] != z)
116  {
117  this->Scale[0] = x;
118  this->Scale[1] = y;
119  this->Scale[2] = z;
120  this->Modified();
121  this->IsIdentity = 0;
122  }
123  };
124  virtual void SetScale(double scale[3]) { this->SetScale(scale[0], scale[1], scale[2]); }
125  vtkGetVectorMacro(Scale, double, 3);
127 
131  void SetScale(double s) { this->SetScale(s, s, s); }
132 
134 
146  void SetUserTransform(vtkLinearTransform* transform);
147  vtkGetObjectMacro(UserTransform, vtkLinearTransform);
149 
151 
154  void SetUserMatrix(vtkMatrix4x4* matrix);
155  vtkMatrix4x4* GetUserMatrix();
157 
159 
164  virtual void GetMatrix(vtkMatrix4x4* result);
165  virtual void GetMatrix(double result[16]);
167 
169 
173  virtual void GetModelToWorldMatrix(vtkMatrix4x4* result);
175 
180  virtual void SetPropertiesFromModelToWorldMatrix(vtkMatrix4x4* modelToWorld);
181 
186 
190  void GetBounds(double bounds[6]);
191  double* GetBounds() VTK_SIZEHINT(6) override = 0;
193 
197  double* GetCenter() VTK_SIZEHINT(3);
198 
202  double* GetXRange() VTK_SIZEHINT(2);
203 
207  double* GetYRange() VTK_SIZEHINT(2);
208 
212  double* GetZRange() VTK_SIZEHINT(2);
213 
217  double GetLength();
218 
226  void RotateX(double);
227 
235  void RotateY(double);
236 
244  void RotateZ(double);
245 
252  void RotateWXYZ(double w, double x, double y, double z);
253 
259  void SetOrientation(double x, double y, double z);
260 
266  void SetOrientation(double orientation[3]);
267 
269 
275  double* GetOrientation() VTK_SIZEHINT(3);
276  void GetOrientation(double orentation[3]);
278 
282  double* GetOrientationWXYZ() VTK_SIZEHINT(4);
283 
290  void AddOrientation(double x, double y, double z);
291 
298  void AddOrientation(double orentation[3]);
299 
310  void PokeMatrix(vtkMatrix4x4* matrix) override;
311 
316  void InitPathTraversal() override;
317 
321  vtkMTimeType GetMTime() override;
322 
326  vtkMTimeType GetUserTransformMatrixMTime();
327 
329 
332  virtual void ComputeMatrix();
334 
336 
339  vtkMatrix4x4* GetMatrix() override
340  {
341  this->ComputeMatrix();
342  return this->Matrix;
343  }
345 
347 
350  vtkGetMacro(IsIdentity, int);
352 
354 
363  {
364  WORLD = 0,
365  PHYSICAL = 1,
366  DEVICE = 2
367  };
368  void SetCoordinateSystemToWorld() { this->SetCoordinateSystem(WORLD); }
369  void SetCoordinateSystemToPhysical() { this->SetCoordinateSystem(PHYSICAL); }
370  void SetCoordinateSystemToDevice() { this->SetCoordinateSystem(DEVICE); }
371  void SetCoordinateSystem(CoordinateSystems val);
372  vtkGetMacro(CoordinateSystem, CoordinateSystems);
373  const char* GetCoordinateSystemAsString();
375 
377 
381  void SetCoordinateSystemRenderer(vtkRenderer* ren);
382  vtkRenderer* GetCoordinateSystemRenderer();
384 
386 
390  vtkSetMacro(CoordinateSystemDevice, int);
391  vtkGetMacro(CoordinateSystemDevice, int);
393 
394 protected:
395  vtkProp3D();
396  ~vtkProp3D() override;
397 
402  double Origin[3];
403  double Position[3];
404  double Orientation[3];
405  double Scale[3];
406  double Center[3];
408  double Bounds[6];
409  vtkProp3D* CachedProp3D; // support the PokeMatrix() method
411 
413  CoordinateSystems CoordinateSystem = WORLD;
416 
417 private:
418  vtkProp3D(const vtkProp3D&) = delete;
419  void operator=(const vtkProp3D&) = delete;
420 };
421 
422 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
int IsIdentity
Definition: vtkProp3D.h:410
virtual vtkMatrix4x4 * GetMatrix()
Definition: vtkProp.h:166
CoordinateSystems
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:362
vtkTransform * Transform
Definition: vtkProp3D.h:407
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:287
void SetCoordinateSystemToWorld()
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:368
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:399
record modification and/or execution time
Definition: vtkTimeStamp.h:35
void SetScale(double s)
Method to set the scale isotropically.
Definition: vtkProp3D.h:131
abstract specification for renderers
Definition: vtkRenderer.h:72
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:60
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:49
vtkWeakPointer< vtkRenderer > CoordinateSystemRenderer
Definition: vtkProp3D.h:414
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:135
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:64
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
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:89
virtual void SetOrigin(const double pos[3])
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:102
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:79
#define VTK_SIZEHINT(...)
void SetCoordinateSystemToPhysical()
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:369
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:398
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:409
int CoordinateSystemDevice
Definition: vtkProp3D.h:412
virtual void SetScale(double scale[3])
Set/Get the scale of the actor.
Definition: vtkProp3D.h:124
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:401
void SetCoordinateSystemToDevice()
Specify the coordinate system that this prop is relative to.
Definition: vtkProp3D.h:370
vtkNew< vtkMatrix4x4 > TempMatrix4x4
Definition: vtkProp3D.h:415
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:400
abstract superclass for linear transformations
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:111