VTK
vtkQuadraticPolygon.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkQuadraticPolygon.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 =========================================================================*/
33 #ifndef vtkQuadraticPolygon_h
34 #define vtkQuadraticPolygon_h
35 
36 #include "vtkCommonDataModelModule.h" // For export macro
37 #include "vtkNonLinearCell.h"
38 
39 class vtkQuadraticEdge;
40 class vtkPolygon;
41 class vtkIdTypeArray;
42 
43 class VTKCOMMONDATAMODEL_EXPORT vtkQuadraticPolygon : public vtkNonLinearCell
44 {
45 public:
46  static vtkQuadraticPolygon *New();
48  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
49 
54  int GetCellType() VTK_OVERRIDE { return VTK_QUADRATIC_POLYGON; }
55  int GetCellDimension() VTK_OVERRIDE { return 2;}
56  int GetNumberOfEdges() VTK_OVERRIDE { return this->GetNumberOfPoints() / 2; }
57  int GetNumberOfFaces() VTK_OVERRIDE { return 0; }
58  vtkCell *GetEdge(int) VTK_OVERRIDE;
59  vtkCell *GetFace(int) VTK_OVERRIDE { return 0; }
60  int IsPrimaryCell() VTK_OVERRIDE { return 0; }
61 
63 
69  int CellBoundary(int subId, double pcoords[3], vtkIdList *pts) VTK_OVERRIDE;
70  void Contour(double value, vtkDataArray *cellScalars,
72  vtkCellArray *lines, vtkCellArray *polys,
73  vtkPointData *inPd, vtkPointData *outPd,
74  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd) VTK_OVERRIDE;
75  void Clip(double value, vtkDataArray *cellScalars,
77  vtkPointData *inPd, vtkPointData *outPd,
78  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
79  int insideOut) VTK_OVERRIDE;
80  int EvaluatePosition(double x[3], double* closestPoint,
81  int& subId, double pcoords[3],
82  double& dist2, double *weights) VTK_OVERRIDE;
83  void EvaluateLocation(int& subId, double pcoords[3], double x[3],
84  double *weights) VTK_OVERRIDE;
85  int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
86  double x[3], double pcoords[3], int& subId) VTK_OVERRIDE;
87  void InterpolateFunctions(double x[3], double *weights) VTK_OVERRIDE;
88  static void ComputeCentroid(vtkIdTypeArray *ids, vtkPoints *pts,
89  double centroid[3]);
90  int ParameterizePolygon(double p0[3], double p10[3], double &l10,
91  double p20[3], double &l20, double n[3]);
92  static int PointInPolygon(double x[3], int numPts, double *pts,
93  double bounds[6], double n[3]);
94  int Triangulate(vtkIdList *outTris);
95  int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) VTK_OVERRIDE;
96  int NonDegenerateTriangulate(vtkIdList *outTris);
97  static double DistanceToPolygon(double x[3], int numPts, double *pts,
98  double bounds[6], double closest[3]);
99  static int IntersectPolygonWithPolygon(int npts, double *pts, double bounds[6],
100  int npts2, double *pts2,
101  double bounds2[3], double tol,
102  double x[3]);
103  static int IntersectConvex2DCells(vtkCell *cell1, vtkCell *cell2,
104  double tol, double p0[3], double p1[3]);
106 
107  // Not implemented
108  void Derivatives(int subId, double pcoords[3], double *values,
109  int dim, double *derivs) VTK_OVERRIDE;
110 
112 
118  vtkGetMacro(UseMVCInterpolation, bool);
119  vtkSetMacro(UseMVCInterpolation, bool);
121 
122 protected:
124  ~vtkQuadraticPolygon() VTK_OVERRIDE;
125 
126  // variables used by instances of this class
129 
130  // Parameter indicating whether to use Mean Value Coordinate algorithm
131  // for interpolation. The parameter is true by default.
133 
135 
139  static void GetPermutationFromPolygon(vtkIdType nb, vtkIdList *permutation);
140  static void PermuteToPolygon(vtkIdType nbPoints, double *inPoints, double *outPoints);
141  static void PermuteToPolygon(vtkCell *inCell, vtkCell *outCell);
142  static void PermuteToPolygon(vtkPoints *inPoints, vtkPoints *outPoints);
143  static void PermuteToPolygon(vtkIdTypeArray *inIds, vtkIdTypeArray *outIds);
144  static void PermuteToPolygon(vtkDataArray *inDataArray, vtkDataArray *outDataArray);
145  void InitializePolygon();
147 
149 
153  static void GetPermutationToPolygon(vtkIdType nb, vtkIdList *permutation);
154  static void PermuteFromPolygon(vtkIdType nb, double *values);
155  static void ConvertFromPolygon(vtkIdList *ids);
157 
158 private:
159  vtkQuadraticPolygon(const vtkQuadraticPolygon&) VTK_DELETE_FUNCTION;
160  void operator=(const vtkQuadraticPolygon&) VTK_DELETE_FUNCTION;
161 };
162 
163 #endif
vtkCell * GetFace(int) override
Return the face cell from the faceId of the cell.
vtkQuadraticEdge * Edge
vtkIdType GetNumberOfPoints()
Return the number of points in the cell.
Definition: vtkCell.h:137
represent and manipulate point attribute data
Definition: vtkPointData.h:31
virtual void InterpolateFunctions(double vtkNotUsed(pcoords)[3], double *vtkNotUsed(weight))
Compute the interpolation functions/derivatives (aka shape functions/derivatives) No-ops at this leve...
Definition: vtkCell.h:352
represent and manipulate cell attribute data
Definition: vtkCellData.h:32
Abstract class in support of both point location and point insertion.
virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts)=0
Generate simplices of proper dimension.
virtual void EvaluateLocation(int &subId, double pcoords[3], double x[3], double *weights)=0
Determine global coordinate (x[3]) from subId and parametric coordinates.
virtual int EvaluatePosition(double x[3], double *closestPoint, 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...
abstract superclass for non-linear cells
dynamic, self-adjusting array of vtkIdType
int vtkIdType
Definition: vtkType.h:345
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract class to specify cell behavior
Definition: vtkCell.h:56
a simple class to control print indentation
Definition: vtkIndent.h:33
list of point or cell ids
Definition: vtkIdList.h:30
virtual void Derivatives(int subId, double pcoords[3], double *values, int dim, double *derivs)=0
Compute derivatives given cell subId and parametric coordinates.
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
virtual int IntersectWithLine(double p1[3], double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId)=0
Intersect with a ray.
a cell that represents an n-sided polygon
Definition: vtkPolygon.h:39
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.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
object to represent cell connectivity
Definition: vtkCellArray.h:44
virtual vtkCell * GetEdge(int edgeId)=0
Return the edge cell from the edgeId of the cell.
a cell that represents a parabolic n-sided polygon
int GetCellType() override
Implement the vtkCell API.
cell represents a parabolic, isoparametric edge
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.
int GetNumberOfFaces() override
Return the number of faces in the cell.
virtual int CellBoundary(int subId, double pcoords[3], vtkIdList *pts)=0
Given parametric coordinates of a point, return the closest cell boundary, and whether the point is i...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
int IsPrimaryCell() override
Return whether this cell type has a fixed topology or whether the topology varies depending on the da...
int GetCellDimension() override
Return the topological dimensional of the cell (0,1,2, or 3).
represent and manipulate 3D points
Definition: vtkPoints.h:33
int GetNumberOfEdges() override
Return the number of edges in the cell.