Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkPolygon.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPolygon.h,v $
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 =========================================================================*/
00030 #ifndef __vtkPolygon_h
00031 #define __vtkPolygon_h
00032 
00033 #include "vtkCell.h"
00034 
00035 class vtkDoubleArray;
00036 class vtkLine;
00037 class vtkPoints;
00038 class vtkQuad;
00039 class vtkTriangle;
00040 
00041 class VTK_FILTERING_EXPORT vtkPolygon : public vtkCell
00042 {
00043 public:
00044   static vtkPolygon *New();
00045   vtkTypeRevisionMacro(vtkPolygon,vtkCell);
00046   void PrintSelf(ostream& os, vtkIndent indent);
00047 
00049 
00050   int GetCellType() {return VTK_POLYGON;};
00051   int GetCellDimension() {return 2;};
00052   int GetNumberOfEdges() {return this->GetNumberOfPoints();};
00053   int GetNumberOfFaces() {return 0;};
00054   vtkCell *GetEdge(int edgeId);
00055   vtkCell *GetFace(int) {return 0;};
00056   int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
00057   void Contour(double value, vtkDataArray *cellScalars,
00058                vtkPointLocator *locator,vtkCellArray *verts,
00059                vtkCellArray *lines, vtkCellArray *polys,
00060                vtkPointData *inPd, vtkPointData *outPd,
00061                vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
00062   void Clip(double value, vtkDataArray *cellScalars,
00063             vtkPointLocator *locator, vtkCellArray *tris,
00064             vtkPointData *inPd, vtkPointData *outPd,
00065             vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
00066             int insideOut);
00067   int EvaluatePosition(double x[3], double* closestPoint,
00068                        int& subId, double pcoords[3],
00069                        double& dist2, double *weights);
00070   void EvaluateLocation(int& subId, double pcoords[3], double x[3],
00071                         double *weights);
00072   int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
00073                         double x[3], double pcoords[3], int& subId);
00074   int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
00075   void Derivatives(int subId, double pcoords[3], double *values,
00076                    int dim, double *derivs);
00077   int IsPrimaryCell() {return 0;}
00079 
00081 
00082   static void ComputeNormal(vtkPoints *p, int numPts, vtkIdType *pts,
00083                             double n[3]);
00084   static void ComputeNormal(vtkPoints *p, double n[3]);
00086 
00090   static void ComputeNormal(int numPts, double *pts, double n[3]);
00091 
00093   void ComputeWeights(double x[3], double *weights);
00094 
00095 
00097 
00102   int ParameterizePolygon(double p0[3], double p10[3], double &l10,
00103                           double p20[3], double &l20, double n[3]);
00105 
00107 
00111   static int PointInPolygon(double x[3], int numPts, double *pts,
00112                             double bounds[6], double n[3]);
00114 
00119   int Triangulate(vtkIdList *outTris);
00120 
00122 
00128   static int IntersectPolygonWithPolygon(int npts, double *pts, double bounds[6],
00129                                          int npts2, double *pts2,
00130                                          double bounds2[3], double tol,
00131                                          double x[3]);
00133 
00134 protected:
00135   vtkPolygon();
00136   ~vtkPolygon();
00137 
00138   // variables used by instances of this class
00139   double   Tolerance; // Intersection tolerance
00140   int      SuccessfulTriangulation; // Stops recursive tri. if necessary
00141   double   Normal[3]; //polygon normal
00142   vtkIdList *Tris;
00143   vtkTriangle *Triangle;
00144   vtkQuad *Quad;
00145   vtkDoubleArray *TriScalars;
00146   vtkLine *Line;
00147 
00148   // Helper methods for triangulation------------------------------
00153   int EarCutTriangulation();
00154 
00155 private:
00156   vtkPolygon(const vtkPolygon&);  // Not implemented.
00157   void operator=(const vtkPolygon&);  // Not implemented.
00158 };
00159 
00160 #endif
00161 

Generated on Mon Jan 21 23:07:20 2008 for VTK by  doxygen 1.4.3-20050530