00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00027 #ifndef __vtkLine_h
00028 #define __vtkLine_h
00029 
00030 #include "vtkCell.h"
00031 class vtkIncrementalPointLocator;
00032 
00033 class VTK_FILTERING_EXPORT vtkLine : public vtkCell
00034 {
00035 public:
00036   static vtkLine *New();
00037   vtkTypeMacro(vtkLine,vtkCell);
00038   void PrintSelf(ostream& os, vtkIndent indent);
00039 
00041 
00042   int GetCellType() {return VTK_LINE;};
00043   int GetCellDimension() {return 1;};
00044   int GetNumberOfEdges() {return 0;};
00045   int GetNumberOfFaces() {return 0;};
00046   vtkCell *GetEdge(int) {return 0;};
00047   vtkCell *GetFace(int) {return 0;};
00048   int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
00049   void Contour(double value, vtkDataArray *cellScalars,
00050                vtkIncrementalPointLocator *locator, vtkCellArray *verts,
00051                vtkCellArray *lines, vtkCellArray *polys,
00052                vtkPointData *inPd, vtkPointData *outPd,
00053                vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
00054   int EvaluatePosition(double x[3], double* closestPoint,
00055                        int& subId, double pcoords[3],
00056                        double& dist2, double *weights);
00057   void EvaluateLocation(int& subId, double pcoords[3], double x[3],
00058                         double *weights);
00059   int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
00060   void Derivatives(int subId, double pcoords[3], double *values,
00061                    int dim, double *derivs);
00062   virtual double *GetParametricCoords();
00064 
00066 
00068   void Clip(double value, vtkDataArray *cellScalars,
00069             vtkIncrementalPointLocator *locator, vtkCellArray *lines,
00070             vtkPointData *inPd, vtkPointData *outPd,
00071             vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
00072             int insideOut);
00074 
00076   int GetParametricCenter(double pcoords[3]);
00077 
00079 
00081   int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
00082                         double x[3], double pcoords[3], int& subId);
00084 
00085 
00087 
00092   static int Intersection(double p1[3], double p2[3],
00093                           double x1[3], double x2[3],
00094                           double& u, double& v);
00096 
00097 
00099 
00105   static double DistanceToLine(double x[3], double p1[3], double p2[3],
00106                               double &t, double closestPoint[3]);
00108 
00109 
00113   static double DistanceToLine(double x[3], double p1[3], double p2[3]);
00114 
00116 
00122   static double DistanceBetweenLines(
00123                 double l0[3], double l1[3], 
00124                 double m0[3], double m1[3],
00125                 double closestPt1[3], double closestPt2[3],
00126                 double &t1, double &t2 );
00128 
00130 
00136   static double DistanceBetweenLineSegments(
00137                 double l0[3], double l1[3], 
00138                 double m0[3], double m1[3],
00139                 double closestPt1[3], double closestPt2[3],
00140                 double &t1, double &t2 );
00142   
00144 
00145   static void InterpolationFunctions(double pcoords[3], double weights[2]);
00146   
00147   
00148   static void InterpolationDerivs(double pcoords[3], double derivs[2]);
00149   
00150   
00151   
00152   virtual void InterpolateFunctions(double pcoords[3], double weights[2])
00153     {
00154     vtkLine::InterpolationFunctions(pcoords,weights);
00155     }
00156   virtual void InterpolateDerivs(double pcoords[3], double derivs[2])
00157     {
00158     vtkLine::InterpolationDerivs(pcoords,derivs);
00159     }
00161 
00162 protected:
00163   vtkLine();
00164   ~vtkLine() {};
00165 
00166 private:
00167   vtkLine(const vtkLine&);  
00168   void operator=(const vtkLine&);  
00169 };
00170 
00171 
00172 inline int vtkLine::GetParametricCenter(double pcoords[3])
00173 {
00174   pcoords[0] = 0.5;
00175   pcoords[1] = pcoords[2] = 0.0;
00176   return 0;
00177 }
00178 
00179 #endif
00180 
00181