VTK  9.7.1
vtkPixel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
16 #ifndef vtkPixel_h
17 #define vtkPixel_h
18 
19 #include "vtkCell.h"
20 #include "vtkCommonDataModelModule.h" // For export macro
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkLine;
25 
26 class VTKCOMMONDATAMODEL_EXPORT vtkPixel : public vtkCell
27 {
28 public:
29  static vtkPixel* New();
30  vtkTypeMacro(vtkPixel, vtkCell);
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
34 
37  int GetCellType() override { return VTK_PIXEL; }
38  int GetCellDimension() override { return 2; }
39  int GetNumberOfEdges() override { return 4; }
40  int GetNumberOfFaces() override { return 0; }
41  vtkCell* GetEdge(int edgeId) override;
42  vtkCell* GetFace(int) override { return nullptr; }
43  int CellBoundary(int subId, const double pcoords[3], vtkIdList* pts) override;
44  void Contour(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
45  vtkCellArray* verts, vtkCellArray* lines, vtkCellArray* polys, vtkPointData* inPd,
46  vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd) override;
47  void Clip(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
48  vtkCellArray* polys, vtkPointData* inPd, vtkPointData* outPd, vtkCellData* inCd,
49  vtkIdType cellId, vtkCellData* outCd, int insideOut) override;
50  int EvaluatePosition(const double x[3], double closestPoint[3], int& subId, double pcoords[3],
51  double& dist2, double weights[]) override;
52  void EvaluateLocation(int& subId, const double pcoords[3], double x[3], double* weights) override;
54 
67  int Inflate(double dist) override;
68 
72  double ComputeBoundingSphere(double center[3]) const override;
73 
77  int GetParametricCenter(double pcoords[3]) override;
78 
79  int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
80  double pcoords[3], int& subId) override;
81  int TriangulateLocalIds(int index, vtkIdList* ptIds) override;
82  void Derivatives(
83  int subId, const double pcoords[3], const double* values, int dim, double* derivs) override;
84  double* GetParametricCoords() override;
85 
86  static void InterpolationFunctions(const double pcoords[3], double weights[4]);
87  static void InterpolationDerivs(const double pcoords[3], double derivs[8]);
89 
93  void InterpolateFunctions(const double pcoords[3], double weights[4]) override
94  {
95  vtkPixel::InterpolationFunctions(pcoords, weights);
96  }
97  void InterpolateDerivs(const double pcoords[3], double derivs[8]) override
98  {
99  vtkPixel::InterpolationDerivs(pcoords, derivs);
100  }
102 
108  int ComputeNormal(double n[3]);
109 
114  static const vtkIdType* GetEdgeArray(vtkIdType edgeId);
115 
116 protected:
117  vtkPixel();
118  ~vtkPixel() override = default;
119 
121 
122 private:
123  vtkPixel(const vtkPixel&) = delete;
124  void operator=(const vtkPixel&) = delete;
125 };
126 
127 //----------------------------------------------------------------------------
128 inline int vtkPixel::GetParametricCenter(double pcoords[3])
129 {
130  pcoords[0] = pcoords[1] = 0.5;
131  pcoords[2] = 0.0;
132  return 0;
133 }
134 
135 VTK_ABI_NAMESPACE_END
136 #endif
vtkSmartPointer< vtkLine > Line
Definition: vtkPixel.h:120
vtkCell * GetFace(int) override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:42
int GetNumberOfEdges() override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:39
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
represent and manipulate point attribute data
Definition: vtkPointData.h:30
represent and manipulate cell attribute data
Definition: vtkCellData.h:31
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:26
Abstract class in support of both point location and point insertion.
int vtkIdType
Definition: vtkType.h:363
int GetCellType() override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:37
virtual double ComputeBoundingSphere(double center[3]) const
Computes the bounding sphere of the cell.
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...
cell represents a 1D line
Definition: vtkLine.h:22
abstract class to specify cell behavior
Definition: vtkCell.h:50
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 InterpolateDerivs(const double pcoords[3], double derivs[8]) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives) ...
Definition: vtkPixel.h:97
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int TriangulateLocalIds(int index, vtkIdList *ptIds)=0
Generate simplices of proper dimension.
list of point or cell ids
Definition: vtkIdList.h:25
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
virtual int Inflate(double dist)
Inflates the cell.
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.
int GetParametricCenter(double pcoords[3]) override
Return the center of the triangle in parametric coordinates.
Definition: vtkPixel.h:128
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...
object to represent cell connectivity
Definition: vtkCellArray.h:177
virtual vtkCell * GetEdge(int edgeId)=0
Return the edge cell from the edgeId of the cell.
static void InterpolationFunctions(const double pcoords[3], double weights[4])
static void InterpolationDerivs(const double pcoords[3], double derivs[8])
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 void Derivatives(int subId, const double pcoords[3], const double *values, int dim, double *derivs)=0
Compute derivatives given cell subId and parametric coordinates.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual double * GetParametricCoords())
Return a contiguous array of parametric coordinates of the points defining this cell.
virtual int GetParametricCenter(double pcoords[3])
Return center of the cell in parametric coordinates.
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.
int GetCellDimension() override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:38
void InterpolateFunctions(const double pcoords[3], double weights[4]) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives) ...
Definition: vtkPixel.h:93
int GetNumberOfFaces() override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:40