OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I686LINUX / util / I686LINUX / include / vtk / vtkConvexPointSet.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkConvexPointSet.h,v $
5   Language:  C++
6   Date:      $Date: 2002/12/26 18:24:21 $
7   Version:   $Revision: 1.12 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even 
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18 // .NAME vtkConvexPointSet - a 3D cell defined by a set of convex points
19 // .SECTION Description
20 // vtkConvexPointSet is a concrete implementation that represents a 3D cell
21 // defined by a convex set of points. An example of such a cell is an octant
22 // (from an octree). vtkConvexPointSet uses the ordered triangulations
23 // approach (vtkOrderedTriangulator) to create triangulations guaranteed to
24 // be compatible across shared faces. This allows a general approach to 
25 // processing complex, convex cell types.
26
27 #ifndef __vtkConvexPointSet_h
28 #define __vtkConvexPointSet_h
29
30 #include "vtkCell3D.h"
31
32 class vtkUnstructuredGrid;
33 class vtkCellArray;
34 class vtkTriangle;
35 class vtkTetra;
36 class vtkFloatArray;
37
38 class VTK_COMMON_EXPORT vtkConvexPointSet : public vtkCell3D
39 {
40 public:
41   static vtkConvexPointSet *New();
42   vtkTypeRevisionMacro(vtkConvexPointSet,vtkCell3D);
43
44   // Description:
45   // See vtkCell3D API for description of these methods.
46   virtual void GetEdgePoints(int vtkNotUsed(edgeId), int* &vtkNotUsed(pts)) {}
47   virtual void GetFacePoints(int vtkNotUsed(faceId), int* &vtkNotUsed(pts)) {}
48   virtual float *GetParametricCoords();
49
50   // Description:
51   // See the vtkCell API for descriptions of these methods.
52   virtual int GetCellType() {return VTK_CONVEX_POINT_SET;}
53
54   // Description:
55   // This cell requires that it be initialized prior to access.
56   virtual int RequiresInitialization() {return 1;}
57   virtual void Initialize();
58
59   // Description:
60   // A convex point set has no explicit cell edge or faces; however
61   // implicitly (after triangulation) it does. Currently the method
62   // GetNumberOfEdges() always returns 0 while the GetNumberOfFaces() returns
63   // the number of boundary triangles of the triangulation of the convex
64   // point set. The method GetNumberOfFaces() triggers a triangulation of the
65   // convex point set; repeated calls to GetFace() then return the boundary
66   // faces. (Note: GetNumberOfEdges() currently returns 0 because it is a 
67   // rarely used method and hard to implement. It can be changed in the future.
68   virtual int GetNumberOfEdges() {return 0;}
69   virtual vtkCell *GetEdge(int) {return NULL;}
70   virtual int GetNumberOfFaces();
71   virtual vtkCell *GetFace(int faceId);
72
73   // Description:
74   // Satisfy the vtkCell API. This method contours by triangulating the
75   // cell and then contouring the resulting tetrahedra.
76   virtual void Contour(float value, vtkDataArray *cellScalars, 
77                        vtkPointLocator *locator, vtkCellArray *verts, 
78                        vtkCellArray *lines, vtkCellArray *polys,
79                        vtkPointData *inPd, vtkPointData *outPd,
80                        vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
81
82   // Description:
83   // Satisfy the vtkCell API. This method contours by triangulating the
84   // cell and then adding clip-edge intersection points into the
85   // triangulation; extracting the clipped region.
86   virtual void Clip(float value, vtkDataArray *cellScalars, 
87                     vtkPointLocator *locator, vtkCellArray *connectivity,
88                     vtkPointData *inPd, vtkPointData *outPd,
89                     vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 
90                     int insideOut);
91
92   // Description:
93   // Satisfy the vtkCell API. This method determines the subId, pcoords,
94   // and weights by triangulating the convex point set, and then 
95   // determining which tetrahedron the point lies in.
96   virtual int EvaluatePosition(float x[3], float* closestPoint,
97                                int& subId, float pcoords[3],
98                                float& dist2, float *weights);
99
100   // Description:
101   // The inverse of EvaluatePosition.
102   virtual void EvaluateLocation(int& subId, float pcoords[3], float x[3],
103                                 float *weights);
104   
105   // Description:
106   // Triangulates the cells and then intersects them to determine the
107   // intersection point.
108   virtual int IntersectWithLine(float p1[3], float p2[3], float tol, float& t,
109                                 float x[3], float pcoords[3], int& subId);
110
111   // Description:
112   // Triangulate using methods of vtkOrderedTriangulator.
113   virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
114   
115   // Description:
116   // Computes derivatives by triangulating and from subId and pcoords,
117   // evaluating derivatives on the resulting tetrahedron.
118   virtual void Derivatives(int subId, float pcoords[3], float *values, 
119                            int dim, float *derivs);
120
121   // Description:
122   // Returns the set of points forming a face of the triangulation of these
123   // points that are on the boundary of the cell that are closest 
124   // parametrically to the point specified.
125   virtual int CellBoundary(int subId, float pcoords[3], vtkIdList *pts);
126   
127   // Description:
128   // Return the center of the cell in parametric coordinates. 
129   virtual int GetParametricCenter(float pcoords[3]);
130
131 protected:
132   vtkConvexPointSet();
133   ~vtkConvexPointSet();
134
135   vtkTetra      *Tetra;
136   vtkIdList     *TetraIds;
137   vtkPoints     *TetraPoints;
138   vtkFloatArray *TetraScalars;
139
140   vtkCellArray  *BoundaryTris;
141   vtkTriangle   *Triangle;
142   vtkFloatArray *ParametricCoords;
143
144 private:
145   vtkConvexPointSet(const vtkConvexPointSet&);  // Not implemented.
146   void operator=(const vtkConvexPointSet&);  // Not implemented.
147 };
148
149 inline int vtkConvexPointSet::GetParametricCenter(float pcoords[3])
150 {
151   pcoords[0] = pcoords[1] = pcoords[2] = 0.5;
152   return 0;
153 }
154
155 #endif
156
157
158