VTK  9.7.0
vtkPolygon.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
17
18#ifndef vtkPolygon_h
19#define vtkPolygon_h
20
21#include "vtkCell.h"
22#include "vtkCellStatus.h" // For return type
23#include "vtkCommonDataModelModule.h" // For export macro
24
25#include <cmath> // For std::sqrt in the quality ear clip
26#include <utility> // For std::swap in the quality ear clip
27#include <vector> // For ear-clip scratch buffers
28
29VTK_ABI_NAMESPACE_BEGIN
30class vtkDoubleArray;
31class vtkIdTypeArray;
32class vtkLine;
33class vtkPoints;
34class vtkQuad;
35class vtkTriangle;
38
39class VTKCOMMONDATAMODEL_EXPORT vtkPolygon : public vtkCell
40{
41public:
42 static vtkPolygon* New();
43 vtkTypeMacro(vtkPolygon, vtkCell);
44 void PrintSelf(ostream& os, vtkIndent indent) override;
45
47
50 int GetCellType() override { return VTK_POLYGON; }
51 int GetCellDimension() override { return 2; }
52 int GetNumberOfEdges() override { return this->GetNumberOfPoints(); }
53 int GetNumberOfFaces() override { return 0; }
54 vtkCell* GetEdge(int edgeId) override;
55 vtkCell* GetFace(int) override { return nullptr; }
56 int CellBoundary(int subId, const double pcoords[3], vtkIdList* pts) override;
57 void Contour(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
58 vtkCellArray* verts, vtkCellArray* lines, vtkCellArray* polys, vtkPointData* inPd,
59 vtkPointData* outPd, vtkCellData* inCd, vtkIdType cellId, vtkCellData* outCd) override;
60 void Clip(double value, vtkDataArray* cellScalars, vtkIncrementalPointLocator* locator,
61 vtkCellArray* tris, vtkPointData* inPd, vtkPointData* outPd, vtkCellData* inCd,
62 vtkIdType cellId, vtkCellData* outCd, int insideOut) override;
63 int EvaluatePosition(const double x[3], double closestPoint[3], int& subId, double pcoords[3],
64 double& dist2, double weights[]) override;
65 void EvaluateLocation(int& subId, const double pcoords[3], double x[3], double* weights) override;
66 int IntersectWithLine(const double p1[3], const double p2[3], double tol, double& t, double x[3],
67 double pcoords[3], int& subId) override;
68 int TriangulateLocalIds(int index, vtkIdList* ptIds) override;
70 int subId, const double pcoords[3], const double* values, int dim, double* derivs) override;
71 int IsPrimaryCell() VTK_FUTURE_CONST override { return 0; }
73
80 double ComputeArea();
81
91 void InterpolateFunctions(const double x[3], double* sf) override;
92
94
98 static vtkCellStatus ComputeNormal(vtkPoints* p, int numPts, const vtkIdType* pts, double n[3]);
99 static vtkCellStatus ComputeNormal(vtkPoints* p, double n[3]);
100 static vtkCellStatus ComputeNormal(vtkIdTypeArray* ids, vtkPoints* pts, double n[3]);
102
107 static vtkCellStatus ComputeNormal(int numPts, double* pts, double n[3]);
108
115 bool IsConvex();
116
118
130 static bool IsConvex(vtkPoints* p, int numPts, const vtkIdType* pts);
131 static bool IsConvex(vtkIdTypeArray* ids, vtkPoints* p);
132 static bool IsConvex(vtkPoints* p);
134
136
161 vtkPoints* p, int numPts, const vtkIdType* pts, double centroid[3], double tolerance);
162 static bool ComputeCentroid(vtkPoints* p, int numPts, const vtkIdType* pts, double centroid[3]);
163 static bool ComputeCentroid(vtkIdTypeArray* ids, vtkPoints* pts, double centroid[3]);
165
174 vtkPoints* p, int numPts, const vtkIdType* ids, double center[3], double& radius2);
175
184 static double ComputeArea(vtkPoints* p, vtkIdType numPts, const vtkIdType* pts, double normal[3]);
185
194 double p0[3], double p10[3], double& l10, double p20[3], double& l20, double n[3]);
195
207 static int PointInPolygon(double x[3], int numPts, double* pts, double bounds[6], double n[3]);
208
209 // Needed to remove warning "member function does not override any
210 // base class virtual member function"
211 int Triangulate(int index, vtkIdList* ptIds, vtkPoints* pts) override
212 {
213 return vtkCell::Triangulate(index, ptIds, pts);
214 }
215
221
229 int BoundedTriangulate(vtkIdList* outTris, double tol);
230
236 static double DistanceToPolygon(
237 double x[3], int numPts, double* pts, double bounds[6], double closest[3]);
238
247 static int IntersectPolygonWithPolygon(int npts, double* pts, double bounds[6], int npts2,
248 double* pts2, double bounds2[6], double tol, double x[3]);
249
262 vtkCell* cell1, vtkCell* cell2, double tol, double p0[3], double p1[3]);
263
265
271 vtkGetMacro(UseMVCInterpolation, bool);
272 vtkSetMacro(UseMVCInterpolation, bool);
274
276
284 vtkSetClampMacro(Tolerance, double, 0.0, 1.0);
285 vtkGetMacro(Tolerance, double);
287
288protected:
290 ~vtkPolygon() override = default;
291
292 // Compute the interpolation functions using Mean Value Coordinate.
293 void InterpolateFunctionsUsingMVC(const double x[3], double* weights);
294
295 // variables used by instances of this class
296 double Tolerance; // Intersection tolerance set by public API
297 double Tol; // Internal tolerance set by ComputeBounds()
298 void ComputeTolerance(); // Compute the internal tolerance Tol
299
300 int SuccessfulTriangulation; // Stops recursive triangulation if necessary
301 vtkSmartPointer<vtkIdList> Tris; // Output triangulation placed here
302
303 // These are used for internal computation.
308 vtkSmartPointer<vtkPriorityQueue> EarClipQueue; // reused ear-clip removal queue
309
310 // Parameter indicating whether to use Mean Value Coordinate algorithm
311 // for interpolation. The parameter is false by default.
313
314 // Helper methods for triangulation------------------------------
315 // Made public for external access
316public:
317 // Ear cut triangulation options. The order in which vertices are
318 // removed are controlled by different measures. Changing this can
319 // make subtle differences in some cases. Historically the
320 // PERIMETER2_TO_AREA_RATIO has been used.
322 {
326 };
327
329
340
342
351 int seed, vtkIdList* outTris, int measure = PERIMETER2_TO_AREA_RATIO);
353
355
382 template <typename PointsRange, typename CellIter>
383 static int CompactPolygonRing(
384 const PointsRange& points, CellIter cell, int cellSize, std::vector<int>& ring);
385 template <typename PointsRange, typename CellIter>
387 const PointsRange& points, CellIter cell, int cellSize, std::vector<int>& ring);
388 template <typename PointsRange, typename CellIter, typename EmitFn>
389 static void EarClipPolygon3D(const PointsRange& points, CellIter cell, int cellSize,
390 std::vector<int>& prevBuf, std::vector<int>& nextBuf, std::vector<int>& ring, EmitFn&& emit);
392
393private:
394 vtkPolygon(const vtkPolygon&) = delete;
395 void operator=(const vtkPolygon&) = delete;
396};
397
398//------------------------------------------------------------------------------
399template <typename PointsRange, typename CellIter>
401 const PointsRange& points, CellIter cell, int cellSize, std::vector<int>& ring)
402{
403 // Build the ring of distinct vertices, dropping consecutive coincident
404 // vertices (degenerate edges). Banded contouring and clipping routinely emit
405 // polygons with coincident consecutive vertices when a scalar lands exactly
406 // on a clip value; the historical fan triangulation tolerated these by
407 // skipping zero-area triangles, and the ear clip must do the same or it
408 // computes a bogus normal / ear test at the duplicated vertex.
409 ring.clear();
410 for (int i = 0; i < cellSize; ++i)
411 {
412 if (!ring.empty())
413 {
414 auto pPrev = points[cell[ring.back()]];
415 auto pCur = points[cell[i]];
416 if (pPrev[0] == pCur[0] && pPrev[1] == pCur[1] && pPrev[2] == pCur[2])
417 {
418 continue; // coincident with previous kept vertex
419 }
420 }
421 ring.push_back(i);
422 }
423 // Drop the last vertex if it coincides with the first (wrap-around duplicate).
424 if (ring.size() >= 2)
425 {
426 auto pFirst = points[cell[ring.front()]];
427 auto pLast = points[cell[ring.back()]];
428 if (pFirst[0] == pLast[0] && pFirst[1] == pLast[1] && pFirst[2] == pLast[2])
429 {
430 ring.pop_back();
431 }
432 }
433 return static_cast<int>(ring.size());
434}
435
436//------------------------------------------------------------------------------
437template <typename PointsRange, typename CellIter>
439 const PointsRange& points, CellIter cell, int cellSize, std::vector<int>& ring)
440{
441 const int m = vtkPolygon::CompactPolygonRing(points, cell, cellSize, ring);
442 return m >= 3 ? static_cast<vtkIdType>(m - 2) : 0;
443}
444
445//------------------------------------------------------------------------------
446template <typename PointsRange, typename CellIter, typename EmitFn>
447void vtkPolygon::EarClipPolygon3D(const PointsRange& points, CellIter cell, int cellSize,
448 std::vector<int>& prevBuf, std::vector<int>& nextBuf, std::vector<int>& ring, EmitFn&& emit)
449{
450 const int m = vtkPolygon::CompactPolygonRing(points, cell, cellSize, ring);
451 if (m < 3)
452 {
453 return; // fully degenerate (collapses to a point or segment): no triangles
454 }
455
456 // ring[k] is the polygon-local index of the k-th distinct vertex. Work in
457 // compacted space 0..m-1; map back through ring[] when emitting and looking
458 // up coordinates.
459 auto P = [&](int k) { return points[cell[ring[k]]]; };
460
461 // Compute polygon normal via Newell's method over the compacted ring.
462 double normal[3] = { 0.0, 0.0, 0.0 };
463 {
464 auto pLast = P(m - 1);
465 double xp = pLast[0], yp = pLast[1], zp = pLast[2];
466 for (int i = 0; i < m; ++i)
467 {
468 auto pi = P(i);
469 double x = pi[0], y = pi[1], z = pi[2];
470 normal[0] += (yp - y) * (zp + z);
471 normal[1] += (zp - z) * (xp + x);
472 normal[2] += (xp - x) * (yp + y);
473 xp = x;
474 yp = y;
475 zp = z;
476 }
477 }
478
479 // Emit a triangle given compacted-ring indices, computing the polygon-
480 // boundary edge mask from compacted-ring adjacency, then mapping to local.
481 auto emitRing = [&](int a, int b, int c)
482 {
483 auto isBoundary = [m](int x, int y) -> int
484 {
485 const int d = (y - x + m) % m;
486 return (d == 1 || d == m - 1) ? 1 : 0;
487 };
488 int mask = isBoundary(a, b);
489 mask |= isBoundary(b, c) << 1;
490 mask |= isBoundary(c, a) << 2;
491 emit(ring[a], ring[b], ring[c], mask);
492 };
493
494 const double normLen2 = normal[0] * normal[0] + normal[1] * normal[1] + normal[2] * normal[2];
495 if (normLen2 == 0.0)
496 {
497 // Zero-area (collinear) polygon. No meaningful triangulation; fall back to
498 // a fan over the compacted ring so the emit count matches m - 2.
499 for (int i = 1; i < m - 1; ++i)
500 {
501 emitRing(0, i, i + 1);
502 }
503 return;
504 }
505
506 // Doubly-linked circular list over the compacted ring 0..m-1.
507 prevBuf.resize(m);
508 nextBuf.resize(m);
509 for (int i = 0; i < m; ++i)
510 {
511 prevBuf[i] = (i + m - 1) % m;
512 nextBuf[i] = (i + 1) % m;
513 }
514
515 auto isEar = [&](int b) -> bool
516 {
517 const int a = prevBuf[b];
518 const int c = nextBuf[b];
519 auto pa = P(a);
520 auto pb = P(b);
521 auto pc = P(c);
522 const double ax = pa[0], ay = pa[1], az = pa[2];
523 const double bx = pb[0], by = pb[1], bz = pb[2];
524 const double cx = pc[0], cy = pc[1], cz = pc[2];
525
526 // Convexity at b: ((b - a) x (c - b)) . normal > 0
527 const double e1x = bx - ax, e1y = by - ay, e1z = bz - az;
528 const double e2x = cx - bx, e2y = cy - by, e2z = cz - bz;
529 const double crx = e1y * e2z - e1z * e2y;
530 const double cry = e1z * e2x - e1x * e2z;
531 const double crz = e1x * e2y - e1y * e2x;
532 if (crx * normal[0] + cry * normal[1] + crz * normal[2] <= 0.0)
533 {
534 return false; // reflex or zero-area
535 }
536
537 // No other vertex in the remaining polygon may lie strictly inside
538 // triangle (a, b, c). Use the polygon normal as the projection axis for
539 // a same-side test against each triangle edge.
540 for (int q = nextBuf[c]; q != a; q = nextBuf[q])
541 {
542 auto pq = P(q);
543 const double qx = pq[0], qy = pq[1], qz = pq[2];
544 auto sideOf = [&](double sx, double sy, double sz, double ex, double ey, double ez) -> double
545 {
546 const double dx = ex - sx, dy = ey - sy, dz = ez - sz;
547 const double rx = qx - sx, ry = qy - sy, rz = qz - sz;
548 const double tcrx = dy * rz - dz * ry;
549 const double tcry = dz * rx - dx * rz;
550 const double tcrz = dx * ry - dy * rx;
551 return tcrx * normal[0] + tcry * normal[1] + tcrz * normal[2];
552 };
553 const double s1 = sideOf(ax, ay, az, bx, by, bz);
554 const double s2 = sideOf(bx, by, bz, cx, cy, cz);
555 const double s3 = sideOf(cx, cy, cz, ax, ay, az);
556 if (s1 > 0.0 && s2 > 0.0 && s3 > 0.0)
557 {
558 return false;
559 }
560 }
561 return true;
562 };
563
564 // Clip ears walking forward from vertex 1, keeping the clipped vertex's
565 // successor as the next candidate. For a convex polygon this clips vertices
566 // 1, 2, 3, ... in order while vertex 0 remains the common apex, reproducing
567 // exactly the fan-from-vertex-0 triangulation VTK has always emitted (and
568 // that existing image baselines were generated with). Triangulation is not
569 // invariant under interior diagonals: per-triangle texture-coordinate and
570 // Gouraud interpolation depend on the diagonals chosen, so a convex polygon
571 // must keep producing the fan. For non-convex polygons reflex vertices are
572 // skipped and the walk still finds valid ears.
573 int remaining = m;
574 int current = 1 % m;
575 int safetyBudget = 2 * m;
576 while (remaining > 3 && safetyBudget > 0)
577 {
578 if (isEar(current))
579 {
580 const int a = prevBuf[current];
581 const int c = nextBuf[current];
582 emitRing(a, current, c);
583 nextBuf[a] = c;
584 prevBuf[c] = a;
585 current = c;
586 --remaining;
587 safetyBudget = 2 * m;
588 }
589 else
590 {
591 current = nextBuf[current];
592 --safetyBudget;
593 }
594 }
595
596 if (remaining > 3)
597 {
598 // Ear-clip stalled. Emit remaining vertices as a fan from `current` to
599 // satisfy the emit-pass triangle count. Result will be visually wrong for
600 // a non-convex remainder, but degenerate input has no correct triangulation.
601 const int head = current;
602 int v = nextBuf[head];
603 int vn = nextBuf[v];
604 while (vn != head)
605 {
606 emitRing(head, v, vn);
607 v = vn;
608 vn = nextBuf[vn];
609 }
610 return;
611 }
612
613 // Final triangle: the three vertices still in the list. Emit it anchored at
614 // prev(current) so that for a convex polygon (where current has advanced to
615 // the second-to-last vertex with vertex 0 still the apex) the triangle is
616 // (0, m-2, m-1) - the same vertex order and boundary-edge mask the fan emits.
617 const int b = current;
618 const int a = prevBuf[b];
619 const int c = nextBuf[b];
620 emitRing(a, b, c);
621}
622
623VTK_ABI_NAMESPACE_END
624#endif
RealT s2
Definition PyrC2Basis.h:21
object to represent cell connectivity
represent and manipulate cell attribute data
Definition vtkCellData.h:32
virtual int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts)
Generate simplices of proper dimension.
vtkIdType GetNumberOfPoints() const
Return the number of points in the cell.
Definition vtkCell.h:129
dynamic, self-adjusting array of double
list of point or cell ids
Definition vtkIdList.h:26
dynamic, self-adjusting array of vtkIdType
Abstract class in support of both point location and point insertion.
a simple class to control print indentation
Definition vtkIndent.h:29
cell represents a 1D line
Definition vtkLine.h:23
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:31
static int PointInPolygon(double x[3], int numPts, double *pts, double bounds[6], double n[3])
Determine whether a point is inside the specified polygon.
double ComputeArea()
Compute the area of a polygon.
@ PERIMETER2_TO_AREA_RATIO
Definition vtkPolygon.h:323
int GetCellType() override
See the vtkCell API for descriptions of these methods.
Definition vtkPolygon.h:50
void Clip(double value, vtkDataArray *cellScalars, vtkIncrementalPointLocator *locator, vtkCellArray *tris, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd, int insideOut) override
See the vtkCell API for descriptions of these methods.
static vtkIdType EarClipTriangleCount(const PointsRange &points, CellIter cell, int cellSize, std::vector< int > &ring)
Templated, allocation-free ear-clip triangulation of a simple (possibly non-convex) 3D polygon,...
Definition vtkPolygon.h:438
static bool IsConvex(vtkPoints *p, int numPts, const vtkIdType *pts)
Determine whether or not a polygon is convex.
int CellBoundary(int subId, const double pcoords[3], vtkIdList *pts) override
See the vtkCell API for descriptions of these methods.
int UnbiasedEarCutTriangulation(int seed, int measure=PERIMETER2_TO_AREA_RATIO)
A fast triangulation method.
static int IntersectPolygonWithPolygon(int npts, double *pts, double bounds[6], int npts2, double *pts2, double bounds2[6], double tol, double x[3])
Method intersects two polygons.
int GetNumberOfEdges() override
See the vtkCell API for descriptions of these methods.
Definition vtkPolygon.h:52
static bool IsConvex(vtkPoints *p)
Determine whether or not a polygon is convex.
int Triangulate(int index, vtkIdList *ptIds, vtkPoints *pts) override
Generate simplices of proper dimension.
Definition vtkPolygon.h:211
void ComputeTolerance()
bool UseMVCInterpolation
Definition vtkPolygon.h:312
double Tolerance
Definition vtkPolygon.h:296
void InterpolateFunctionsUsingMVC(const double x[3], double *weights)
static vtkCellStatus ComputeNormal(vtkPoints *p, double n[3])
Computes the unit normal to the polygon.
static int CompactPolygonRing(const PointsRange &points, CellIter cell, int cellSize, std::vector< int > &ring)
Templated, allocation-free ear-clip triangulation of a simple (possibly non-convex) 3D polygon,...
Definition vtkPolygon.h:400
int IsPrimaryCell() VTK_FUTURE_CONST override
See the vtkCell API for descriptions of these methods.
Definition vtkPolygon.h:71
int GetNumberOfFaces() override
See the vtkCell API for descriptions of these methods.
Definition vtkPolygon.h:53
int EvaluatePosition(const double x[3], double closestPoint[3], int &subId, double pcoords[3], double &dist2, double weights[]) override
See the vtkCell API for descriptions of these methods.
vtkSmartPointer< vtkIdList > Tris
Definition vtkPolygon.h:301
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int NonDegenerateTriangulate(vtkIdList *outTris)
Same as Triangulate(vtkIdList *outTris) but with a first pass to split the polygon into non-degenerat...
int GetCellDimension() override
See the vtkCell API for descriptions of these methods.
Definition vtkPolygon.h:51
static double DistanceToPolygon(double x[3], int numPts, double *pts, double bounds[6], double closest[3])
Compute the distance of a point to a polygon.
int SuccessfulTriangulation
Definition vtkPolygon.h:300
vtkCell * GetEdge(int edgeId) override
See the vtkCell API for descriptions of these methods.
~vtkPolygon() override=default
vtkSmartPointer< vtkTriangle > Triangle
Definition vtkPolygon.h:304
void EvaluateLocation(int &subId, const double pcoords[3], double x[3], double *weights) override
See the vtkCell API for descriptions of these methods.
vtkSmartPointer< vtkLine > Line
Definition vtkPolygon.h:307
int TriangulateLocalIds(int index, vtkIdList *ptIds) override
See the vtkCell API for descriptions of these methods.
void Derivatives(int subId, const double pcoords[3], const double *values, int dim, double *derivs) override
See the vtkCell API for descriptions of these methods.
static vtkCellStatus ComputeNormal(vtkPoints *p, int numPts, const vtkIdType *pts, double n[3])
Computes the unit normal to the polygon.
void Contour(double value, vtkDataArray *cellScalars, vtkIncrementalPointLocator *locator, vtkCellArray *verts, vtkCellArray *lines, vtkCellArray *polys, vtkPointData *inPd, vtkPointData *outPd, vtkCellData *inCd, vtkIdType cellId, vtkCellData *outCd) override
See the vtkCell API for descriptions of these methods.
static bool IsConvex(vtkIdTypeArray *ids, vtkPoints *p)
Determine whether or not a polygon is convex.
int IntersectWithLine(const double p1[3], const double p2[3], double tol, double &t, double x[3], double pcoords[3], int &subId) override
See the vtkCell API for descriptions of these methods.
int ParameterizePolygon(double p0[3], double p10[3], double &l10, double p20[3], double &l20, double n[3])
Create a local s-t coordinate system for a polygon.
vtkSmartPointer< vtkDoubleArray > TriScalars
Definition vtkPolygon.h:306
int EarCutTriangulation(vtkIdList *outTris, int measure=PERIMETER2_TO_AREA_RATIO)
A fast triangulation method.
static void EarClipPolygon3D(const PointsRange &points, CellIter cell, int cellSize, std::vector< int > &prevBuf, std::vector< int > &nextBuf, std::vector< int > &ring, EmitFn &&emit)
Templated, allocation-free ear-clip triangulation of a simple (possibly non-convex) 3D polygon,...
Definition vtkPolygon.h:447
vtkSmartPointer< vtkQuad > Quad
Definition vtkPolygon.h:305
static vtkCellStatus ComputeNormal(vtkIdTypeArray *ids, vtkPoints *pts, double n[3])
Computes the unit normal to the polygon.
int BoundedTriangulate(vtkIdList *outTris, double tol)
Triangulate polygon and enforce that the ratio of the smallest triangle area to the polygon area is g...
int EarCutTriangulation(int measure=PERIMETER2_TO_AREA_RATIO)
A fast triangulation method.
vtkCell * GetFace(int) override
See the vtkCell API for descriptions of these methods.
Definition vtkPolygon.h:55
static bool ComputeCentroid(vtkPoints *p, int numPts, const vtkIdType *pts, double centroid[3])
Compute the centroid of a set of points.
static double ComputeArea(vtkPoints *p, vtkIdType numPts, const vtkIdType *pts, double normal[3])
Compute the area of a polygon in 3D.
void InterpolateFunctions(const double x[3], double *sf) override
Compute the interpolation functions/derivatives.
bool IsConvex()
Determine whether or not a polygon is convex.
static bool ComputeCentroid(vtkIdTypeArray *ids, vtkPoints *pts, double centroid[3])
Compute the centroid of a set of points.
static vtkCellStatus ComputeNormal(int numPts, double *pts, double n[3])
Compute the polygon normal from an array of points.
int UnbiasedEarCutTriangulation(int seed, vtkIdList *outTris, int measure=PERIMETER2_TO_AREA_RATIO)
A fast triangulation method.
static vtkPolygon * New()
static bool ComputeInteriorCircle(vtkPoints *p, int numPts, const vtkIdType *ids, double center[3], double &radius2)
Compute a circle interior to a polygon.
double Tol
Definition vtkPolygon.h:297
static vtkCellStatus ComputeCentroid(vtkPoints *p, int numPts, const vtkIdType *pts, double centroid[3], double tolerance)
Compute the centroid of a set of points.
vtkSmartPointer< vtkPriorityQueue > EarClipQueue
Definition vtkPolygon.h:308
static int IntersectConvex2DCells(vtkCell *cell1, vtkCell *cell2, double tol, double p0[3], double p1[3])
Intersect two convex 2D polygons to produce a line segment as output.
a list of ids arranged in priority order
a cell that represents a 2D quadrilateral
Definition vtkQuad.h:28
Hold a reference to a vtkObjectBase instance.
a cell that represents a triangle
Definition vtkTriangle.h:28
vtkCellStatus
Diagnostic values indicating how well-specified a cell is.
@ VTK_POLYGON
Definition vtkCellType.h:44
#define vtkDataArray
int vtkIdType
Definition vtkType.h:363