1 /*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkCubicLine.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 =========================================================================*/
15 // .NAME vtkCubicLine - cell represents a cubic , isoparametric 1D line
16 // .SECTION Description
17 // vtkCubicLine is a concrete implementation of vtkNonLinearCell to represent a 1D Cubic line.
18 // The Cubic Line is the 4 nodes isoparametric parabolic line . The
19 // interpolation is the standard finite element, cubic isoparametric
20 // shape function. The cell includes two mid-edge nodes. The ordering of the
21 // four points defining the cell is point ids (0,1,2,3) where id #2 and #3 are the
22 // mid-edge nodes. Please note that the parametric coordinates lie between -1 and 1
23 // in accordance with most standard documentations.
24 // .SECTION Thanks
25 // <verbatim>
26 // This file has been developed by Oxalya - www.oxalya.com
27 // Copyright (c) EDF - www.edf.fr
28 // </verbatim>
29
30
31 #ifndef vtkCubicLine_h
32 #define vtkCubicLine_h
33
34 #include "vtkCommonDataModelModule.h" // For export macro
35 #include "vtkNonLinearCell.h"
36
37 class vtkLine;
38 class vtkDoubleArray;
39
40 class VTKCOMMONDATAMODEL_EXPORT vtkCubicLine : public vtkNonLinearCell
41 {
42 public:
43 static vtkCubicLine *New();
44 vtkTypeMacro(vtkCubicLine,vtkNonLinearCell);
45 void PrintSelf(ostream& os, vtkIndent indent);
46
47 // Description:
48 // See the vtkCell API for descriptions of these methods.
GetCellType()49 int GetCellType() {return VTK_CUBIC_LINE;};
GetCellDimension()50 int GetCellDimension() {return 1;};
GetNumberOfEdges()51 int GetNumberOfEdges() {return 0;};
GetNumberOfFaces()52 int GetNumberOfFaces() {return 0;};
GetEdge(int)53 vtkCell *GetEdge(int) {return 0;};
GetFace(int)54 vtkCell *GetFace(int) {return 0;};
55 int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
56 void Contour(double value, vtkDataArray *cellScalars,
57 vtkIncrementalPointLocator *locator, vtkCellArray *verts,
58 vtkCellArray *lines, vtkCellArray *polys,
59 vtkPointData *inPd, vtkPointData *outPd,
60 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
61 int EvaluatePosition(double x[3], double* closestPoint,
62 int& subId, double pcoords[3],
63 double& dist2, double *weights);
64 void EvaluateLocation(int& subId, double pcoords[3], double x[3],
65 double *weights);
66 int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
67 void Derivatives(int subId, double pcoords[3], double *values,
68 int dim, double *derivs);
69 virtual double *GetParametricCoords();
70
71 // Description:
72 // Return the distance of the parametric coordinate provided to the
73 // cell. If inside the cell, a distance of zero is returned.
74 double GetParametricDistance(double pcoords[3]);
75
76 // Description:
77 // Clip this line using scalar value provided. Like contouring, except
78 // that it cuts the line to produce other lines.
79 void Clip(double value, vtkDataArray *cellScalars,
80 vtkIncrementalPointLocator *locator, vtkCellArray *lines,
81 vtkPointData *inPd, vtkPointData *outPd,
82 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
83 int insideOut);
84
85 // Description:
86 // Return the center of the triangle in parametric coordinates.
87 int GetParametricCenter(double pcoords[3]);
88
89 // Description:
90 // Line-line intersection. Intersection has to occur within [0,1] parametric
91 // coordinates and with specified tolerance.
92 int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
93 double x[3], double pcoords[3], int& subId);
94
95
96
97 // Description:
98 // @deprecated Replaced by vtkCubicLine::InterpolateFunctions as of VTK 5.2
99 static void InterpolationFunctions(double pcoords[3], double weights[4]);
100 // Description:
101 // @deprecated Replaced by vtkCubicLine::InterpolateDerivs as of VTK 5.2
102 static void InterpolationDerivs(double pcoords[3], double derivs[4]);
103 // Description:
104 // Compute the interpolation functions/derivatives
105 // (aka shape functions/derivatives)
InterpolateFunctions(double pcoords[3],double weights[4])106 virtual void InterpolateFunctions(double pcoords[3], double weights[4])
107 {
108 vtkCubicLine::InterpolationFunctions(pcoords,weights);
109 }
InterpolateDerivs(double pcoords[3],double derivs[4])110 virtual void InterpolateDerivs(double pcoords[3], double derivs[4])
111 {
112 vtkCubicLine::InterpolationDerivs(pcoords,derivs);
113 }
114
115 protected:
116 vtkCubicLine();
117 ~vtkCubicLine();
118
119 vtkLine *Line;
120 vtkDoubleArray *Scalars; //used to avoid New/Delete in contouring/clipping
121
122 private:
123 vtkCubicLine(const vtkCubicLine&); // Not implemented.
124 void operator=(const vtkCubicLine&); // Not implemented.
125 };
126
127 //----------------------------------------------------------------------------
GetParametricCenter(double pcoords[3])128 inline int vtkCubicLine::GetParametricCenter(double pcoords[3])
129 {
130
131 pcoords[0]=pcoords[1] = pcoords[2] = 0.0;
132 return 0;
133 }
134
135 #endif
136
137
138
139