VTK  9.1.0
vtkCell.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCell.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=========================================================================*/
126#ifndef vtkCell_h
127#define vtkCell_h
128
129#define VTK_CELL_SIZE 512
130#define VTK_TOL 1.e-05 // Tolerance for geometric calculation
131
132#include "vtkCommonDataModelModule.h" // For export macro
133#include "vtkObject.h"
134
135#include "vtkBoundingBox.h" // Needed for IntersectWithCell
136#include "vtkCellType.h" // Needed to define cell types
137#include "vtkIdList.h" // Needed for inline methods
138
139class vtkCellArray;
140class vtkCellData;
141class vtkDataArray;
142class vtkPointData;
144class vtkPoints;
145
146class VTKCOMMONDATAMODEL_EXPORT vtkCell : public vtkObject
147{
148public:
149 vtkTypeMacro(vtkCell, vtkObject);
150 void PrintSelf(ostream& os, vtkIndent indent) override;
151
156 void Initialize(int npts, const vtkIdType* pts, vtkPoints* p);
157
164 void Initialize(int npts, vtkPoints* p);
165
171 virtual void ShallowCopy(vtkCell* c);
172
177 virtual void DeepCopy(vtkCell* c);
178
182 virtual int GetCellType() = 0;
183
187 virtual int GetCellDimension() = 0;
188
194 virtual int IsLinear() { return 1; }
195
200 virtual int RequiresInitialization() { return 0; }
201 virtual void Initialize() {}
202
208 virtual int IsExplicitCell() { return 0; }
209
215 virtual int RequiresExplicitFaceRepresentation() { return 0; }
216 virtual void SetFaces(vtkIdType* vtkNotUsed(faces)) {}
217 virtual vtkIdType* GetFaces() { return nullptr; }
218
222 vtkPoints* GetPoints() { return this->Points; }
223
227 vtkIdType GetNumberOfPoints() const { return this->PointIds->GetNumberOfIds(); }
228
232 virtual int GetNumberOfEdges() = 0;
233
237 virtual int GetNumberOfFaces() = 0;
238
242 vtkIdList* GetPointIds() { return this->PointIds; }
243
247 vtkIdType GetPointId(int ptId) VTK_EXPECTS(0 <= ptId && ptId < GetPointIds()->GetNumberOfIds())
248 {
249 return this->PointIds->GetId(ptId);
250 }
251
255 virtual vtkCell* GetEdge(int edgeId) = 0;
256
268 virtual vtkCell* GetFace(int faceId) = 0;
269
277 virtual int CellBoundary(int subId, const double pcoords[3], vtkIdList* pts) = 0;
278
296 virtual int EvaluatePosition(const double x[3], double closestPoint[3], int& subId,
297 double pcoords[3], double& dist2, double weights[]) = 0;
298
304 virtual void EvaluateLocation(
305 int& subId, const double pcoords[3], double x[3], double* weights) = 0;
306
320 virtual void Contour(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
321 vtkCellArray* verts, vtkCellArray* lines, vtkCellArray* polys, vtkPointData* inPd,
322 vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd) = 0;
323
336 virtual void Clip(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
337 vtkCellArray* connectivity, vtkPointData* inPd, vtkPointData* outPd, vtkCellData* inCd,
338 vtkIdType cellId, vtkCellData* outCd, int insideOut) = 0;
339
353 virtual int Inflate(double dist);
354
363 virtual double ComputeBoundingSphere(double center[3]) const;
364
373 virtual int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t,
374 double x[3], double pcoords[3], int& subId) = 0;
375
377
384 virtual int IntersectWithCell(vtkCell* other, double tol = 0.0);
385 virtual int IntersectWithCell(vtkCell* other, const vtkBoundingBox& boudingBox,
386 const vtkBoundingBox& otherBoundingBox, double tol = 0.0);
388
399 virtual int Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts) = 0;
400
415 virtual void Derivatives(
416 int subId, const double pcoords[3], const double* values, int dim, double* derivs) = 0;
417
422 void GetBounds(double bounds[6]);
423
429
433 double GetLength2();
434
441 virtual int GetParametricCenter(double pcoords[3]);
442
450 virtual double GetParametricDistance(const double pcoords[3]);
451
459 virtual int IsPrimaryCell() { return 1; }
460
470 virtual double* GetParametricCoords() VTK_SIZEHINT(3 * GetNumberOfPoints());
471
477 virtual void InterpolateFunctions(const double vtkNotUsed(pcoords)[3], double* vtkNotUsed(weight))
478 {
479 }
480 virtual void InterpolateDerivs(const double vtkNotUsed(pcoords)[3], double* vtkNotUsed(derivs)) {}
481
482 // left public for quick computational access
485
486protected:
488 ~vtkCell() override;
489
490 double Bounds[6];
491
492private:
493 vtkCell(const vtkCell&) = delete;
494 void operator=(const vtkCell&) = delete;
495};
496
497#endif
Fast, simple class for representing and operating on 3D bounds.
object to represent cell connectivity
Definition: vtkCellArray.h:290
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
abstract class to specify cell behavior
Definition: vtkCell.h:147
virtual void SetFaces(vtkIdType *vtkNotUsed(faces))
Definition: vtkCell.h:216
virtual int GetNumberOfEdges()=0
Return the number of edges in the cell.
virtual void Derivatives(int subId, const double pcoords[3], const double *values, int dim, double *derivs)=0
Compute derivatives given cell subId and parametric coordinates.
virtual int EvaluatePosition(const double x[3], double closestPoint[3], int &subId, double pcoords[3], double &dist2, double weights[])=0
Given a point x[3] return inside(=1), outside(=0) cell, or (-1) computational problem encountered; ev...
vtkIdType GetPointId(int ptId)
For cell point i, return the actual point id.
Definition: vtkCell.h:247
virtual void Clip(double value, vtkDataArray *cellScalars, vtkIncrementalPointLocator *locator, vtkCellArray *connectivity, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, int insideOut)=0
Cut (or clip) the cell based on the input cellScalars and the specified value.
virtual int CellBoundary(int subId, const double pcoords[3], vtkIdList *pts)=0
Given parametric coordinates of a point, return the closest cell boundary, and whether the point is i...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int Inflate(double dist)
Inflates the cell.
vtkIdList * GetPointIds()
Return the list of point ids defining the cell.
Definition: vtkCell.h:242
virtual int GetCellDimension()=0
Return the topological dimensional of the cell (0,1,2, or 3).
virtual void Contour(double value, vtkDataArray *cellScalars, vtkIncrementalPointLocator *locator, vtkCellArray *verts, vtkCellArray *lines, vtkCellArray *polys, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd)=0
Generate contouring primitives.
virtual int GetNumberOfFaces()=0
Return the number of faces in the cell.
virtual void EvaluateLocation(int &subId, const double pcoords[3], double x[3], double *weights)=0
Determine global coordinate (x[3]) from subId and parametric coordinates.
void GetBounds(double bounds[6])
Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax).
virtual void ShallowCopy(vtkCell *c)
Copy this cell by reference counting the internal data structures.
virtual vtkCell * GetEdge(int edgeId)=0
Return the edge cell from the edgeId of the cell.
virtual int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId)=0
Intersect with a ray.
virtual double ComputeBoundingSphere(double center[3]) const
Computes the bounding sphere of the cell.
virtual int GetCellType()=0
Return the type of cell.
virtual void DeepCopy(vtkCell *c)
Copy this cell by completely copying internal data structures.
virtual int RequiresExplicitFaceRepresentation()
Determine whether the cell requires explicit face representation, and methods for setting and getting...
Definition: vtkCell.h:215
virtual vtkIdType * GetFaces()
Definition: vtkCell.h:217
virtual void Initialize()
Definition: vtkCell.h:201
void Initialize(int npts, vtkPoints *p)
Initialize the cell with point coordinates specified.
virtual int IntersectWithCell(vtkCell *other, const vtkBoundingBox &boudingBox, const vtkBoundingBox &otherBoundingBox, double tol=0.0)
Intersects with an other cell.
vtkPoints * GetPoints()
Get the point coordinates for the cell.
Definition: vtkCell.h:222
double * GetBounds()
Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax).
~vtkCell() override
virtual vtkCell * GetFace(int faceId)=0
Return the face cell from the faceId of the cell.
virtual int RequiresInitialization()
Some cells require initialization prior to access.
Definition: vtkCell.h:200
vtkPoints * Points
Definition: vtkCell.h:483
virtual int IsLinear()
Non-linear cells require special treatment beyond the usual cell type and connectivity list informati...
Definition: vtkCell.h:194
void Initialize(int npts, const vtkIdType *pts, vtkPoints *p)
Initialize cell from outside with point ids and point coordinates specified.
vtkIdList * PointIds
Definition: vtkCell.h:484
virtual int IntersectWithCell(vtkCell *other, double tol=0.0)
Intersects with an other cell.
virtual double * GetParametricCoords()
Return a contiguous array of parametric coordinates of the points defining this cell.
vtkIdType GetNumberOfPoints() const
Return the number of points in the cell.
Definition: vtkCell.h:227
virtual int IsExplicitCell()
Explicit cells require additional representational information beyond the usual cell type and connect...
Definition: vtkCell.h:208
virtual void InterpolateDerivs(const double vtkNotUsed(pcoords)[3], double *vtkNotUsed(derivs))
Definition: vtkCell.h:480
virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts)=0
Generate simplices of proper dimension.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
list of point or cell ids
Definition: vtkIdList.h:140
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract base class for most VTK objects
Definition: vtkObject.h:82
represent and manipulate point attribute data
Definition: vtkPointData.h:142
represent and manipulate 3D points
Definition: vtkPoints.h:143
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)
#define VTK_EXPECTS(x)