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 
139 class vtkCellArray;
140 class vtkCellData;
141 class vtkDataArray;
142 class vtkPointData;
144 class vtkPoints;
145 
146 class VTKCOMMONDATAMODEL_EXPORT vtkCell : public vtkObject
147 {
148 public:
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 
428  double* GetBounds() VTK_SIZEHINT(6);
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 
486 protected:
488  ~vtkCell() override;
489 
490  double Bounds[6];
491 
492 private:
493  vtkCell(const vtkCell&) = delete;
494  void operator=(const vtkCell&) = delete;
495 };
496 
497 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkCell::IntersectWithLine
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.
vtkCell::GetBounds
double * GetBounds()
Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax).
vtkCell::DeepCopy
virtual void DeepCopy(vtkCell *c)
Copy this cell by completely copying internal data structures.
vtkCell::Contour
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.
vtkCell::ShallowCopy
virtual void ShallowCopy(vtkCell *c)
Copy this cell by reference counting the internal data structures.
VTK_EXPECTS
#define VTK_EXPECTS(x)
Definition: vtkWrappingHints.h:47
vtkPointData
represent and manipulate point attribute data
Definition: vtkPointData.h:142
vtkX3D::value
@ value
Definition: vtkX3D.h:226
vtkCell::RequiresExplicitFaceRepresentation
virtual int RequiresExplicitFaceRepresentation()
Determine whether the cell requires explicit face representation, and methods for setting and getting...
Definition: vtkCell.h:215
vtkIdType
int vtkIdType
Definition: vtkType.h:332
vtkCell::Points
vtkPoints * Points
Definition: vtkCell.h:483
vtkCell::GetCellDimension
virtual int GetCellDimension()=0
Return the topological dimensional of the cell (0,1,2, or 3).
vtkCell::Initialize
virtual void Initialize()
Definition: vtkCell.h:201
vtkX3D::weight
@ weight
Definition: vtkX3D.h:538
vtkCell::Initialize
void Initialize(int npts, const vtkIdType *pts, vtkPoints *p)
Initialize cell from outside with point ids and point coordinates specified.
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:82
vtkX3D::center
@ center
Definition: vtkX3D.h:236
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:159
vtkCell::GetCellType
virtual int GetCellType()=0
Return the type of cell.
vtkCell::EvaluateLocation
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.
vtkCell::Initialize
void Initialize(int npts, vtkPoints *p)
Initialize the cell with point coordinates specified.
vtkCell::IsLinear
virtual int IsLinear()
Non-linear cells require special treatment beyond the usual cell type and connectivity list informati...
Definition: vtkCell.h:194
vtkCell::~vtkCell
~vtkCell() override
vtkBoundingBox
Fast, simple class for representing and operating on 3D bounds.
Definition: vtkBoundingBox.h:66
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkCell::Triangulate
virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts)=0
Generate simplices of proper dimension.
vtkCell::GetPointIds
vtkIdList * GetPointIds()
Return the list of point ids defining the cell.
Definition: vtkCell.h:242
vtkCell::GetFaces
virtual vtkIdType * GetFaces()
Definition: vtkCell.h:217
vtkCell::IntersectWithCell
virtual int IntersectWithCell(vtkCell *other, double tol=0.0)
Intersects with an other cell.
vtkCell::GetBounds
void GetBounds(double bounds[6])
Compute cell bounding box (xmin,xmax,ymin,ymax,zmin,zmax).
vtkCell
abstract class to specify cell behavior
Definition: vtkCell.h:147
vtkCellData
represent and manipulate cell attribute data
Definition: vtkCellData.h:142
vtkCell::GetFace
virtual vtkCell * GetFace(int faceId)=0
Return the face cell from the faceId of the cell.
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkCell::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCell::Inflate
virtual int Inflate(double dist)
Inflates the cell.
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:290
vtkCellType.h
vtkIncrementalPointLocator
Abstract class in support of both point location and point insertion.
Definition: vtkIncrementalPointLocator.h:52
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:140
vtkCell::GetNumberOfEdges
virtual int GetNumberOfEdges()=0
Return the number of edges in the cell.
vtkCell::GetNumberOfFaces
virtual int GetNumberOfFaces()=0
Return the number of faces in the cell.
vtkCell::IsExplicitCell
virtual int IsExplicitCell()
Explicit cells require additional representational information beyond the usual cell type and connect...
Definition: vtkCell.h:208
vtkBoundingBox.h
vtkObject.h
vtkCell::RequiresInitialization
virtual int RequiresInitialization()
Some cells require initialization prior to access.
Definition: vtkCell.h:200
vtkCell::CellBoundary
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...
vtkCell::InterpolateDerivs
virtual void InterpolateDerivs(const double vtkNotUsed(pcoords)[3], double *vtkNotUsed(derivs))
Definition: vtkCell.h:480
vtkCell::SetFaces
virtual void SetFaces(vtkIdType *vtkNotUsed(faces))
Definition: vtkCell.h:216
vtkCell::EvaluatePosition
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...
vtkCell::PointIds
vtkIdList * PointIds
Definition: vtkCell.h:484
vtkCell::GetParametricCoords
virtual double * GetParametricCoords())
Return a contiguous array of parametric coordinates of the points defining this cell.
vtkCell::IntersectWithCell
virtual int IntersectWithCell(vtkCell *other, const vtkBoundingBox &boudingBox, const vtkBoundingBox &otherBoundingBox, double tol=0.0)
Intersects with an other cell.
vtkCell::Clip
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.
vtkCell::GetEdge
virtual vtkCell * GetEdge(int edgeId)=0
Return the edge cell from the edgeId of the cell.
vtkCell::GetPointId
vtkIdType GetPointId(int ptId)
For cell point i, return the actual point id.
Definition: vtkCell.h:247
vtkCell::Derivatives
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.
vtkCell::ComputeBoundingSphere
virtual double ComputeBoundingSphere(double center[3]) const
Computes the bounding sphere of the cell.
vtkCell::GetNumberOfPoints
vtkIdType GetNumberOfPoints() const
Return the number of points in the cell.
Definition: vtkCell.h:227
vtkCell::GetPoints
vtkPoints * GetPoints()
Get the point coordinates for the cell.
Definition: vtkCell.h:222
vtkX3D::index
@ index
Definition: vtkX3D.h:252
vtkIdList.h
vtkCell::vtkCell
vtkCell()