Common/vtkPolygon.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages

# Common/vtkPolygon.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkPolygon.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00046 #ifndef __vtkPolygon_h
    00047 #define __vtkPolygon_h
    00048
    00049 #include "vtkCell.h"
    00050
    00051 class vtkFloatArray;
    00052 class vtkLine;
    00053 class vtkPoints;
    00054 class vtkQuad;
    00055 class vtkTriangle;
    00056
    00057 class VTK_COMMON_EXPORT vtkPolygon : public vtkCell
    00058 {
    00059 public:
    00060   static vtkPolygon *New();
    00061   vtkTypeRevisionMacro(vtkPolygon,vtkCell);
    00062
    00064
    00065   int GetCellType() {return VTK_POLYGON;};
    00066   int GetCellDimension() {return 2;};
    00067   int GetNumberOfEdges() {return this->GetNumberOfPoints();};
    00068   int GetNumberOfFaces() {return 0;};
    00069   vtkCell *GetEdge(int edgeId);
    00070   vtkCell *GetFace(int) {return 0;};
    00071   int CellBoundary(int subId, float pcoords[3], vtkIdList *pts);
    00072   void Contour(float value, vtkDataArray *cellScalars,
    00073                vtkPointLocator *locator,vtkCellArray *verts,
    00074                vtkCellArray *lines, vtkCellArray *polys,
    00075                vtkPointData *inPd, vtkPointData *outPd,
    00076                vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
    00077   void Clip(float value, vtkDataArray *cellScalars,
    00078             vtkPointLocator *locator, vtkCellArray *tris,
    00079             vtkPointData *inPd, vtkPointData *outPd,
    00080             vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
    00081             int insideOut);
    00082   int EvaluatePosition(float x[3], float* closestPoint,
    00083                        int& subId, float pcoords[3],
    00084                        float& dist2, float *weights);
    00085   void EvaluateLocation(int& subId, float pcoords[3], float x[3],
    00086                         float *weights);
    00087   int IntersectWithLine(float p1[3], float p2[3], float tol, float& t,
    00088                         float x[3], float pcoords[3], int& subId);
    00089   int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
    00090   void Derivatives(int subId, float pcoords[3], float *values,
    00091                    int dim, float *derivs);
    00093
    00095
    00096   static void ComputeNormal(vtkPoints *p, int numPts, vtkIdType *pts,
    00097                             float n[3]);
    00098   static void ComputeNormal(vtkPoints *p, float n[3]);
    00100
    00104   static void ComputeNormal(int numPts, float *pts, float n[3]);
    00105
    00107   void ComputeWeights(float x[3], float *weights);
    00108
    00109
    00111
    00116   int ParameterizePolygon(float p0[3], float p10[3], float &l10,
    00117                           float p20[3], float &l20, float n[3]);
    00119
    00121
    00125   static int PointInPolygon(float x[3], int numPts, float *pts,
    00126                             float bounds[6], float n[3]);
    00128
    00133   int Triangulate(vtkIdList *outTris);
    00134
    00136
    00142   static int IntersectPolygonWithPolygon(int npts, float *pts, float bounds[6],
    00143                                          int npts2, float *pts2,
    00144                                          float bounds2[3], float tol,
    00145                                          float x[3]);
    00147
    00148 protected:
    00149   vtkPolygon();
    00150   ~vtkPolygon();
    00151
    00152   // variables used by instances of this class
    00153   float   Tolerance; // Intersection tolerance
    00154   int     SuccessfulTriangulation; // Stops recursive tri. if necessary
    00155   float   Normal[3]; //polygon normal
    00156   vtkIdList *Tris;
    00157   vtkTriangle *Triangle;
    00158   vtkQuad *Quad;
    00159   vtkFloatArray *TriScalars;
    00160   vtkLine *Line;
    00161
    00162   // Helper methods for triangulation------------------------------
    00167   int EarCutTriangulation();
    00168
    00169 private:
    00170   vtkPolygon(const vtkPolygon&);  // Not implemented.
    00171   void operator=(const vtkPolygon&);  // Not implemented.
    00172 };
    00173
    00174 #endif
    00175