VTK
dox/Common/DataModel/vtkQuadraticTriangle.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkQuadraticTriangle.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 =========================================================================*/
00035 #ifndef __vtkQuadraticTriangle_h
00036 #define __vtkQuadraticTriangle_h
00037 
00038 #include "vtkCommonDataModelModule.h" // For export macro
00039 #include "vtkNonLinearCell.h"
00040 
00041 class vtkQuadraticEdge;
00042 class vtkTriangle;
00043 class vtkDoubleArray;
00044 
00045 class VTKCOMMONDATAMODEL_EXPORT vtkQuadraticTriangle : public vtkNonLinearCell
00046 {
00047 public:
00048   static vtkQuadraticTriangle *New();
00049   vtkTypeMacro(vtkQuadraticTriangle,vtkNonLinearCell);
00050   void PrintSelf(ostream& os, vtkIndent indent);
00051 
00053 
00055   int GetCellType() {return VTK_QUADRATIC_TRIANGLE;};
00056   int GetCellDimension() {return 2;}
00057   int GetNumberOfEdges() {return 3;}
00058   int GetNumberOfFaces() {return 0;}
00059   vtkCell *GetEdge(int edgeId);
00060   vtkCell *GetFace(int) {return 0;}
00062 
00063   int CellBoundary(int subId, double pcoords[3], vtkIdList *pts);
00064   void Contour(double value, vtkDataArray *cellScalars,
00065                vtkIncrementalPointLocator *locator, vtkCellArray *verts,
00066                vtkCellArray *lines, vtkCellArray *polys,
00067                vtkPointData *inPd, vtkPointData *outPd,
00068                vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd);
00069   int EvaluatePosition(double x[3], double* closestPoint,
00070                        int& subId, double pcoords[3],
00071                        double& dist2, double *weights);
00072   void EvaluateLocation(int& subId, double pcoords[3], double x[3],
00073                         double *weights);
00074   int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts);
00075   void Derivatives(int subId, double pcoords[3], double *values,
00076                    int dim, double *derivs);
00077   virtual double *GetParametricCoords();
00078 
00080 
00083   void Clip(double value, vtkDataArray *cellScalars,
00084             vtkIncrementalPointLocator *locator, vtkCellArray *polys,
00085             vtkPointData *inPd, vtkPointData *outPd,
00086             vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd,
00087             int insideOut);
00089 
00091 
00093   int IntersectWithLine(double p1[3], double p2[3], double tol, double& t,
00094                         double x[3], double pcoords[3], int& subId);
00096 
00097 
00100   int GetParametricCenter(double pcoords[3]);
00101 
00104   double GetParametricDistance(double pcoords[3]);
00105 
00108   static void InterpolationFunctions(double pcoords[3], double weights[6]);
00111   static void InterpolationDerivs(double pcoords[3], double derivs[12]);
00113 
00115   virtual void InterpolateFunctions(double pcoords[3], double weights[6])
00116     {
00117     vtkQuadraticTriangle::InterpolationFunctions(pcoords,weights);
00118     }
00119   virtual void InterpolateDerivs(double pcoords[3], double derivs[12])
00120     {
00121     vtkQuadraticTriangle::InterpolationDerivs(pcoords,derivs);
00122     }
00124 
00125 protected:
00126   vtkQuadraticTriangle();
00127   ~vtkQuadraticTriangle();
00128 
00129   vtkQuadraticEdge *Edge;
00130   vtkTriangle      *Face;
00131   vtkDoubleArray    *Scalars; //used to avoid New/Delete in contouring/clipping
00132 
00133 private:
00134   vtkQuadraticTriangle(const vtkQuadraticTriangle&);  // Not implemented.
00135   void operator=(const vtkQuadraticTriangle&);  // Not implemented.
00136 };
00137 //----------------------------------------------------------------------------
00138 inline int vtkQuadraticTriangle::GetParametricCenter(double pcoords[3])
00139 {
00140   pcoords[0] = pcoords[1] = 1./3;
00141   pcoords[2] = 0.0;
00142   return 0;
00143 }
00144 
00145 
00146 #endif
00147 
00148