VTK
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 "vtkRenderingCoreModule.h" // For export macro
40 #include "vtkProp.h"
41 
42 class vtkRenderer;
43 class vtkTransform;
44 class vtkLinearTransform;
45 
46 class VTKRENDERINGCORE_EXPORT vtkProp3D : public vtkProp
47 {
48 public:
49  vtkTypeMacro(vtkProp3D,vtkProp);
50  void PrintSelf(ostream& os, vtkIndent indent);
51 
55  void ShallowCopy(vtkProp *prop);
56 
58 
61  virtual void SetPosition(double x, double y, double z)
62  {
63  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
64  "): setting Position to (" << x << "," << y << "," <<
65  z << ")");
66  if ((this->Position[0] != x)||
67  (this->Position[1] != y)||
68  (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])
80  { this->SetPosition(pos[0], pos[1], pos[2]); }
81  vtkGetVectorMacro(Position, double, 3);
82  void AddPosition(double deltaPosition[3]);
83  void AddPosition(double deltaX, double deltaY, double deltaZ);
84 
86 
90  virtual void SetOrigin(double x, double y, double z)
91  {
92  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
93  "): setting Origin to (" << x << "," << y << "," <<
94  z << ")");
95  if ((this->Origin[0] != x)||
96  (this->Origin[1] != y)||
97  (this->Origin[2] != z))
98  {
99  this->Origin[0] = x;
100  this->Origin[1] = y;
101  this->Origin[2] = z;
102  this->Modified();
103  this->IsIdentity = 0;
104  }
105  };
106  virtual void SetOrigin(const double pos[3])
107  { this->SetOrigin(pos[0], pos[1], pos[2]); }
108  vtkGetVectorMacro(Origin, double, 3);
110 
112 
116  virtual void SetScale(double x, double y, double z)
117  {
118  vtkDebugMacro(<< this->GetClassName() << " (" << this <<
119  "): setting Scale to (" << x << "," << y << "," <<
120  z << ")");
121  if (this->Scale[0] != x ||
122  this->Scale[1] != y ||
123  this->Scale[2] != z )
124  {
125  this->Scale[0] = x;
126  this->Scale[1] = y;
127  this->Scale[2] = z;
128  this->Modified();
129  this->IsIdentity = 0;
130  }
131  };
132  virtual void SetScale(double scale[3])
133  { this->SetScale(scale[0], scale[1], scale[2]); }
134  vtkGetVectorMacro(Scale, double, 3);
136 
140  void SetScale(double s)
141  { this->SetScale(s, s, s); }
142 
144 
157  vtkGetObjectMacro(UserTransform, vtkLinearTransform);
159 
161 
167 
169 
174  virtual void GetMatrix(vtkMatrix4x4 *m);
175  virtual void GetMatrix(double m[16]);
177 
186  void GetBounds(double bounds[6]);
187  virtual double *GetBounds() = 0;
189 
193  double *GetCenter();
194 
198  double *GetXRange();
199 
203  double *GetYRange();
204 
208  double *GetZRange();
209 
213  double GetLength();
214 
222  void RotateX(double);
223 
231  void RotateY(double);
232 
240  void RotateZ(double);
241 
248  void RotateWXYZ(double w, double x, double y, double z);
249 
255  void SetOrientation(double x, double y, double z);
256 
262  void SetOrientation(double orientation[3]);
263 
265 
271  double *GetOrientation();
272  void GetOrientation(double orentation[3]);
274 
279 
286  void AddOrientation(double x, double y, double z);
287 
294  void AddOrientation(double orentation[3]);
295 
306  void PokeMatrix(vtkMatrix4x4 *matrix);
307 
313 
318 
323 
327  virtual void ComputeMatrix();
328 
330 
334  {
335  this->ComputeMatrix();
336  return this->Matrix;
337  }
339 
341 
344  vtkGetMacro(IsIdentity, int);
346 
347 protected:
350 
355  double Origin[3];
356  double Position[3];
357  double Orientation[3];
358  double Scale[3];
359  double Center[3];
361  double Bounds[6];
362  vtkProp3D *CachedProp3D; //support the PokeMatrix() method
364 private:
365  vtkProp3D(const vtkProp3D&) VTK_DELETE_FUNCTION;
366  void operator=(const vtkProp3D&) VTK_DELETE_FUNCTION;
367 };
368 
369 #endif
vtkProp3D::~vtkProp3D
~vtkProp3D()
vtkProp3D::AddPosition
void AddPosition(double deltaX, double deltaY, double deltaZ)
vtkProp3D::GetUserTransformMatrixMTime
vtkMTimeType GetUserTransformMatrixMTime()
Get the modified time of the user matrix or user transform.
vtkProp3D::SetPosition
virtual void SetPosition(double pos[3])
Definition: vtkProp3D.h:79
vtkProp3D::GetZRange
double * GetZRange()
Get the Prop3D's z range in world coordinates.
vtkProp3D::SetUserTransform
void SetUserTransform(vtkLinearTransform *transform)
In addition to the instance variables such as position and orientation, you can add an additional tra...
vtkProp3D::GetMatrix
virtual void GetMatrix(double m[16])
vtkProp3D::PokeMatrix
void PokeMatrix(vtkMatrix4x4 *matrix)
This method modifies the vtkProp3D so that its transformation state is set to the matrix specified.
vtkProp3D::IsIdentity
int IsIdentity
Definition: vtkProp3D.h:363
vtkX3D::scale
@ scale
Definition: vtkX3D.h:229
vtkProp3D::RotateX
void RotateX(double)
Rotate the Prop3D in degrees about the X axis using the right hand rule.
vtkProp3D::SetUserMatrix
void SetUserMatrix(vtkMatrix4x4 *matrix)
The UserMatrix can be used in place of UserTransform.
vtkProp3D
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:47
vtkProp3D::GetMTime
vtkMTimeType GetMTime()
Get the vtkProp3D's mtime.
vtkProp3D::RotateWXYZ
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.
vtkProp3D::GetMatrix
virtual void GetMatrix(vtkMatrix4x4 *m)
Return a reference to the Prop3D's 4x4 composite matrix.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:36
vtkProp3D::GetOrientation
double * GetOrientation()
Returns the orientation of the Prop3D as s vector of X,Y and Z rotation.
vtkObject::Modified
virtual void Modified()
Update the modification time for this object.
vtkProp3D::SetPosition
virtual void SetPosition(double x, double y, double z)
Set/Get/Add the position of the Prop3D in world coordinates.
Definition: vtkProp3D.h:61
vtkProp3D::SetScale
virtual void SetScale(double scale[3])
Definition: vtkProp3D.h:132
vtkProp3D::CachedProp3D
vtkProp3D * CachedProp3D
Definition: vtkProp3D.h:362
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:61
vtkProp3D::SetOrientation
void SetOrientation(double x, double y, double z)
Sets the orientation of the Prop3D.
vtkProp.h
vtkProp3D::vtkProp3D
vtkProp3D()
vtkProp3D::GetYRange
double * GetYRange()
Get the Prop3D's y range in world coordinates.
vtkProp3D::AddOrientation
void AddOrientation(double orentation[3])
Add to the current orientation.
vtkLinearTransform
abstract superclass for linear transformations
Definition: vtkLinearTransform.h:35
vtkProp3D::GetCenter
double * GetCenter()
Get the center of the bounding box in world coordinates.
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
Definition: vtkType.h:248
vtkProp3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkProp3D::GetOrientationWXYZ
double * GetOrientationWXYZ()
Returns the WXYZ orientation of the Prop3D.
vtkObjectBase::GetClassName
const char * GetClassName() const
Return the class name as a string.
vtkProp3D::InitPathTraversal
void InitPathTraversal()
Overload vtkProp's method for setting up assembly paths.
vtkProp3D::Transform
vtkTransform * Transform
Definition: vtkProp3D.h:360
vtkProp3D::SetOrigin
virtual void SetOrigin(double x, double y, double z)
Set/Get the origin of the Prop3D.
Definition: vtkProp3D.h:90
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:42
vtkProp3D::ComputeMatrix
virtual void ComputeMatrix()
Generate the matrix based on ivars.
vtkProp3D::GetUserMatrix
vtkMatrix4x4 * GetUserMatrix()
vtkProp3D::UserMatrix
vtkMatrix4x4 * UserMatrix
Definition: vtkProp3D.h:352
vtkProp3D::GetOrientation
void GetOrientation(double orentation[3])
vtkProp3D::SetScale
virtual void SetScale(double x, double y, double z)
Set/Get the scale of the actor.
Definition: vtkProp3D.h:116
vtkProp::GetBounds
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:127
vtkProp3D::RotateZ
void RotateZ(double)
Rotate the Prop3D in degrees about the Z axis using the right hand rule.
vtkProp3D::SetOrientation
void SetOrientation(double orientation[3])
Sets the orientation of the Prop3D.
vtkProp3D::AddOrientation
void AddOrientation(double x, double y, double z)
Add to the current orientation.
vtkProp3D::GetMatrix
vtkMatrix4x4 * GetMatrix()
Get a pointer to an internal vtkMatrix4x4.
Definition: vtkProp3D.h:333
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
vtkProp3D::RotateY
void RotateY(double)
Rotate the Prop3D in degrees about the Y axis using the right hand rule.
vtkProp3D::ShallowCopy
void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp3D.
vtkX3D::orientation
@ orientation
Definition: vtkX3D.h:262
vtkProp3D::GetLength
double GetLength()
Get the length of the diagonal of the bounding box.
vtkRenderer
abstract specification for renderers
Definition: vtkRenderer.h:64
vtkProp3D::Matrix
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:353
vtkProp3D::AddPosition
void AddPosition(double deltaPosition[3])
vtkProp3D::SetOrigin
virtual void SetOrigin(const double pos[3])
Definition: vtkProp3D.h:106
vtkProp3D::UserTransform
vtkLinearTransform * UserTransform
Definition: vtkProp3D.h:351
vtkProp3D::MatrixMTime
vtkTimeStamp MatrixMTime
Definition: vtkProp3D.h:354
vtkProp3D::GetXRange
double * GetXRange()
Get the Prop3D's x range in world coordinates.
vtkProp3D::SetScale
void SetScale(double s)
Method to set the scale isotropically.
Definition: vtkProp3D.h:140