VTK
dox/Common/DataModel/vtkLine.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkLine.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00027 #ifndef __vtkLine_h
00028 #define __vtkLine_h
00029 
00030 #include "vtkCommonDataModelModule.h" // For export macro
00031 #include "vtkCell.h"
00032 class vtkIncrementalPointLocator;
00033 
00034 class VTKCOMMONDATAMODEL_EXPORT vtkLine : public vtkCell
00035 {
00036 public:
00037   static vtkLine *New();
00038   vtkTypeMacro(vtkLine,vtkCell);
00039   void PrintSelf(ostream& os, vtkIndent indent);
00040 
00042 
00043   int GetCellType() {return VTK_LINE;};
00044   int GetCellDimension() {return 1;};
00045   int GetNumberOfEdges() {return 0;};
00046   int GetNumberOfFaces() {return 0;};
00047   vtkCell *GetEdge(int) {return 0;};
00048   vtkCell *GetFace(int) {return 0;};
00049   int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
00050   void Contour(double value, vtkDataArray *cellScalars,
00051                vtkIncrementalPointLocator *locator, vtkCellArray *verts,
00052                vtkCellArray *lines, vtkCellArray *polys,
00053                vtkPointData *inPd, vtkPointData *outPd,
00054                vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
00055   int EvaluatePosition(double x[3], double* closestPoint,
00056                        int& subId, double pcoords[3],
00057                        double& dist2, double *weights);
00058   void EvaluateLocation(int& subId, double pcoords[3], double x[3],
00059                         double *weights);
00060   int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
00061   void Derivatives(int subId, double pcoords[3], double *values,
00062                    int dim, double *derivs);
00063   virtual double *GetParametricCoords();
00065 
00067 
00069   void Clip(double value, vtkDataArray *cellScalars,
00070             vtkIncrementalPointLocator *locator, vtkCellArray *lines,
00071             vtkPointData *inPd, vtkPointData *outPd,
00072             vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
00073             int insideOut);
00075 
00077   int GetParametricCenter(double pcoords[3]);
00078 
00080 
00082   int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
00083                         double x[3], double pcoords[3], int& subId);
00085 
00086 
00088 
00093   static int Intersection(double p1[3], double p2[3],
00094                           double x1[3], double x2[3],
00095                           double& u, double& v);
00097 
00098 
00100 
00106   static double DistanceToLine(double x[3], double p1[3], double p2[3],
00107                               double &t, double closestPoint[3]);
00109 
00110 
00114   static double DistanceToLine(double x[3], double p1[3], double p2[3]);
00115 
00117 
00123   static double DistanceBetweenLines(
00124                 double l0[3], double l1[3],
00125                 double m0[3], double m1[3],
00126                 double closestPt1[3], double closestPt2[3],
00127                 double &t1, double &t2 );
00129 
00131 
00137   static double DistanceBetweenLineSegments(
00138                 double l0[3], double l1[3],
00139                 double m0[3], double m1[3],
00140                 double closestPt1[3], double closestPt2[3],
00141                 double &t1, double &t2 );
00143 
00145   static void InterpolationFunctions(double pcoords[3], double weights[2]);
00147   static void InterpolationDerivs(double pcoords[3], double derivs[2]);
00149 
00151   virtual void InterpolateFunctions(double pcoords[3], double weights[2])
00152     {
00153     vtkLine::InterpolationFunctions(pcoords,weights);
00154     }
00155   virtual void InterpolateDerivs(double pcoords[3], double derivs[2])
00156     {
00157     vtkLine::InterpolationDerivs(pcoords,derivs);
00158     }
00160 
00161 protected:
00162   vtkLine();
00163   ~vtkLine() {};
00164 
00165 private:
00166   vtkLine(const vtkLine&);  // Not implemented.
00167   void operator=(const vtkLine&);  // Not implemented.
00168 };
00169 
00170 //----------------------------------------------------------------------------
00171 inline int vtkLine::GetParametricCenter(double pcoords[3])
00172 {
00173   pcoords[0] = 0.5;
00174   pcoords[1] = pcoords[2] = 0.0;
00175   return 0;
00176 }
00177 
00178 #endif
00179 
00180