VTK
vtkCellQuality.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkObject.cxx
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 =========================================================================*/
31 #ifndef __vtkCellQuality_h
32 #define __vtkCellQuality_h
33 
34 #include "vtkDataSetAlgorithm.h"
35 
36 class vtkCell;
37 class vtkDataArray;
38 class vtkIdList;
39 class vtkPoints;
40 
42 {
43  //BTX
44  enum
45  {
46  NONE = 0,
47  AREA,
48  ASPECT_BETA,
49  ASPECT_FROBENIUS,
50  ASPECT_GAMMA,
51  ASPECT_RATIO,
52  COLLAPSE_RATIO,
53  CONDITION,
54  DIAGONAL,
55  DIMENSION,
56  DISTORTION,
57  EDGE_RATIO,
58  JACOBIAN,
59  MAX_ANGLE,
60  MAX_ASPECT_FROBENIUS,
61  MAX_EDGE_RATIO,
62  MED_ASPECT_FROBENIUS,
63  MIN_ANGLE,
64  NORMAL,
65  ODDY,
66  RADIUS_RATIO,
67  RELATIVE_SIZE_SQUARED,
68  SCALED_JACOBIAN,
69  SHAPE,
70  SHAPE_AND_SIZE,
71  SHEAR,
72  SHEAR_AND_SIZE,
73  SKEW,
74  STRETCH,
75  TAPER,
76  VOLUME,
77  WARPAGE,
78  };
79  //ETX
80 
81 public:
82  void PrintSelf (ostream&, vtkIndent);
84  static vtkCellQuality* New ();
85 
87 
93  vtkSetMacro(QualityMeasure, int);
94  vtkGetMacro(QualityMeasure, int);
96 
98  {
99  this->SetQualityMeasure(AREA);
100  }
102  {
103  this->SetQualityMeasure(ASPECT_BETA);
104  }
106  {
107  this->SetQualityMeasure(ASPECT_FROBENIUS);
108  }
110  {
111  this->SetQualityMeasure(ASPECT_GAMMA);
112  }
114  {
115  this->SetQualityMeasure(ASPECT_RATIO);
116  }
118  {
119  this->SetQualityMeasure(COLLAPSE_RATIO);
120  }
122  {
123  this->SetQualityMeasure(CONDITION);
124  }
126  {
127  this->SetQualityMeasure(DIAGONAL);
128  }
130  {
131  this->SetQualityMeasure(DIMENSION);
132  }
134  {
135  this->SetQualityMeasure(DISTORTION);
136  }
138  {
139  this->SetQualityMeasure(JACOBIAN);
140  }
142  {
143  this->SetQualityMeasure(MAX_ANGLE);
144  }
146  {
147  this->SetQualityMeasure(MAX_ASPECT_FROBENIUS);
148  }
150  {
151  this->SetQualityMeasure(MAX_EDGE_RATIO);
152  }
154  {
155  this->SetQualityMeasure(MED_ASPECT_FROBENIUS);
156  }
158  {
159  this->SetQualityMeasure(MIN_ANGLE);
160  }
162  {
163  this->SetQualityMeasure(ODDY);
164  }
166  {
167  this->SetQualityMeasure(RADIUS_RATIO);
168  }
170  {
171  this->SetQualityMeasure(RELATIVE_SIZE_SQUARED);
172  }
174  {
175  this->SetQualityMeasure(SCALED_JACOBIAN);
176  }
178  {
179  this->SetQualityMeasure(SHAPE_AND_SIZE);
180  }
182  {
183  this->SetQualityMeasure(SHAPE);
184  }
186  {
187  this->SetQualityMeasure(SHEAR_AND_SIZE);
188  }
190  {
191  this->SetQualityMeasure(SHEAR);
192  }
194  {
195  this->SetQualityMeasure(SKEW);
196  }
198  {
199  this->SetQualityMeasure(STRETCH);
200  }
202  {
203  this->SetQualityMeasure(TAPER);
204  }
206  {
207  this->SetQualityMeasure(VOLUME);
208  }
210  {
211  this->SetQualityMeasure(WARPAGE);
212  }
213 
215 
219  vtkSetMacro(UnsupportedGeometry, double);
220  vtkGetMacro(UnsupportedGeometry, double);
222 
224 
229  vtkSetMacro(UndefinedQuality, double);
230  vtkGetMacro(UndefinedQuality, double);
232 
233  double TriangleStripArea (vtkCell*);
234  double PixelArea (vtkCell*);
235  double PolygonArea (vtkCell*);
236 
237 protected:
238  ~vtkCellQuality ();
239  vtkCellQuality ();
240 
246  double ComputeTriangleQuality (vtkCell*);
247 
257  double ComputeQuadQuality (vtkCell*);
258 
265  double ComputeTetQuality (vtkCell*);
266 
273  double ComputeHexQuality (vtkCell*);
274 
278  double ComputeTriangleStripQuality (vtkCell*);
279 
282  double ComputePixelQuality (vtkCell*);
283 
284  virtual int RequestData
286 
288 
292  static int GetCurrentTriangleNormal (double point [3], double normal [3]);
293  static double CurrentTriNormal [3];
295 
297 
298  // Default return value for unsupported geometry
300 
301  // Default return value for qualities that are not well-defined for certain
302  // types of supported geometries. e.g. volume of a triangle
304 
305 private:
306  vtkIdList* PointIds;
307  vtkPoints* Points;
308 
309  vtkCellQuality(const vtkCellQuality&); // Not implemented
310  void operator=(const vtkCellQuality&); // Not implemented
311 };
312 
313 #endif // vtkCellQuality_h