28 #ifndef __vtkTriangle_h
29 #define __vtkTriangle_h
37 class vtkIncrementalPointLocator;
44 void PrintSelf(ostream& os,
vtkIndent indent);
48 vtkCell *GetEdge(
int edgeId);
57 int CellBoundary(
int subId,
double pcoords[3],
vtkIdList *pts);
59 vtkIncrementalPointLocator *locator,
vtkCellArray *verts,
62 vtkCellData *inCd,
vtkIdType cellId, vtkCellData *outCd);
63 int EvaluatePosition(
double x[3],
double* closestPoint,
64 int& subId,
double pcoords[3],
65 double& dist2,
double *weights);
66 void EvaluateLocation(
int& subId,
double pcoords[3],
double x[3],
69 void Derivatives(
int subId,
double pcoords[3],
double *values,
70 int dim,
double *derivs);
71 virtual double *GetParametricCoords();
81 vtkIncrementalPointLocator *locator,
vtkCellArray *polys,
83 vtkCellData *inCd,
vtkIdType cellId, vtkCellData *outCd,
90 static void InterpolationFunctions(
double pcoords[3],
double sf[3]);
93 static void InterpolationDerivs(
double pcoords[3],
double derivs[6]);
108 int *GetEdgeArray(
int edgeId);
114 int IntersectWithLine(
double p1[3],
double p2[3],
double tol,
double& t,
115 double x[3],
double pcoords[3],
int& subId);
119 int GetParametricCenter(
double pcoords[3]);
123 double GetParametricDistance(
double pcoords[3]);
127 static void TriangleCenter(
double p1[3],
double p2[3],
double p3[3],
133 static double TriangleArea(
double p1[3],
double p2[3],
double p3[3]);
140 static double Circumcircle(
double p1[2],
double p2[2],
double p3[2],
156 static int BarycentricCoords(
double x[2],
double x1[2],
double x2[2],
157 double x3[2],
double bcoords[3]);
165 static int ProjectTo2D(
double x1[3],
double x2[3],
double x3[3],
166 double v1[2],
double v2[2],
double v3[2]);
177 static void ComputeNormal(
double v1[3],
double v2[3],
double v3[3],
double n[3]);
182 static void ComputeNormalDirection(
double v1[3],
double v2[3],
double v3[3],
192 static int PointInTriangle(
double x[3],
double x1[3],
193 double x2[3],
double x3[3],
201 static void ComputeQuadric(
double x1[3],
double x2[3],
double x3[3],
202 double quadric[4][4]);
203 static void ComputeQuadric(
double x1[3],
double x2[3],
double x3[3],
222 pcoords[0] = pcoords[1] = 1./3; pcoords[2] = 0.0;
228 double v3[3],
double n[3])
230 double ax, ay, az, bx, by, bz;
233 ax = v3[0] - v2[0]; ay = v3[1] - v2[1]; az = v3[2] - v2[2];
234 bx = v1[0] - v2[0]; by = v1[1] - v2[1]; bz = v1[2] - v2[2];
236 n[0] = (ay * bz - az * by);
237 n[1] = (az * bx - ax * bz);
238 n[2] = (ax * by - ay * bx);
243 double v3[3],
double n[3])
249 if ( (length = sqrt((n[0]*n[0] + n[1]*n[1] + n[2]*n[2]))) != 0.0 )
259 double p3[3],
double center[3])
261 center[0] = (p1[0]+p2[0]+p3[0]) / 3.0;
262 center[1] = (p1[1]+p2[1]+p3[1]) / 3.0;
263 center[2] = (p1[2]+p2[2]+p3[2]) / 3.0;
273 return (0.25* sqrt(fabs(4.0*a*c - (a-b+c)*(a-b+c))));
static void InterpolationDerivs(double pcoords[3], double derivs[6])
represent and manipulate point attribute data
virtual void InterpolateDerivs(double pcoords[3], double derivs[6])
virtual void InterpolateFunctions(double pcoords[3], double sf[3])
static void ComputeNormalDirection(double v1[3], double v2[3], double v3[3], double n[3])
static void ComputeNormal(vtkPoints *p, int numPts, vtkIdType *pts, double n[3])
cell represents a 1D line
static void InterpolationFunctions(double pcoords[3], double sf[3])
a simple class to control print indentation
evaluate implicit quadric function
list of point or cell ids
abstract superclass for arrays of numeric data
static void TriangleCenter(double p1[3], double p2[3], double p3[3], double center[3])
object to represent cell connectivity
a cell that represents a triangle
int GetParametricCenter(double pcoords[3])
static float Distance2BetweenPoints(const float x[3], const float y[3])
represent and manipulate 3D points
static double TriangleArea(double p1[3], double p2[3], double p3[3])