NAME
vtkPolyData - concrete dataset represents vertices, lines, polygons, and triangle strips
SYNOPSIS
#include "/opt/vtk-c++/common/vtkPolyData.h"
class VTK_EXPORT vtkPolyData : public vtkPointSet
vtkPolyData();
vtkPolyData(const vtkPolyData& pd);
~vtkPolyData();
static vtkPolyData *New() {return new vtkPolyData;};
const char *GetClassName() {return "vtkPolyData";};
char *GetDataType() {return "vtkPolyData";};
void PrintSelf(ostream& os, vtkIndent indent);
vtkDataSet *MakeObject() {return new vtkPolyData(*this);};
void CopyStructure(vtkDataSet *ds);
int GetNumberOfCells();
vtkCell *GetCell(int cellId);
int GetCellType(int cellId);
void GetCellPoints(int cellId, vtkIdList& ptIds);
void GetPointCells(int ptId, vtkIdList& cellIds);
void Squeeze();
int GetMaxCellSize();
void SetVerts (vtkCellArray* v);
vtkCellArray *GetVerts();
void SetLines (vtkCellArray* l);
vtkCellArray *GetLines();
void SetPolys (vtkCellArray* p);
vtkCellArray *GetPolys();
void SetStrips (vtkCellArray* s);
vtkCellArray *GetStrips();
int GetNumberOfVerts();
int GetNumberOfLines();
int GetNumberOfPolys();
int GetNumberOfStrips();
void Allocate(int numCells=1000, int extSize=1000);
int InsertNextCell(int type, int npts, int *pts);
int InsertNextCell(int type, vtkIdList &pts);
void Reset();
void BuildCells();
void BuildLinks();
void GetPointCells(int ptId, unsigned short& ncells, int* &cells);
void GetCellEdgeNeighbors(int cellId, int p1, int p2, vtkIdList& cellIds);
void GetCellPoints(int cellId, int& npts, int* &pts);
int IsTriangle(int v1, int v2, int v3);
int IsEdge(int v1, int v2);
int IsPointUsedByCell(int ptId, int cellId);
void ReplaceCell(int cellId, int npts, int *pts);
void ReplaceCellPoint(int cellId, int oldPtId, int newPtId);
void ReverseCell(int cellId);
void DeletePoint(int ptId);
void DeleteCell(int cellId);
int InsertNextLinkedPoint(float x[3], int numLinks);
int InsertNextLinkedCell(int type, int npts, int *pts);
void ReplaceLinkedCell(int cellId, int npts, int *pts);
void RemoveCellReference(int cellId);
void AddCellReference(int cellId);
void RemoveReferenceToCell(int ptId, int cellId);
void AddReferenceToCell(int ptId, int cellId);
void ResizeCellList(int ptId, int size);
virtual void Initialize();
DESCRIPTION
vtkPolyData is a data object that is a concrete implementation of vtkDataSet. vtkPolyData represents a geometric structure consisting of vertices, lines, polygons, and triangle strips. Point attribute values (e.g., scalars, vectors, etc.) also are represented.
The actual cell types (CellType.h) supported by vtkPolyData are: vtkVertex, vtkPolyVertex, vtkLine, vtkPolyLine, vtkTriangle, vtkTriangleStrip, vtkPolygon, vtkPixel, and vtkQuad.
One important feature of vtkPolyData objects is that special traversal and data manipulation methods are available to process data. These methods are generally more efficient than vtkDataSet methods and should be used whenever possible. For example, traversing the cells in a dataset we would use GetCell(). To traverse cells with vtkPolyData we would retrieve the cell array object representing polygons (for example) and then use vtkCellArray's InitTraversal() and GetNextCell() methods.
SUMMARY
void GetPointCells(int ptId, unsigned short& ncells,
Efficient method to obtain cells using a particular point. Make sure that routine BuildLinks() has been called.
int IsTriangle(int v1, int v2, int v3)
Given three vertices, determine whether it's a triangle. Make sure BuildLinks() has been called first.
int IsPointUsedByCell(int ptId, int cellId)
Determine whether a point is used by a particular cell. If it is, return non-zero. Make sure BuildCells() has been called first.
int IsEdge(int p1, int p2)
Determine whether two points form an edge. If they do, return non-zero. Make sure BuildLinks() has been called first.
void RemoveCellReference(int cellId)
Remove all references to cell in cell structure. This means the links from the cell's points to the cell are deleted. Memory is not reclaimed. Use the method ResizeCellList() to resize the link list from a point to its using cells. (This operator assumes BuildLinks() has been called.)
void AddCellReference(int cellId)
Add references to cell in cell structure. This means the links from the cell's points to the cell are modified. Memory is not extended. Use the method ResizeCellList() to resize the link list from a point to its using cells. (This operator assumes BuildLinks() has been called.)
void ResizeCellList(int ptId, int size)
Resize the list of cells using a particular point. (This operator assumes that BuildLinks() has been called.)
void ReplaceCellPoint(int cellId, int oldPtId, int newPtId) Replace a point in the cell connectivity list with a different point.
vtkPolyData(const vtkPolyData& pd) : vtkPointSet(pd)
Perform shallow construction of vtkPolyData.
void CopyStructure(vtkDataSet *ds)
Copy the geometric and topological structure of an input poly data object.
void SetVerts (vtkCellArray* v)
Set the cell array defining vertices.
vtkCellArray* GetVerts()
Get the cell array defining vertices. If there are no vertices, an empty array will be returned (convenience to simplify traversal).
void SetLines (vtkCellArray* l)
Set the cell array defining lines.
vtkCellArray* GetLines()
Get the cell array defining lines. If there are no lines, an empty array will be returned (convenience to simplify traversal).
void SetPolys (vtkCellArray* p)
Set the cell array defining polygons.
vtkCellArray* GetPolys()
Get the cell array defining polygons. If there are no polygons, an empty array will be returned (convenience to simplify traversal).
void SetStrips (vtkCellArray* s)
Set the cell array defining triangle strips.
vtkCellArray* GetStrips()
Get the cell array defining triangle strips. If there are no triangle strips, an empty array will be returned (convenience to simplify traversal).
void Initialize()
Restore object to initial state. Release memory back to system.
void BuildCells()
Create data structure that allows random access of cells.
void BuildLinks()
Create upward links from points to cells that use each point. Enables topologically complex queries.
void GetCellPoints(int cellId, vtkIdList& ptIds)
Copy a cells point ids into list provided. (Less efficient.)
void GetCellPoints(int cellId, int& npts, int* &pts)
Return a pointer to a list of point ids defining cell. (More efficient.) Assumes that cells have been built (with BuildCells()).
void Allocate(int numCells, int extSize)
Method allocates initial storage for vertex, line, polygon, and triangle strip arrays. Use this method before the method PolyData::InsertNextCell(). (Or, provide vertex, line, polygon, and triangle strip cell arrays.)
int InsertNextCell(int type, int npts, int *pts)
Insert a cell of type vtkVERTEX, vtkPOLY_VERTEX, vtkLINE, vtkPOLY_LINE, vtkTRIANGLE, vtkQUAD, vtkPOLYGON, or vtkTRIANGLE_STRIP. Make sure that the
PolyData::Allocate() function has been called first or that vertex, line, polygon, and triangle strip arrays have been supplied. Note: will also insert vtkPIXEL, but converts it to vtkQUAD.
int InsertNextCell(int type, vtkIdList &pts)
Insert a cell of type VTK_VERTEX, VTK_POLY_VERTEX,
VTK_LINE, VTK_POLY_LINE, VTK_TRIANGLE, VTK_QUAD, VTK_POLYGON, or VTK_TRIANGLE_STRIP. Make sure that the PolyData::Allocate() function has been called first or that vertex, line, polygon, and triangle strip arrays have been supplied. Note: will also insert VTK_PIXEL, but converts it to VTK_QUAD.
void Squeeze()
Recover extra allocated memory when creating data whose initial size is unknown. Examples include using the InsertNextCell() method, or when using the CellArray::EstimateSize() method to create vertices, lines, polygons, or triangle strips.
void Reset()
Begin inserting data all over again. Memory is not freed but otherwise objects are returned to their initial state.
void ReverseCell(int cellId)
Reverse the order of point ids defining the cell.
int InsertNextLinkedPoint(float x[3], int numLinks)
Add a point to the cell data structure (after cell pointers have been built). This method adds the point and then allocates memory for the links to the cells. (To use this method, make sure points are available and BuildLinks() has been invoked.)
int InsertNextLinkedCell(int type, int npts, int *pts) Add a new cell to the cell data structure (after cell pointers have been built). This method adds the cell and then updates the links from the points to the cells. (Memory is allocated as necessary.)
void RemoveReferenceToCell(int ptId, int cellId)
Remove a reference to a cell in a particular point's link list. You may also consider using RemoveCellReference() to remove the references from all the cell's points to the cell. This operator does not reallocate memory; use the operator ResizeCellList() to do this if necessary.
void AddReferenceToCell(int ptId, int cellId)
Add a reference to a cell in a particular point's link list. (You may also consider using AddCellReference() to add the references from all the cell's points to the cell.) This operator does not realloc memory; use the operator ResizeCellList() to do this if necessary.
void ReplaceCell(int cellId, int npts, int *pts)
Replace the points defining cell "cellId" with a new set of points. This operator is (typically) used when links from points to cells have not been built (i.e., BuildLinks() has not been executed). Use the operator ReplaceLinkedCell() to replace a cell when cell structure has been built.
void ReplaceLinkedCell(int cellId, int npts, int *pts) Replace one cell with another in cell structure. This operator updates the connectivity list and the point's link list. It does not delete references to the old cell in the point's link list. Use the operator RemoveCellReference() to delete all references from points
to (old) cell. You may also want to consider using the operator ResizeCellList() if the link list is changing size.
void GetCellEdgeNeighbors(int cellId, int p1, int p2, vtkIdList& cellIds)
Get the neighbors at an edge. More efficient than the general GetCellNeighbors(). Assumes links have been built (with BuildLinks()), and looks specifically for edge neighbors.