VTK  9.2.6
vtkPolyhedron.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkPolyhedron.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
37
38#ifndef vtkPolyhedron_h
39#define vtkPolyhedron_h
40
41#include "vtkCell3D.h"
42#include "vtkCommonDataModelModule.h" // For export macro
43
44class vtkIdTypeArray;
45class vtkCellArray;
46class vtkTriangle;
47class vtkQuad;
48class vtkTetra;
49class vtkPolygon;
50class vtkLine;
51class vtkPointIdMap;
52class vtkIdToIdVectorMapType;
53class vtkIdToIdMapType;
54class vtkEdgeTable;
55class vtkPolyData;
56class vtkCellLocator;
57class vtkGenericCell;
58class vtkPointLocator;
59
60class VTKCOMMONDATAMODEL_EXPORT vtkPolyhedron : public vtkCell3D
61{
62public:
64
67 static vtkPolyhedron* New();
68 vtkTypeMacro(vtkPolyhedron, vtkCell3D);
69 void PrintSelf(ostream& os, vtkIndent indent) override;
71
73
77 void GetEdgePoints(vtkIdType vtkNotUsed(edgeId), const vtkIdType*& vtkNotUsed(pts)) override
78 {
79 vtkWarningMacro(<< "vtkPolyhedron::GetEdgePoints Not Implemented");
80 }
81 vtkIdType GetFacePoints(vtkIdType vtkNotUsed(faceId), const vtkIdType*& vtkNotUsed(pts)) override
82 {
83 vtkWarningMacro(<< "vtkPolyhedron::GetFacePoints Not Implemented");
84 return 0;
85 }
87 vtkIdType vtkNotUsed(edgeId), const vtkIdType*& vtkNotUsed(pts)) override
88 {
89 vtkWarningMacro(<< "vtkPolyhedron::GetEdgeToAdjacentFaces Not Implemented");
90 }
92 vtkIdType vtkNotUsed(faceId), const vtkIdType*& vtkNotUsed(faceIds)) override
93 {
94 vtkWarningMacro(<< "vtkPolyhedron::GetFaceToAdjacentFaces Not Implemented");
95 return 0;
96 }
98 vtkIdType vtkNotUsed(pointId), const vtkIdType*& vtkNotUsed(edgeIds)) override
99 {
100 vtkWarningMacro(<< "vtkPolyhedron::GetPointToIncidentEdges Not Implemented");
101 return 0;
102 }
103 vtkIdType GetPointToIncidentFaces(vtkIdType pointId, const vtkIdType*& faceIds) override;
105 vtkIdType vtkNotUsed(pointId), const vtkIdType*& vtkNotUsed(pts)) override
106 {
107 vtkWarningMacro(<< "vtkPolyhedron::GetPointToOneRingPoints Not Implemented");
108 return 0;
109 }
110 bool GetCentroid(double vtkNotUsed(centroid)[3]) const override
111 {
112 vtkWarningMacro(<< "vtkPolyhedron::GetCentroid Not Implemented");
113 return false;
114 }
115
116
120 double* GetParametricCoords() override;
121
125 int GetCellType() override { return VTK_POLYHEDRON; }
126
130 int RequiresInitialization() override { return 1; }
131 void Initialize() override;
132
134
138 int GetNumberOfEdges() override;
139 vtkCell* GetEdge(int) override;
140 int GetNumberOfFaces() override;
141 vtkCell* GetFace(int faceId) override;
143
149 void Contour(double value, vtkDataArray* scalars, vtkIncrementalPointLocator* locator,
150 vtkCellArray* verts, vtkCellArray* lines, vtkCellArray* polys, vtkPointData* inPd,
151 vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd) override;
152
162 void Clip(double value, vtkDataArray* scalars, vtkIncrementalPointLocator* locator,
163 vtkCellArray* connectivity, vtkPointData* inPd, vtkPointData* outPd, vtkCellData* inCd,
164 vtkIdType cellId, vtkCellData* outCd, int insideOut) override;
165
173 int EvaluatePosition(const double x[3], double closestPoint[3], int& subId, double pcoords[3],
174 double& dist2, double weights[]) override;
175
180 void EvaluateLocation(int& subId, const double pcoords[3], double x[3], double* weights) override;
181
188 int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
189 double pcoords[3], int& subId) override;
190
206 int Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts) override;
207
216 int subId, const double pcoords[3], const double* values, int dim, double* derivs) override;
217
222 int CellBoundary(int subId, const double pcoords[3], vtkIdList* pts) override;
223
228 int GetParametricCenter(double pcoords[3]) override;
229
233 int IsPrimaryCell() override { return 1; }
234
236
241 void InterpolateFunctions(const double x[3], double* sf) override;
242 void InterpolateDerivs(const double x[3], double* derivs) override;
244
246
254 int RequiresExplicitFaceRepresentation() override { return 1; }
255 void SetFaces(vtkIdType* faces) override;
256 vtkIdType* GetFaces() override;
258
265 int IsInside(const double x[3], double tolerance);
266
273 bool IsConvex();
274
279
280protected:
282 ~vtkPolyhedron() override;
283
284 // Internal classes for supporting operations on this cell
290 vtkIdTypeArray* GlobalFaces; // these are numbered in global id space
292
293 // vtkCell has the data members Points (x,y,z coordinates) and PointIds
294 // (global cell ids corresponding to cell canonical numbering (0,1,2,....)).
295 // These data members are implicitly organized in canonical space, i.e., where
296 // the cell point ids are (0,1,...,npts-1). The PointIdMap maps global point id
297 // back to these canonoical point ids.
298 vtkPointIdMap* PointIdMap;
299
300 // If edges are needed. Note that the edge numbering is in
301 // canonical space.
302 int EdgesGenerated; // true/false
303 vtkEdgeTable* EdgeTable; // keep track of all edges
304 vtkIdTypeArray* Edges; // edge pairs kept in this list, in canonical id space
305 vtkIdTypeArray* EdgeFaces; // face pairs that comprise each edge, with the
306 // same ordering as EdgeTable
307 int GenerateEdges(); // method populates the edge table and edge array
308
309 // If faces need renumbering into canonical numbering space these members
310 // are used. When initiallly loaded, the face numbering uses global dataset
311 // ids. Once renumbered, they are converted to canonical space.
312 vtkIdTypeArray* Faces; // these are numbered in canonical id space
315
316 // Bounds management
319 void ComputeParametricCoordinate(const double x[3], double pc[3]);
320 void ComputePositionFromParametricCoordinate(const double pc[3], double x[3]);
321
323
324 // Members for supporting geometric operations
334
335 // Members used in GetPointToIncidentFaces
338
339private:
340 vtkPolyhedron(const vtkPolyhedron&) = delete;
341 void operator=(const vtkPolyhedron&) = delete;
342};
343
344//----------------------------------------------------------------------------
345inline int vtkPolyhedron::GetParametricCenter(double pcoords[3])
346{
347 pcoords[0] = pcoords[1] = pcoords[2] = 0.5;
348 return 0;
349}
350
351#endif
object to represent cell connectivity
represent and manipulate cell attribute data
Definition vtkCellData.h:42
octree-based spatial search object to quickly locate cells
virtual int GetParametricCenter(double pcoords[3])
Return center of the cell in parametric coordinates.
keep track of edges (edge is pair of integer id's)
provides thread-safe access to cells
list of point or cell ids
Definition vtkIdList.h:34
dynamic, self-adjusting array of vtkIdType
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition vtkIndent.h:40
cell represents a 1D line
Definition vtkLine.h:34
represent and manipulate point attribute data
quickly locate points in 3-space
represent and manipulate 3D points
Definition vtkPoints.h:40
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
a cell that represents an n-sided polygon
Definition vtkPolygon.h:43
vtkIdType GetFacePoints(vtkIdType vtkNotUsed(faceId), const vtkIdType *&vtkNotUsed(pts)) override
See vtkCell3D API for description of these methods.
vtkIdType GetPointToIncidentFaces(vtkIdType pointId, const vtkIdType *&faceIds) override
See vtkCell3D API for description of these methods.
vtkPointIdMap * PointIdMap
int RequiresExplicitFaceRepresentation() override
Methods supporting the definition of faces.
vtkIdList * CellIds
int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) override
Use vtkOrderedTriangulator to tetrahedralize the polyhedron mesh.
int GenerateEdges()
int GetNumberOfFaces() override
A polyhedron is represented internally by a set of polygonal faces.
void SetFaces(vtkIdType *faces) override
Methods supporting the definition of faces.
int EvaluatePosition(const double x[3], double closestPoint[3], int &subId, double pcoords[3], double &dist2, double weights[]) override
Satisfy the vtkCell API.
int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId) override
Intersect the line (p1,p2) with a given tolerance tol to determine a point of intersection x[3] with ...
~vtkPolyhedron() override
void GenerateFaces()
vtkIdType GetPointToIncidentEdges(vtkIdType vtkNotUsed(pointId), const vtkIdType *&vtkNotUsed(edgeIds)) override
See vtkCell3D API for description of these methods.
void ComputeParametricCoordinate(const double x[3], double pc[3])
vtkIdType * ValenceAtPoint
vtkEdgeTable * EdgeTable
void ComputeBounds()
void GetEdgeToAdjacentFaces(vtkIdType vtkNotUsed(edgeId), const vtkIdType *&vtkNotUsed(pts)) override
See vtkCell3D API for description of these methods.
vtkIdType GetPointToOneRingPoints(vtkIdType vtkNotUsed(pointId), const vtkIdType *&vtkNotUsed(pts)) override
See vtkCell3D API for description of these methods.
vtkIdType GetFaceToAdjacentFaces(vtkIdType vtkNotUsed(faceId), const vtkIdType *&vtkNotUsed(faceIds)) override
See vtkCell3D API for description of these methods.
void GetEdgePoints(vtkIdType vtkNotUsed(edgeId), const vtkIdType *&vtkNotUsed(pts)) override
See vtkCell3D API for description of these methods.
vtkPolygon * Polygon
void EvaluateLocation(int &subId, const double pcoords[3], double x[3], double *weights) override
The inverse of EvaluatePosition.
void InterpolateFunctions(const double x[3], double *sf) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives).
vtkCellLocator * CellLocator
void Contour(double value, vtkDataArray *scalars, vtkIncrementalPointLocator *locator, vtkCellArray *verts, vtkCellArray *lines, vtkCellArray *polys, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd) override
Satisfy the vtkCell API.
int IsInside(const double x[3], double tolerance)
A method particular to vtkPolyhedron.
vtkIdTypeArray * EdgeFaces
vtkTriangle * Triangle
int GetParametricCenter(double pcoords[3]) override
Return the center of the cell in parametric coordinates.
vtkIdTypeArray * GlobalFaces
double * GetParametricCoords() override
See vtkCell3D API for description of this method.
vtkIdTypeArray * Edges
void InterpolateDerivs(const double x[3], double *derivs) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives).
bool IsConvex()
Determine whether or not a polyhedron is convex.
void ConstructPolyData()
vtkIdType ** PointToIncidentFaces
int GetNumberOfEdges() override
A polyhedron is represented internally by a set of polygonal faces.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard new methods.
void GeneratePointToIncidentFacesAndValenceAtPoint()
vtkIdTypeArray * Faces
vtkPolyData * PolyData
int IsPrimaryCell() override
A polyhedron is a full-fledged primary cell.
vtkPolyData * GetPolyData()
Construct polydata if no one exist, then return this->PolyData.
vtkCell * GetEdge(int) override
A polyhedron is represented internally by a set of polygonal faces.
vtkTetra * Tetra
vtkCell * GetFace(int faceId) override
A polyhedron is represented internally by a set of polygonal faces.
void ConstructLocator()
void Derivatives(int subId, const double pcoords[3], const double *values, int dim, double *derivs) override
Computes derivatives at the point specified by the parameter coordinate.
bool GetCentroid(double vtkNotUsed(centroid)[3]) const override
See vtkCell3D API for description of these methods.
vtkIdType * GetFaces() override
Methods supporting the definition of faces.
int RequiresInitialization() override
This cell requires that it be initialized prior to access.
vtkGenericCell * Cell
void ComputePositionFromParametricCoordinate(const double pc[3], double x[3])
static vtkPolyhedron * New()
Standard new methods.
vtkCellArray * Polys
int GetCellType() override
See the vtkCell API for descriptions of these methods.
int CellBoundary(int subId, const double pcoords[3], vtkIdList *pts) override
Find the boundary face closest to the point defined by the pcoords[3] and subId of the cell (subId ca...
vtkIdTypeArray * FaceLocations
void Clip(double value, vtkDataArray *scalars, vtkIncrementalPointLocator *locator, vtkCellArray *connectivity, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, int insideOut) override
Satisfy the vtkCell API.
void Initialize() override
a cell that represents a 2D quadrilateral
Definition vtkQuad.h:39
a 3D cell that represents a tetrahedron
Definition vtkTetra.h:45
a cell that represents a triangle
Definition vtkTriangle.h:39
@ VTK_POLYHEDRON
Definition vtkCellType.h:89
#define vtkDataArray
int vtkIdType
Definition vtkType.h:332