This file is indexed.

/usr/include/vtk-5.10/vtkPolyhedron.h is in libvtk5-dev 5.10.1+dfsg-2.1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPolyhedron.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkPolyhedron - a 3D cell defined by a set of polygonal faces
// .SECTION Description
// vtkPolyhedron is a concrete implementation that represents a 3D cell
// defined by a set of polygonal faces. The polyhedron should be watertight,
// non-self-intersecting and manifold (each edge is used twice).
//
// Interpolation functions and weights are defined / computed using the
// method of Mean Value Coordinates (MVC). See the VTK class
// vtkMeanValueCoordinatesInterpolator for more information.
//
// The class assumes that the polyhedron is non-convex. However, the
// polygonal faces should be planar. Non-planar polygonal faces will
// definitely cause problems, especially in severely warped situations.

// .SECTION See Also
// vtkCell3D vtkConvecPointSet vtkMeanValueCoordinatesInterpolator

#ifndef __vtkPolyhedron_h
#define __vtkPolyhedron_h

#include "vtkCell3D.h"

class vtkIdTypeArray;
class vtkCellArray;
class vtkTriangle;
class vtkQuad;
class vtkTetra;
class vtkPolygon;
class vtkLine;
class vtkPointIdMap;
class vtkIdToIdVectorMapType;
class vtkIdToIdMapType;
class vtkEdgeTable;
class vtkPolyData;
class vtkCellLocator;
class vtkGenericCell;
class vtkPointLocator;

class VTK_FILTERING_EXPORT vtkPolyhedron : public vtkCell3D
{
public:
  // Description:
  // Standard new methods.
  static vtkPolyhedron *New();
  vtkTypeMacro(vtkPolyhedron,vtkCell3D);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // See vtkCell3D API for description of these methods.
  virtual void GetEdgePoints(int vtkNotUsed(edgeId), int* &vtkNotUsed(pts)) {}
  virtual void GetFacePoints(int vtkNotUsed(faceId), int* &vtkNotUsed(pts)) {}
  virtual double *GetParametricCoords();

  // Description:
  // See the vtkCell API for descriptions of these methods.
  virtual int GetCellType() {return VTK_POLYHEDRON;}

  // Description:
  // This cell requires that it be initialized prior to access.
  virtual int RequiresInitialization() {return 1;}
  virtual void Initialize();

  // Description:
  // A polyhedron is represented internally by a set of polygonal faces.
  // These faces can be processed to explicitly determine edges. 
  virtual int GetNumberOfEdges();
  virtual vtkCell *GetEdge(int);
  virtual int GetNumberOfFaces();
  virtual vtkCell *GetFace(int faceId);

  // Description:
  // Satisfy the vtkCell API. This method contours the input polyhedron and outputs 
  // a polygon. When the result polygon is not planar, it will be triangulated.
  // The current implementation assumes water-tight polyhedron cells.
  virtual void Contour(double value, vtkDataArray *scalars,
                       vtkIncrementalPointLocator *locator, vtkCellArray *verts,
                       vtkCellArray *lines, vtkCellArray *polys,
                       vtkPointData *inPd, vtkPointData *outPd,
                       vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);

  // Description:
  // Satisfy the vtkCell API. This method clips the input polyhedron and outputs
  // a new polyhedron. The face information of the output polyhedron is encoded
  // in the output vtkCellArray using a special format:
  // CellLength [nCellFaces, nFace0Pts, i, j, k, nFace1Pts, i, j, k, ...].
  // Use the static method vtkUnstructuredGrid::DecomposePolyhedronCellArray 
  // to convert it into a standard format. Note: the algorithm assumes water-tight
  // polyhedron cells.
  virtual void Clip(double value, vtkDataArray *scalars,
                    vtkIncrementalPointLocator *locator, vtkCellArray *connectivity,
                    vtkPointData *inPd, vtkPointData *outPd,
                    vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
                    int insideOut);

  // Description:
  // Satisfy the vtkCell API. The subId is ignored and zero is always
  // returned. The parametric coordinates pcoords are normalized values in
  // the bounding box of the polyhedron. The weights are determined by
  // evaluating the MVC coordinates. The dist is always zero if the point x[3]
  // is inside the polyhedron; otherwise it's the distance to the surface.
  virtual int EvaluatePosition(double x[3], double* closestPoint,
                               int& subId, double pcoords[3],
                               double& dist2, double *weights);

  // Description:
  // The inverse of EvaluatePosition. Note the weights should be the MVC
  // weights.
  virtual void EvaluateLocation(int& subId, double pcoords[3], double x[3],
                                double *weights);

  // Description:
  // Intersect the line (p1,p2) with a given tolerance tol to determine a
  // point of intersection x[3] with parametric coordinate t along the
  // line. The parametric coordinates are returned as well (subId can be
  // ignored). Returns the number of intersection points.
  virtual int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
                                double x[3], double pcoords[3], int& subId);

  // Description:
  // Use vtkOrderedTriangulator to tetrahedralize the polyhedron mesh. This 
  // method works well for a convex polyhedron but may return wrong result
  // in a concave case.
  // Once triangulation has been performed, the results are saved in ptIds and
  // pts. The ptIds is a vtkIdList with 4xn number of ids (n is the number of 
  // result tetrahedrons). The first 4 represent the point ids of the first 
  // tetrahedron, the second 4 represents the point ids of the second tetrahedron
  // and so on. The point ids represent global dataset ids. 
  // The points of result tetrahedons are stored in pts. Note that there are
  // 4xm output points (m is the number of points in the original polyhedron). 
  // A point may be stored multiple times when it is shared by more than one 
  // tetrahedrons. The points stored in pts are ordered the same as they are 
  // listed in ptIds.  
  virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);

  // Description:
  // Computes derivatives at the point specified by the parameter coordinate.
  // Current implementation uses all vertices and subId is not used.
  // To accelerate the speed, the future implementation can triangulate and 
  // extract the local tetrahedron from subId and pcoords, then evaluate 
  // derivatives on the local tetrahedron. 
  virtual void Derivatives(int subId, double pcoords[3], double *values,
                           int dim, double *derivs);

  // Description:
  // Find the boundary face closest to the point defined by the pcoords[3]
  // and subId of the cell (subId can be ignored).
  virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);

  // Description:
  // Return the center of the cell in parametric coordinates. In this cell,
  // the center of the bounding box is returned.
  virtual int GetParametricCenter(double pcoords[3]);

  // Description:
  // A polyhedron is a full-fledged primary cell.
  int IsPrimaryCell() {return 1;}

  // Description:
  // Compute the interpolation functions/derivatives
  // (aka shape functions/derivatives). Here we use the MVC calculation
  // process to compute the interpolation functions.
  virtual void InterpolateFunctions(double x[3], double *sf);
  virtual void InterpolateDerivs(double x[3], double *derivs);

  // Description:
  // Methods supporting the definition of faces. Note that the GetFaces()
  // returns a list of faces in vtkCellArray form; use the method
  // GetNumberOfFaces() to determine the number of faces in the list.
  // The SetFaces() method is also in vtkCellArray form, except that it
  // begins with a leading count indicating the total number of faces in 
  // the list.
  virtual int RequiresExplicitFaceRepresentation() {return 1;}
  virtual void SetFaces(vtkIdType *faces);
  virtual vtkIdType *GetFaces();

  // Descriprion:
  // A method particular to vtkPolyhedron. It determines whether a point x[3]
  // is inside the polyhedron or not (returns 1 is the point is inside, 0
  // otherwise). The tolerance is expressed in normalized space; i.e., a
  // fraction of the size of the bounding box.
  int IsInside(double x[3], double tolerance);

  // Description:
  // Construct polydata if no one exist, then return this->PolyData
  vtkPolyData* GetPolyData();
  
protected:
  vtkPolyhedron();
  ~vtkPolyhedron();

  // Internal classes for supporting operations on this cell
  vtkLine        *Line;
  vtkTriangle    *Triangle;
  vtkQuad        *Quad;
  vtkPolygon     *Polygon;
  vtkTetra       *Tetra;
  vtkIdTypeArray *GlobalFaces; //these are numbered in gloabl id space
  vtkIdTypeArray *FaceLocations;

  // vtkCell has the data members Points (x,y,z coordinates) and PointIds
  // (global cell ids corresponsing to cell canonical numbering (0,1,2,....)).
  // These data members are implicitly organized in canonical space, i.e., where
  // the cell point ids are (0,1,...,npts-1). The PointIdMap maps global point id 
  // back to these canonoical point ids.
  vtkPointIdMap  *PointIdMap;

  // If edges are needed. Note that the edge numbering is in
  // canonical space.
  int             EdgesGenerated; //true/false
  vtkEdgeTable   *EdgeTable; //keep track of all edges
  vtkIdTypeArray *Edges; //edge pairs kept in this list, in canonical id space
  int             GenerateEdges(); //method populates the edge table and edge array

  // If faces need renumbering into canonical numbering space these members
  // are used. When initiallly loaded, the face numbering uses global dataset
  // ids. Once renumbered, they are converted to canonical space.
  vtkIdTypeArray *Faces; //these are numbered in canonical id space
  int             FacesGenerated;
  void            GenerateFaces();

  // Bounds management
  int    BoundsComputed;
  void   ComputeBounds();
  void   ComputeParametricCoordinate(double x[3], double pc[3]);
  void   ComputePositionFromParametricCoordinate(double pc[3], double x[3]);

  // Members for supporting geometric operations
  int             PolyDataConstructed;
  vtkPolyData    *PolyData;
  vtkCellArray   *Polys;
  vtkIdTypeArray *PolyConnectivity;
  void            ConstructPolyData();
  int             LocatorConstructed;
  vtkCellLocator *CellLocator;
  void            ConstructLocator();
  vtkIdList      *CellIds;
  vtkGenericCell *Cell;

  // This is the internal implementation of contouring a polyhedron. It is used
  // by both Clip and Contour functions.
  int InternalContour(double value,
                      int insideOut,
                      vtkIncrementalPointLocator *locator,
                      vtkDataArray *inScalars, 
                      vtkDataArray *outScalars,
                      vtkPointData *inPd, 
                      vtkPointData *outPd,
                      vtkCellArray *contourPolys,
                      vtkIdToIdVectorMapType & faceToPointsMap,
                      vtkIdToIdVectorMapType & pointToFacesMap,
                      vtkIdToIdMapType & pointIdMap);


  // Check if the polyhedron cell intersect with the contour/clip function.
  // If intersect, return 0. Otherwise return 1 or -1 when the polyhedron cell
  // is on the positive or negative side of contour/clip function respectively.
  int IntersectWithContour(double value, 
                           int insideOut, 
                           vtkDataArray *inScalars);

private:
  vtkPolyhedron(const vtkPolyhedron&);  // Not implemented.
  void operator=(const vtkPolyhedron&);  // Not implemented.

  //BTX
  class vtkInternal;
  vtkInternal * Internal;
  //ETX
};

//----------------------------------------------------------------------------
inline int vtkPolyhedron::GetParametricCenter(double pcoords[3])
{
  pcoords[0] = pcoords[1] = pcoords[2] = 0.5;
  return 0;
}

#endif