35 vtkIdType numCellsInStencil;
36 vtkIdType startCell, nextCell;
41 vtkIdList *cellIds, *ptIds, *stencilIds;
43 vtkPolyData* pdata = vtkPolyData::SafeDownCast(this->
DataSet);
47 vtkErrorMacro(<<
"Input data NULL or not poly data");
54 cellIds = vtkIdList::New();
55 ptIds = vtkIdList::New();
56 stencilIds = vtkIdList::New();
58 pdata->GetPointCells (pointId, cellIds);
59 numCellsInStencil = cellIds->GetNumberOfIds();
60 if (numCellsInStencil < 1)
69 pdata->GetCellPoints(cellIds->GetId(0),ptIds);
74 p2 = ptIds->GetId(i++);
77 pdata->GetCellEdgeNeighbors (-1,pointId,p2,cellIds);
79 nextCell = cellIds->GetId(0);
82 if (cellIds->GetNumberOfIds() == 1)
88 startCell = cellIds->GetId(1);
91 stencilIds->InsertNextId(p2);
94 for (j=0; j<numCellsInStencil; j++)
96 cell = pdata->GetCell(nextCell);
98 for (i = 0; i < 3; i++)
100 if ((p1 = cell->GetPointId(i)) != pointId && cell->GetPointId(i) != p2)
107 stencilIds->InsertNextId (p2);
108 pdata->GetCellEdgeNeighbors (nextCell, pointId, p2, cellIds);
109 if (cellIds->GetNumberOfIds() != 1)
115 nextCell = cellIds->GetId(0);
120 nextCell = startCell;
122 for (; j<numCellsInStencil && startCell!=-1; j++)
124 cell = pdata->GetCell(nextCell);
128 if ((p1=cell->GetPointId(i))!=pointId && cell->GetPointId(i)!=p2)
134 stencilIds->InsertNextId(p2);
135 pdata->GetCellEdgeNeighbors (nextCell, pointId, p2, cellIds);
136 if (cellIds->GetNumberOfIds() != 1)
141 nextCell = cellIds->GetId(0);
147 id = stencilIds->IsId(bp2);
148 for (i=0; i<=
id/2; i++)
150 p1 = stencilIds->GetId(i);
151 p2 = stencilIds->GetId(
id-i);
152 stencilIds->SetId(i,p2);
153 stencilIds->SetId(
id-i,p1);
159 K = stencilIds->GetNumberOfIds();
161 stencilIds->SetNumberOfIds(--K);
164 this->
NPoints = stencilIds->GetNumberOfIds();
171 memcpy(this->
PointIds,stencilIds->GetPointer(0),this->NPoints*
sizeof(vtkIdType));
175 stencilIds->Delete();