VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkLine.h,v $ 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 =========================================================================*/ 00024 #ifndef __vtkLine_h 00025 #define __vtkLine_h 00026 00027 #include "vtkCell.h" 00028 00029 class VTK_FILTERING_EXPORT vtkLine : public vtkCell 00030 { 00031 public: 00032 static vtkLine *New(); 00033 vtkTypeRevisionMacro(vtkLine,vtkCell); 00034 void PrintSelf(ostream& os, vtkIndent indent); 00035 00037 00038 int GetCellType() {return VTK_LINE;}; 00039 int GetCellDimension() {return 1;}; 00040 int GetNumberOfEdges() {return 0;}; 00041 int GetNumberOfFaces() {return 0;}; 00042 vtkCell *GetEdge(int) {return 0;}; 00043 vtkCell *GetFace(int) {return 0;}; 00044 int CellBoundary(int subId, double pcoords[3], vtkIdList *pts); 00045 void Contour(double value, vtkDataArray *cellScalars, 00046 vtkPointLocator *locator, vtkCellArray *verts, 00047 vtkCellArray *lines, vtkCellArray *polys, 00048 vtkPointData *inPd, vtkPointData *outPd, 00049 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd); 00050 int EvaluatePosition(double x[3], double* closestPoint, 00051 int& subId, double pcoords[3], 00052 double& dist2, double *weights); 00053 void EvaluateLocation(int& subId, double pcoords[3], double x[3], 00054 double *weights); 00055 int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts); 00056 void Derivatives(int subId, double pcoords[3], double *values, 00057 int dim, double *derivs); 00058 virtual double *GetParametricCoords(); 00060 00062 00064 void Clip(double value, vtkDataArray *cellScalars, 00065 vtkPointLocator *locator, vtkCellArray *lines, 00066 vtkPointData *inPd, vtkPointData *outPd, 00067 vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, 00068 int insideOut); 00070 00072 int GetParametricCenter(double pcoords[3]); 00073 00075 00077 int IntersectWithLine(double p1[3], double p2[3], double tol, double& t, 00078 double x[3], double pcoords[3], int& subId); 00080 00081 00083 00088 static int Intersection(double p1[3], double p2[3], 00089 double x1[3], double x2[3], 00090 double& u, double& v); 00092 00093 00095 00101 static double DistanceToLine(double x[3], double p1[3], double p2[3], 00102 double &t, double closestPoint[3]); 00104 00105 00109 static double DistanceToLine(double x[3], double p1[3], double p2[3]); 00110 00112 00118 static double DistanceBetweenLines( 00119 double l0[3], double l1[3], 00120 double m0[3], double m1[3], 00121 double closestPt1[3], double closestPt2[3], 00122 double &t1, double &t2 ); 00124 00126 00132 static double DistanceBetweenLineSegments( 00133 double l0[3], double l1[3], 00134 double m0[3], double m1[3], 00135 double closestPt1[3], double closestPt2[3], 00136 double &t1, double &t2 ); 00138 00140 00141 static void InterpolationFunctions(double pcoords[3], double weights[2]); 00142 // Description: 00143 // @deprecated Replaced by vtkLine::InterpolateDerivs as of VTK 5.2 00144 static void InterpolationDerivs(double pcoords[3], double derivs[2]); 00145 // Description: 00146 // Compute the interpolation functions/derivatives 00147 // (aka shape functions/derivatives) 00148 virtual void InterpolateFunctions(double pcoords[3], double weights[2]) 00149 { 00150 vtkLine::InterpolationFunctions(pcoords,weights); 00151 } 00152 virtual void InterpolateDerivs(double pcoords[3], double derivs[2]) 00153 { 00154 vtkLine::InterpolationDerivs(pcoords,derivs); 00155 } 00157 00158 protected: 00159 vtkLine(); 00160 ~vtkLine() {}; 00161 00162 private: 00163 vtkLine(const vtkLine&); // Not implemented. 00164 void operator=(const vtkLine&); // Not implemented. 00165 }; 00166 00167 //---------------------------------------------------------------------------- 00168 inline int vtkLine::GetParametricCenter(double pcoords[3]) 00169 { 00170 pcoords[0] = 0.5; 00171 pcoords[1] = pcoords[2] = 0.0; 00172 return 0; 00173 } 00174 00175 #endif 00176 00177