vtkbone
vtkboneTensorOfInertia.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Copyright 2010-2016, Numerics88 Solutions Ltd.
4  http://www.numerics88.com/
5 
6  Copyright (c) Eric Nodwell and Steven K. Boyd
7  See Copyright.txt for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 =========================================================================*/
13 
26 #ifndef __vtkboneTensorOfInertia_h
27 #define __vtkboneTensorOfInertia_h
28 
29 #include "vtkAlgorithm.h"
30 #include "vtkImageData.h"
31 #include "vtkUnstructuredGrid.h"
32 #include "vtkboneWin32Header.h"
33 
34 // forward declarations
35 class vtkTensor;
36 class vtkMatrix3x3;
37 
39 {
40 public:
42  static vtkboneTensorOfInertia *New();
43 
45  void PrintSelf(ostream& os, vtkIndent indent);
46 
48 
50  virtual int ProcessRequest(vtkInformation*,
54 
56 
57  void SetInputData(vtkDataObject *);
58  void SetInputData(int, vtkDataObject*);
60 
62 
64  vtkSetMacro(UseSpecificValue, int);
65  vtkGetMacro(UseSpecificValue, int);
66  vtkBooleanMacro(UseSpecificValue,int);
68 
70 
72  void SetSpecificValue (int v) {this->SpecificValue=v; this->UseSpecificValue=1;}
73  vtkGetMacro(SpecificValue, int);
75 
77 
80  vtkSetMacro(UseThresholds, int);
81  vtkGetMacro(UseThresholds, int);
82  vtkBooleanMacro(UseThresholds,int);
84 
86 
88  void SetLowerThreshold (double v) {this->LowerThreshold=v; this->UseThresholds=1;}
89  vtkGetMacro(LowerThreshold, double);
91 
93 
95  void SetUpperThreshold (double v) {this->UpperThreshold=v; this->UseThresholds=1;}
96  vtkGetMacro(UpperThreshold, double);
98 
100 
101  vtkGetMacro(Count, vtkIdType);
103 
105 
106  vtkGetMacro(Volume, double);
108 
110 
111  vtkGetMacro(Mass, double);
113 
115 
116  vtkGetVector3Macro(CenterOfMass, double);
117  double GetCenterOfMassX() {return this->CenterOfMass[0];}
118  double GetCenterOfMassY() {return this->CenterOfMass[1];}
119  double GetCenterOfMassZ() {return this->CenterOfMass[2];}
121 
123  void GetTensorOfInertia(vtkTensor* MOI);
124 
126  void GetTensorOfInertiaAboutOrigin(vtkTensor* MOI);
127 
131  void GetEigenvectors(vtkMatrix3x3* A);
132 
134 
135  vtkGetVector3Macro(PrincipalAxisClosestToX, double);
136  vtkGetVector3Macro(PrincipalAxisClosestToY, double);
137  vtkGetVector3Macro(PrincipalAxisClosestToZ, double);
139 
141 
143  vtkGetVector3Macro(PrincipalMoments, double);
145  {return this->PrincipalMoments[0];}
147  {return this->PrincipalMoments[1];}
149  {return this->PrincipalMoments[2];}
151 
153 
156  static void TranslateTensorOfInertiaFromCOM(
157  vtkTensor* T0,
158  double mass,
159  double r[3],
160  vtkTensor* T);
162 
164 
167  static void TranslateTensorOfInertiaToCOM(
168  vtkTensor* T,
169  double mass,
170  double r[3],
171  vtkTensor* T0);
173 
175 
177  static void TranslateTensorOfInertia(
178  vtkTensor* T1,
179  double r1[3],
180  double mass,
181  double r2[3],
182  vtkTensor* T2);
184 
185 protected:
188 
189  virtual int RequestData(vtkInformation* request,
190  vtkInformationVector** inputVector,
191  vtkInformationVector* outputVector);
192 
193  virtual int ProcessImage(vtkImageData* image);
194 
195  virtual int ProcessUnstructuredGrid(vtkUnstructuredGrid* grid);
196 
198 
199  // Settings
205 
206  // Results
208  double Volume;
209  double Mass;
210  double CenterOfMass[3];
212  vtkTensor* TensorOfInertia;
214  double PrincipalMoments[3];
215  double PrincipalAxisClosestToX[3];
216  double PrincipalAxisClosestToY[3];
217  double PrincipalAxisClosestToZ[3];
218 
219 private:
220  vtkboneTensorOfInertia(const vtkboneTensorOfInertia&); // Not implemented.
221  void operator=(const vtkboneTensorOfInertia&); // Not implemented.
222 };
223 
224 #endif
#define VTKBONE_EXPORT
virtual int ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
info
int vtkIdType
mass
virtual int FillInputPortInformation(int port, vtkInformation *info)
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
image
static vtkAlgorithm * New()
port
void operator=(const vtkObjectBase &)
calculates the tensor of inertia.