VTK
|
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 "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 static void InterpolationFunctions(double pcoords[3], double weights[2]); 00146 static void InterpolationDerivs(double pcoords[3], double derivs[2]); 00148 00150 virtual void InterpolateFunctions(double pcoords[3], double weights[2]) 00151 { 00152 vtkLine::InterpolationFunctions(pcoords,weights); 00153 } 00154 virtual void InterpolateDerivs(double pcoords[3], double derivs[2]) 00155 { 00156 vtkLine::InterpolationDerivs(pcoords,derivs); 00157 } 00159 00160 protected: 00161 vtkLine(); 00162 ~vtkLine() {}; 00163 00164 private: 00165 vtkLine(const vtkLine&); // Not implemented. 00166 void operator=(const vtkLine&); // Not implemented. 00167 }; 00168 00169 //---------------------------------------------------------------------------- 00170 inline int vtkLine::GetParametricCenter(double pcoords[3]) 00171 { 00172 pcoords[0] = 0.5; 00173 pcoords[1] = pcoords[2] = 0.0; 00174 return 0; 00175 } 00176 00177 #endif 00178 00179