VTK  9.2.6
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=========================================================================*/
129#ifndef vtkCell_h
130#define vtkCell_h
131
132#define VTK_CELL_SIZE 512
133#define VTK_TOL 1.e-05 // Tolerance for geometric calculation
134
135#include "vtkCommonDataModelModule.h" // For export macro
136#include "vtkObject.h"
137
138#include "vtkBoundingBox.h" // Needed for IntersectWithCell
139#include "vtkCellType.h" // Needed to define cell types
140#include "vtkIdList.h" // Needed for inline methods
141
142class vtkCellArray;
143class vtkCellData;
144class vtkDataArray;
145class vtkPointData;
147class vtkPoints;
148
149class VTKCOMMONDATAMODEL_EXPORT vtkCell : public vtkObject
150{
151public:
152 vtkTypeMacro(vtkCell, vtkObject);
153 void PrintSelf(ostream& os, vtkIndent indent) override;
154
159 void Initialize(int npts, const vtkIdType* pts, vtkPoints* p);
160
167 void Initialize(int npts, vtkPoints* p);
168
174 virtual void ShallowCopy(vtkCell* c);
175
180 virtual void DeepCopy(vtkCell* c);
181
185 virtual int GetCellType() = 0;
186
190 virtual int GetCellDimension() = 0;
191
197 virtual int IsLinear() { return 1; }
198
203 virtual int RequiresInitialization() { return 0; }
204 virtual void Initialize() {}
205
211 virtual int IsExplicitCell() { return 0; }
212
218 virtual int RequiresExplicitFaceRepresentation() { return 0; }
219 virtual void SetFaces(vtkIdType* vtkNotUsed(faces)) {}
220 virtual vtkIdType* GetFaces() { return nullptr; }
221
225 vtkPoints* GetPoints() { return this->Points; }
226
230 vtkIdType GetNumberOfPoints() const { return this->PointIds->GetNumberOfIds(); }
231
235 virtual int GetNumberOfEdges() = 0;
236
240 virtual int GetNumberOfFaces() = 0;
241
245 vtkIdList* GetPointIds() { return this->PointIds; }
246
250 vtkIdType GetPointId(int ptId) VTK_EXPECTS(0 <= ptId && ptId < GetPointIds()->GetNumberOfIds())
251 {
252 return this->PointIds->GetId(ptId);
253 }
254
258 virtual vtkCell* GetEdge(int edgeId) = 0;
259
271 virtual vtkCell* GetFace(int faceId) = 0;
272
280 virtual int CellBoundary(int subId, const double pcoords[3], vtkIdList* pts) = 0;
281
299 virtual int EvaluatePosition(const double x[3], double closestPoint[3], int& subId,
300 double pcoords[3], double& dist2, double weights[]) = 0;
301
307 virtual void EvaluateLocation(
308 int& subId, const double pcoords[3], double x[3], double* weights) = 0;
309
323 virtual void Contour(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
324 vtkCellArray* verts, vtkCellArray* lines, vtkCellArray* polys, vtkPointData* inPd,
325 vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd) = 0;
326
339 virtual void Clip(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
340 vtkCellArray* connectivity, vtkPointData* inPd, vtkPointData* outPd, vtkCellData* inCd,
341 vtkIdType cellId, vtkCellData* outCd, int insideOut) = 0;
342
356 virtual int Inflate(double dist);
357
366 virtual double ComputeBoundingSphere(double center[3]) const;
367
376 virtual int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t,
377 double x[3], double pcoords[3], int& subId) = 0;
378
380
387 virtual int IntersectWithCell(vtkCell* other, double tol = 0.0);
388 virtual int IntersectWithCell(vtkCell* other, const vtkBoundingBox& boudingBox,
389 const vtkBoundingBox& otherBoundingBox, double tol = 0.0);
391
402 virtual int Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts) = 0;
403
418 virtual void Derivatives(
419 int subId, const double pcoords[3], const double* values, int dim, double* derivs) = 0;
420
425 void GetBounds(double bounds[6]);
426
432
436 double GetLength2();
437
444 virtual int GetParametricCenter(double pcoords[3]);
445
453 virtual double GetParametricDistance(const double pcoords[3]);
454
462 virtual int IsPrimaryCell() { return 1; }
463
473 virtual double* GetParametricCoords() VTK_SIZEHINT(3 * GetNumberOfPoints());
474
480 virtual void InterpolateFunctions(const double vtkNotUsed(pcoords)[3], double* vtkNotUsed(weight))
481 {
482 }
483 virtual void InterpolateDerivs(const double vtkNotUsed(pcoords)[3], double* vtkNotUsed(derivs)) {}
484
485 // left public for quick computational access
488
489protected:
491 ~vtkCell() override;
492
493 double Bounds[6];
494
495private:
496 vtkCell(const vtkCell&) = delete;
497 void operator=(const vtkCell&) = delete;
498};
499
500#endif
Fast, simple class for representing and operating on 3D bounds.
object to represent cell connectivity
Definition: vtkCellArray.h:296
represent and manipulate cell attribute data
Definition: vtkCellData.h:151
abstract class to specify cell behavior
Definition: vtkCell.h:150
virtual void SetFaces(vtkIdType *vtkNotUsed(faces))
Definition: vtkCell.h:219
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:250
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:245
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:218
virtual vtkIdType * GetFaces()
Definition: vtkCell.h:220
virtual void Initialize()
Definition: vtkCell.h:204
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:225
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:203
vtkPoints * Points
Definition: vtkCell.h:486
virtual int IsLinear()
Non-linear cells require special treatment beyond the usual cell type and connectivity list informati...
Definition: vtkCell.h:197
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:487
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:230
virtual int IsExplicitCell()
Explicit cells require additional representational information beyond the usual cell type and connect...
Definition: vtkCell.h:211
virtual void InterpolateDerivs(const double vtkNotUsed(pcoords)[3], double *vtkNotUsed(derivs))
Definition: vtkCell.h:483
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:165
list of point or cell ids
Definition: vtkIdList.h:143
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract base class for most VTK objects
Definition: vtkObject.h:82
represent and manipulate point attribute data
Definition: vtkPointData.h:151
represent and manipulate 3D points
Definition: vtkPoints.h:149
@ value
Definition: vtkX3D.h:226
@ center
Definition: vtkX3D.h:236
@ weight
Definition: vtkX3D.h:538
@ index
Definition: vtkX3D.h:252
int vtkIdType
Definition: vtkType.h:332
#define VTK_SIZEHINT(...)
#define VTK_EXPECTS(x)