VTK
vtkLine.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkLine.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 =========================================================================*/
27 #ifndef __vtkLine_h
28 #define __vtkLine_h
29 
30 #include "vtkCell.h"
32 
34 {
35 public:
36  static vtkLine *New();
37  vtkTypeMacro(vtkLine,vtkCell);
38  void PrintSelf(ostream& os, vtkIndent indent);
39 
41 
42  int GetCellType() {return VTK_LINE;};
43  int GetCellDimension() {return 1;};
44  int GetNumberOfEdges() {return 0;};
45  int GetNumberOfFaces() {return 0;};
46  vtkCell *GetEdge(int) {return 0;};
47  vtkCell *GetFace(int) {return 0;};
48  int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
49  void Contour(double value, vtkDataArray *cellScalars,
51  vtkCellArray *lines, vtkCellArray *polys,
52  vtkPointData *inPd, vtkPointData *outPd,
53  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
54  int EvaluatePosition(double x[3], double* closestPoint,
55  int& subId, double pcoords[3],
56  double& dist2, double *weights);
57  void EvaluateLocation(int& subId, double pcoords[3], double x[3],
58  double *weights);
59  int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
60  void Derivatives(int subId, double pcoords[3], double *values,
61  int dim, double *derivs);
62  virtual double *GetParametricCoords();
64 
66 
68  void Clip(double value, vtkDataArray *cellScalars,
70  vtkPointData *inPd, vtkPointData *outPd,
71  vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
72  int insideOut);
74 
76  int GetParametricCenter(double pcoords[3]);
77 
79 
81  int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
82  double x[3], double pcoords[3], int& subId);
84 
85 
87 
92  static int Intersection(double p1[3], double p2[3],
93  double x1[3], double x2[3],
94  double& u, double& v);
96 
97 
99 
105  static double DistanceToLine(double x[3], double p1[3], double p2[3],
106  double &t, double closestPoint[3]);
108 
109 
113  static double DistanceToLine(double x[3], double p1[3], double p2[3]);
114 
116 
122  static double DistanceBetweenLines(
123  double l0[3], double l1[3],
124  double m0[3], double m1[3],
125  double closestPt1[3], double closestPt2[3],
126  double &t1, double &t2 );
128 
130 
136  static double DistanceBetweenLineSegments(
137  double l0[3], double l1[3],
138  double m0[3], double m1[3],
139  double closestPt1[3], double closestPt2[3],
140  double &t1, double &t2 );
142 
144 
145  static void InterpolationFunctions(double pcoords[3], double weights[2]);
146  // Description:
147  // @deprecated Replaced by vtkLine::InterpolateDerivs as of VTK 5.2
148  static void InterpolationDerivs(double pcoords[3], double derivs[2]);
149  // Description:
150  // Compute the interpolation functions/derivatives
151  // (aka shape functions/derivatives)
152  virtual void InterpolateFunctions(double pcoords[3], double weights[2])
153  {
154  vtkLine::InterpolationFunctions(pcoords,weights);
155  }
156  virtual void InterpolateDerivs(double pcoords[3], double derivs[2])
157  {
158  vtkLine::InterpolationDerivs(pcoords,derivs);
159  }
161 
162 protected:
163  vtkLine();
164  ~vtkLine() {};
165 
166 private:
167  vtkLine(const vtkLine&); // Not implemented.
168  void operator=(const vtkLine&); // Not implemented.
169 };
170 
171 //----------------------------------------------------------------------------
172 inline int vtkLine::GetParametricCenter(double pcoords[3])
173 {
174  pcoords[0] = 0.5;
175  pcoords[1] = pcoords[2] = 0.0;
176  return 0;
177 }
178 
179 #endif
180 
181