VTK  9.3.0
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
25 #ifndef vtkPixel_h
26 #define vtkPixel_h
27 
28 #include "vtkCell.h"
29 #include "vtkCommonDataModelModule.h" // For export macro
30 
31 VTK_ABI_NAMESPACE_BEGIN
32 class vtkLine;
34 
35 class VTKCOMMONDATAMODEL_EXPORT vtkPixel : public vtkCell
36 {
37 public:
38  static vtkPixel* New();
39  vtkTypeMacro(vtkPixel, vtkCell);
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43 
46  int GetCellType() override { return VTK_PIXEL; }
47  int GetCellDimension() override { return 2; }
48  int GetNumberOfEdges() override { return 4; }
49  int GetNumberOfFaces() override { return 0; }
50  vtkCell* GetEdge(int edgeId) override;
51  vtkCell* GetFace(int) override { return nullptr; }
52  int CellBoundary(int subId, const double pcoords[3], vtkIdList* pts) override;
53  void Contour(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
54  vtkCellArray* verts, vtkCellArray* lines, vtkCellArray* polys, vtkPointData* inPd,
55  vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd) override;
56  void Clip(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
57  vtkCellArray* polys, vtkPointData* inPd, vtkPointData* outPd, vtkCellData* inCd,
58  vtkIdType cellId, vtkCellData* outCd, int insideOut) override;
59  int EvaluatePosition(const double x[3], double closestPoint[3], int& subId, double pcoords[3],
60  double& dist2, double weights[]) override;
61  void EvaluateLocation(int& subId, const double pcoords[3], double x[3], double* weights) override;
63 
76  int Inflate(double dist) override;
77 
81  double ComputeBoundingSphere(double center[3]) const override;
82 
86  int GetParametricCenter(double pcoords[3]) override;
87 
88  int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
89  double pcoords[3], int& subId) override;
90  int Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts) override;
92  int subId, const double pcoords[3], const double* values, int dim, double* derivs) override;
93  double* GetParametricCoords() override;
94 
95  static void InterpolationFunctions(const double pcoords[3], double weights[4]);
96  static void InterpolationDerivs(const double pcoords[3], double derivs[8]);
98 
102  void InterpolateFunctions(const double pcoords[3], double weights[4]) override
103  {
104  vtkPixel::InterpolationFunctions(pcoords, weights);
105  }
106  void InterpolateDerivs(const double pcoords[3], double derivs[8]) override
107  {
108  vtkPixel::InterpolationDerivs(pcoords, derivs);
109  }
111 
117  int ComputeNormal(double n[3]);
118 
119 protected:
121  ~vtkPixel() override;
122 
124 
125 private:
126  vtkPixel(const vtkPixel&) = delete;
127  void operator=(const vtkPixel&) = delete;
128 };
129 
130 //----------------------------------------------------------------------------
131 inline int vtkPixel::GetParametricCenter(double pcoords[3])
132 {
133  pcoords[0] = pcoords[1] = 0.5;
134  pcoords[2] = 0.0;
135  return 0;
136 }
137 
138 VTK_ABI_NAMESPACE_END
139 #endif
object to represent cell connectivity
Definition: vtkCellArray.h:185
represent and manipulate cell attribute data
Definition: vtkCellData.h:40
abstract class to specify cell behavior
Definition: vtkCell.h:59
virtual int GetParametricCenter(double pcoords[3])
Return center of the cell in parametric coordinates.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
list of point or cell ids
Definition: vtkIdList.h:32
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition: vtkIndent.h:38
cell represents a 1D line
Definition: vtkLine.h:32
a cell that represents an orthogonal quadrilateral
Definition: vtkPixel.h:36
int GetCellType() override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:46
void InterpolateDerivs(const double pcoords[3], double derivs[8]) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives)
Definition: vtkPixel.h:106
int ComputeNormal(double n[3])
vtkPixel's normal cannot be computed using vtkPolygon::ComputeNormal because its points are not sorte...
int CellBoundary(int subId, const double pcoords[3], vtkIdList *pts) override
See the vtkCell API for descriptions of these methods.
int GetNumberOfEdges() override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:48
void InterpolateFunctions(const double pcoords[3], double weights[4]) override
Compute the interpolation functions/derivatives (aka shape functions/derivatives)
Definition: vtkPixel.h:102
int GetNumberOfFaces() override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:49
static void InterpolationDerivs(const double pcoords[3], double derivs[8])
int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId) override
Intersect with a ray.
int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) override
Generate simplices of proper dimension.
double ComputeBoundingSphere(double center[3]) const override
Computes exact bounding sphere of this pixel.
void EvaluateLocation(int &subId, const double pcoords[3], double x[3], double *weights) override
See the vtkCell API for descriptions of these methods.
int GetParametricCenter(double pcoords[3]) override
Return the center of the triangle in parametric coordinates.
Definition: vtkPixel.h:131
int GetCellDimension() override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:47
int Inflate(double dist) override
Inflates this pixel by a distance of dist by moving the edges of the pixel by that distance.
~vtkPixel() override
vtkLine * Line
Definition: vtkPixel.h:123
void Derivatives(int subId, const double pcoords[3], const double *values, int dim, double *derivs) override
Compute derivatives given cell subId and parametric coordinates.
static void InterpolationFunctions(const double pcoords[3], double weights[4])
static vtkPixel * New()
void Contour(double value, vtkDataArray *cellScalars, vtkIncrementalPointLocator *locator, vtkCellArray *verts, vtkCellArray *lines, vtkCellArray *polys, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd) override
See the vtkCell API for descriptions of these methods.
void Clip(double value, vtkDataArray *cellScalars, vtkIncrementalPointLocator *locator, vtkCellArray *polys, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, int insideOut) override
See the vtkCell API for descriptions of these methods.
double * GetParametricCoords() override
Return a contiguous array of parametric coordinates of the points defining this cell.
int EvaluatePosition(const double x[3], double closestPoint[3], int &subId, double pcoords[3], double &dist2, double weights[]) override
See the vtkCell API for descriptions of these methods.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCell * GetFace(int) override
See the vtkCell API for descriptions of these methods.
Definition: vtkPixel.h:51
vtkCell * GetEdge(int edgeId) override
See the vtkCell API for descriptions of these methods.
represent and manipulate point attribute data
Definition: vtkPointData.h:39
represent and manipulate 3D points
Definition: vtkPoints.h:38
@ value
Definition: vtkX3D.h:220
@ center
Definition: vtkX3D.h:230
@ index
Definition: vtkX3D.h:246
@ VTK_PIXEL
Definition: vtkCellType.h:54
int vtkIdType
Definition: vtkType.h:315