VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkQuadraticPolygon.h 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 =========================================================================*/ 00035 #ifndef vtkQuadraticPolygon_h 00036 #define vtkQuadraticPolygon_h 00037 00038 #include "vtkCommonDataModelModule.h" // For export macro 00039 #include "vtkNonLinearCell.h" 00040 00041 class vtkQuadraticEdge; 00042 class vtkPolygon; 00043 class vtkIdTypeArray; 00044 00045 class VTKCOMMONDATAMODEL_EXPORT vtkQuadraticPolygon : public vtkNonLinearCell 00046 { 00047 public: 00048 static vtkQuadraticPolygon *New(); 00049 vtkTypeMacro(vtkQuadraticPolygon, vtkNonLinearCell); 00050 void PrintSelf(ostream& os, vtkIndent indent); 00051 00053 00055 int GetCellType() { return VTK_QUADRATIC_POLYGON; } 00056 int GetCellDimension() { return 2;} 00057 int GetNumberOfEdges() { return this->GetNumberOfPoints() / 2; } 00058 int GetNumberOfFaces() { return 0; } 00059 vtkCell *GetEdge(int); 00060 vtkCell *GetFace(int) { return 0; } 00061 int IsPrimaryCell() { return 0; } 00063 00065 00069 int CellBoundary(int subId, double pcoords[3], vtkIdList *pts); 00070 void Contour(double value, vtkDataArray *cellScalars, 00071 vtkIncrementalPointLocator *locator, vtkCellArray *verts, 00072 vtkCellArray *lines, vtkCellArray *polys, 00073 vtkPointData *inPd, vtkPointData *outPd, 00074 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd); 00075 void Clip(double value, vtkDataArray *cellScalars, 00076 vtkIncrementalPointLocator *locator, vtkCellArray *polys, 00077 vtkPointData *inPd, vtkPointData *outPd, 00078 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 00079 int insideOut); 00080 int EvaluatePosition(double x[3], double* closestPoint, 00081 int& subId, double pcoords[3], 00082 double& dist2, double *weights); 00083 void EvaluateLocation(int& subId, double pcoords[3], double x[3], 00084 double *weights); 00085 int IntersectWithLine(double p1[3], double p2[3], double tol, double& t, 00086 double x[3], double pcoords[3], int& subId); 00087 virtual void InterpolateFunctions(double x[3], double *weights); 00088 static void ComputeCentroid(vtkIdTypeArray *ids, vtkPoints *pts, 00089 double centroid[3]); 00090 int ParameterizePolygon(double p0[3], double p10[3], double &l10, 00091 double p20[3], double &l20, double n[3]); 00092 static int PointInPolygon(double x[3], int numPts, double *pts, 00093 double bounds[6], double n[3]); 00094 int Triangulate(vtkIdList *outTris); 00095 int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts); 00096 int NonDegenerateTriangulate(vtkIdList *outTris); 00097 static double DistanceToPolygon(double x[3], int numPts, double *pts, 00098 double bounds[6], double closest[3]); 00099 static int IntersectPolygonWithPolygon(int npts, double *pts, double bounds[6], 00100 int npts2, double *pts2, 00101 double bounds2[3], double tol, 00102 double x[3]); 00103 static int IntersectConvex2DCells(vtkCell *cell1, vtkCell *cell2, 00104 double tol, double p0[3], double p1[3]); 00106 00107 // Not implemented 00108 void Derivatives(int subId, double pcoords[3], double *values, 00109 int dim, double *derivs); 00110 00112 00117 vtkGetMacro(UseMVCInterpolation, bool); 00118 vtkSetMacro(UseMVCInterpolation, bool); 00120 00121 protected: 00122 vtkQuadraticPolygon(); 00123 ~vtkQuadraticPolygon(); 00124 00125 // variables used by instances of this class 00126 vtkPolygon *Polygon; 00127 vtkQuadraticEdge *Edge; 00128 00129 // Parameter indicating whether to use Mean Value Coordinate algorithm 00130 // for interpolation. The parameter is true by default. 00131 bool UseMVCInterpolation; 00132 00134 00136 static void GetPermutationFromPolygon(vtkIdType nb, vtkIdList *permutation); 00137 static void PermuteToPolygon(vtkIdType nbPoints, double *inPoints, double *outPoints); 00138 static void PermuteToPolygon(vtkCell *inCell, vtkCell *outCell); 00139 static void PermuteToPolygon(vtkPoints *inPoints, vtkPoints *outPoints); 00140 static void PermuteToPolygon(vtkIdTypeArray *inIds, vtkIdTypeArray *outIds); 00141 static void PermuteToPolygon(vtkDataArray *inDataArray, vtkDataArray *outDataArray); 00142 void InitializePolygon(); 00144 00146 00148 static void GetPermutationToPolygon(vtkIdType nb, vtkIdList *permutation); 00149 static void PermuteFromPolygon(vtkIdType nb, double *values); 00150 static void ConvertFromPolygon(vtkIdList *ids); 00152 00153 private: 00154 vtkQuadraticPolygon(const vtkQuadraticPolygon&); // Not implemented. 00155 void operator=(const vtkQuadraticPolygon&); // Not implemented. 00156 }; 00157 00158 #endif