00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00037 #ifndef __vtkPolyhedron_h
00038 #define __vtkPolyhedron_h
00039
00040 #include "vtkCell3D.h"
00041
00042 class vtkIdTypeArray;
00043 class vtkCellArray;
00044 class vtkTriangle;
00045 class vtkQuad;
00046 class vtkTetra;
00047 class vtkPolygon;
00048 class vtkLine;
00049 class vtkPointIdMap;
00050 class vtkIdToIdVectorMapType;
00051 class vtkIdToIdMapType;
00052 class vtkEdgeTable;
00053 class vtkPolyData;
00054 class vtkCellLocator;
00055 class vtkGenericCell;
00056 class vtkPointLocator;
00057
00058 class VTK_FILTERING_EXPORT vtkPolyhedron : public vtkCell3D
00059 {
00060 public:
00062
00063 static vtkPolyhedron *New();
00064 vtkTypeMacro(vtkPolyhedron,vtkCell3D);
00065 void PrintSelf(ostream& os, vtkIndent indent);
00067
00069
00070 virtual void GetEdgePoints(int vtkNotUsed(edgeId), int* &vtkNotUsed(pts)) {}
00071 virtual void GetFacePoints(int vtkNotUsed(faceId), int* &vtkNotUsed(pts)) {}
00072 virtual double *GetParametricCoords();
00074
00076 virtual int GetCellType() {return VTK_POLYHEDRON;}
00077
00079
00080 virtual int RequiresInitialization() {return 1;}
00081 virtual void Initialize();
00083
00085
00087 virtual int GetNumberOfEdges();
00088 virtual vtkCell *GetEdge(int);
00089 virtual int GetNumberOfFaces();
00090 virtual vtkCell *GetFace(int faceId);
00092
00094
00098 virtual void Contour(double value, vtkDataArray *scalars,
00099 vtkIncrementalPointLocator *locator, vtkCellArray *verts,
00100 vtkCellArray *lines, vtkCellArray *polys,
00101 vtkPointData *inPd, vtkPointData *outPd,
00102 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
00104
00106
00114 virtual void Clip(double value, vtkDataArray *scalars,
00115 vtkIncrementalPointLocator *locator, vtkCellArray *connectivity,
00116 vtkPointData *inPd, vtkPointData *outPd,
00117 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
00118 int insideOut);
00120
00122
00128 virtual int EvaluatePosition(double x[3], double* closestPoint,
00129 int& subId, double pcoords[3],
00130 double& dist2, double *weights);
00132
00134
00136 virtual void EvaluateLocation(int& subId, double pcoords[3], double x[3],
00137 double *weights);
00139
00141
00145 virtual int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
00146 double x[3], double pcoords[3], int& subId);
00148
00162 virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
00163
00165
00170 virtual void Derivatives(int subId, double pcoords[3], double *values,
00171 int dim, double *derivs);
00173
00176 virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
00177
00180 virtual int GetParametricCenter(double pcoords[3]);
00181
00183 int IsPrimaryCell() {return 1;}
00184
00186
00189 virtual void InterpolateFunctions(double x[3], double *sf);
00190 virtual void InterpolateDerivs(double x[3], double *derivs);
00192
00194
00200 virtual int RequiresExplicitFaceRepresentation() {return 1;}
00201 virtual void SetFaces(vtkIdType *faces);
00202 virtual vtkIdType *GetFaces();
00204
00205
00206
00207
00208
00209
00210 int IsInside(double x[3], double tolerance);
00211
00213 vtkPolyData* GetPolyData();
00214
00215 protected:
00216 vtkPolyhedron();
00217 ~vtkPolyhedron();
00218
00219
00220 vtkLine *Line;
00221 vtkTriangle *Triangle;
00222 vtkQuad *Quad;
00223 vtkPolygon *Polygon;
00224 vtkTetra *Tetra;
00225 vtkIdTypeArray *GlobalFaces;
00226 vtkIdTypeArray *FaceLocations;
00227
00228
00229
00230
00231
00232
00233 vtkPointIdMap *PointIdMap;
00234
00235
00236
00237 int EdgesGenerated;
00238 vtkEdgeTable *EdgeTable;
00239 vtkIdTypeArray *Edges;
00240 int GenerateEdges();
00241
00242
00243
00244
00245 vtkIdTypeArray *Faces;
00246 int FacesGenerated;
00247 void GenerateFaces();
00248
00249
00250 int BoundsComputed;
00251 void ComputeBounds();
00252 void ComputeParametricCoordinate(double x[3], double pc[3]);
00253 void ComputePositionFromParametricCoordinate(double pc[3], double x[3]);
00254
00255
00256 int PolyDataConstructed;
00257 vtkPolyData *PolyData;
00258 vtkCellArray *Polys;
00259 vtkIdTypeArray *PolyConnectivity;
00260 void ConstructPolyData();
00261 int LocatorConstructed;
00262 vtkCellLocator *CellLocator;
00263 void ConstructLocator();
00264 vtkIdList *CellIds;
00265 vtkGenericCell *Cell;
00266
00267
00268
00269 int InternalContour(double value,
00270 int insideOut,
00271 vtkIncrementalPointLocator *locator,
00272 vtkDataArray *inScalars,
00273 vtkDataArray *outScalars,
00274 vtkPointData *inPd,
00275 vtkPointData *outPd,
00276 vtkCellArray *contourPolys,
00277 vtkIdToIdVectorMapType & faceToPointsMap,
00278 vtkIdToIdVectorMapType & pointToFacesMap,
00279 vtkIdToIdMapType & pointIdMap);
00280
00281
00282
00283
00284
00285 int IntersectWithContour(double value,
00286 int insideOut,
00287 vtkDataArray *inScalars);
00288
00289 private:
00290 vtkPolyhedron(const vtkPolyhedron&);
00291 void operator=(const vtkPolyhedron&);
00292
00293
00294 class vtkInternal;
00295 vtkInternal * Internal;
00296
00297 };
00298
00299
00300 inline int vtkPolyhedron::GetParametricCenter(double pcoords[3])
00301 {
00302 pcoords[0] = pcoords[1] = pcoords[2] = 0.5;
00303 return 0;
00304 }
00305
00306 #endif