VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkObject.cxx 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00031 #ifndef __vtkCellQuality_h 00032 #define __vtkCellQuality_h 00033 00034 #include "vtkFiltersVerdictModule.h" // For export macro 00035 #include "vtkDataSetAlgorithm.h" 00036 00037 class vtkCell; 00038 class vtkDataArray; 00039 class vtkIdList; 00040 class vtkPoints; 00041 00042 class VTKFILTERSVERDICT_EXPORT vtkCellQuality : public vtkDataSetAlgorithm 00043 { 00044 //BTX 00045 enum 00046 { 00047 NONE = 0, 00048 AREA, 00049 ASPECT_BETA, 00050 ASPECT_FROBENIUS, 00051 ASPECT_GAMMA, 00052 ASPECT_RATIO, 00053 COLLAPSE_RATIO, 00054 CONDITION, 00055 DIAGONAL, 00056 DIMENSION, 00057 DISTORTION, 00058 EDGE_RATIO, 00059 JACOBIAN, 00060 MAX_ANGLE, 00061 MAX_ASPECT_FROBENIUS, 00062 MAX_EDGE_RATIO, 00063 MED_ASPECT_FROBENIUS, 00064 MIN_ANGLE, 00065 NORMAL, 00066 ODDY, 00067 RADIUS_RATIO, 00068 RELATIVE_SIZE_SQUARED, 00069 SCALED_JACOBIAN, 00070 SHAPE, 00071 SHAPE_AND_SIZE, 00072 SHEAR, 00073 SHEAR_AND_SIZE, 00074 SKEW, 00075 STRETCH, 00076 TAPER, 00077 VOLUME, 00078 WARPAGE 00079 }; 00080 //ETX 00081 00082 public: 00083 void PrintSelf (ostream&, vtkIndent); 00084 vtkTypeMacro(vtkCellQuality, vtkDataSetAlgorithm); 00085 static vtkCellQuality* New (); 00086 00088 00094 vtkSetMacro(QualityMeasure, int); 00095 vtkGetMacro(QualityMeasure, int); 00097 00098 void SetQualityMeasureToArea () 00099 { 00100 this->SetQualityMeasure(AREA); 00101 } 00102 void SetQualityMeasureToAspectBeta () 00103 { 00104 this->SetQualityMeasure(ASPECT_BETA); 00105 } 00106 void SetQualityMeasureToAspectFrobenius () 00107 { 00108 this->SetQualityMeasure(ASPECT_FROBENIUS); 00109 } 00110 void SetQualityMeasureToAspectGamma () 00111 { 00112 this->SetQualityMeasure(ASPECT_GAMMA); 00113 } 00114 void SetQualityMeasureToAspectRatio () 00115 { 00116 this->SetQualityMeasure(ASPECT_RATIO); 00117 } 00118 void SetQualityMeasureToCollapseRatio () 00119 { 00120 this->SetQualityMeasure(COLLAPSE_RATIO); 00121 } 00122 void SetQualityMeasureToCondition () 00123 { 00124 this->SetQualityMeasure(CONDITION); 00125 } 00126 void SetQualityMeasureToDiagonal () 00127 { 00128 this->SetQualityMeasure(DIAGONAL); 00129 } 00130 void SetQualityMeasureToDimension () 00131 { 00132 this->SetQualityMeasure(DIMENSION); 00133 } 00134 void SetQualityMeasureToDistortion () 00135 { 00136 this->SetQualityMeasure(DISTORTION); 00137 } 00138 void SetQualityMeasureToJacobian () 00139 { 00140 this->SetQualityMeasure(JACOBIAN); 00141 } 00142 void SetQualityMeasureToMaxAngle () 00143 { 00144 this->SetQualityMeasure(MAX_ANGLE); 00145 } 00146 void SetQualityMeasureToMaxAspectFrobenius () 00147 { 00148 this->SetQualityMeasure(MAX_ASPECT_FROBENIUS); 00149 } 00150 void SetQualityMeasureToMaxEdgeRatio () 00151 { 00152 this->SetQualityMeasure(MAX_EDGE_RATIO); 00153 } 00154 void SetQualityMeasureToMedAspectFrobenius () 00155 { 00156 this->SetQualityMeasure(MED_ASPECT_FROBENIUS); 00157 } 00158 void SetQualityMeasureToMinAngle () 00159 { 00160 this->SetQualityMeasure(MIN_ANGLE); 00161 } 00162 void SetQualityMeasureToOddy () 00163 { 00164 this->SetQualityMeasure(ODDY); 00165 } 00166 void SetQualityMeasureToRadiusRatio () 00167 { 00168 this->SetQualityMeasure(RADIUS_RATIO); 00169 } 00170 void SetQualityMeasureToRelativeSizeSquared () 00171 { 00172 this->SetQualityMeasure(RELATIVE_SIZE_SQUARED); 00173 } 00174 void SetQualityMeasureToScaledJacobian () 00175 { 00176 this->SetQualityMeasure(SCALED_JACOBIAN); 00177 } 00178 void SetQualityMeasureToShapeAndSize () 00179 { 00180 this->SetQualityMeasure(SHAPE_AND_SIZE); 00181 } 00182 void SetQualityMeasureToShape () 00183 { 00184 this->SetQualityMeasure(SHAPE); 00185 } 00186 void SetQualityMeasureToShearAndSize () 00187 { 00188 this->SetQualityMeasure(SHEAR_AND_SIZE); 00189 } 00190 void SetQualityMeasureToShear () 00191 { 00192 this->SetQualityMeasure(SHEAR); 00193 } 00194 void SetQualityMeasureToSkew () 00195 { 00196 this->SetQualityMeasure(SKEW); 00197 } 00198 void SetQualityMeasureToStretch () 00199 { 00200 this->SetQualityMeasure(STRETCH); 00201 } 00202 void SetQualityMeasureToTaper () 00203 { 00204 this->SetQualityMeasure(TAPER); 00205 } 00206 void SetQualityMeasureToVolume () 00207 { 00208 this->SetQualityMeasure(VOLUME); 00209 } 00210 void SetQualityMeasureToWarpage () 00211 { 00212 this->SetQualityMeasure(WARPAGE); 00213 } 00214 00216 00220 vtkSetMacro(UnsupportedGeometry, double); 00221 vtkGetMacro(UnsupportedGeometry, double); 00223 00225 00230 vtkSetMacro(UndefinedQuality, double); 00231 vtkGetMacro(UndefinedQuality, double); 00233 00234 double TriangleStripArea (vtkCell*); 00235 double PixelArea (vtkCell*); 00236 double PolygonArea (vtkCell*); 00237 00238 protected: 00239 ~vtkCellQuality (); 00240 vtkCellQuality (); 00241 00247 double ComputeTriangleQuality (vtkCell*); 00248 00258 double ComputeQuadQuality (vtkCell*); 00259 00266 double ComputeTetQuality (vtkCell*); 00267 00274 double ComputeHexQuality (vtkCell*); 00275 00279 double ComputeTriangleStripQuality (vtkCell*); 00280 00283 double ComputePixelQuality (vtkCell*); 00284 00285 virtual int RequestData 00286 (vtkInformation*, vtkInformationVector**, vtkInformationVector*); 00287 00289 00293 static int GetCurrentTriangleNormal (double point [3], double normal [3]); 00294 static double CurrentTriNormal [3]; 00296 00297 int QualityMeasure; 00298 00299 // Default return value for unsupported geometry 00300 double UnsupportedGeometry; 00301 00302 // Default return value for qualities that are not well-defined for certain 00303 // types of supported geometries. e.g. volume of a triangle 00304 double UndefinedQuality; 00305 00306 private: 00307 vtkIdList* PointIds; 00308 vtkPoints* Points; 00309 00310 vtkCellQuality(const vtkCellQuality&); // Not implemented 00311 void operator=(const vtkCellQuality&); // Not implemented 00312 }; 00313 00314 #endif // vtkCellQuality_h