export interface vtkPolyData extends vtkPointSet { /** * Create data structure that allows random access of cells. */ buildCells(): void;
/** * Create upward links from points to cells that use each point. Enables * topologically complex queries. * @param {Number} initialSize */ buildLinks(initialSize?: number): void;
/** * If you know the type of cell, you may provide it to improve performances. * @param {Number} cellId * @paramcellHint */ getCell(cellId: number, cellHint: any): void;
/** * Get the neighbors at an edge. * @param {Number} cellId The Id of the cell. * @param {Vector3} point1 The first point coordinate. * @param {Vector3} point2 The second point coordinate. */ getCellEdgeNeighbors(cellId: number, point1: Vector3, point2: Vector3): void;
/** * Get a list of point ids that define a cell. * @param {Number} cellId The Id of the cell. * @return an object made of the cellType and a subarray `cellPointIds` of the cell points. */ getCellPoints(cellId: number): object;
/** * Get the type of the cell * @param {Number} cellId The Id of the cell. * @return CellType The type of the cell. */ getCellType(cellId: number): CellType;
/** * Get the cell array defining cells. */ getCells(): vtkCellArray;
/** * Get the cell array defining lines. */ getLines(): vtkCellArray;
/** * */ getLinks(): any;
/** * Determine the number of cells composing the polydata. */ getNumberOfCells(): number;
/** * Determine the number of lines composing the polydata. */ getNumberOfLines(): number;
/** * Determine the number of points composing the polydata. */ getNumberOfPoints(): number;
/** * Determine the number of polys composing the polydata. */ getNumberOfPolys(): number;
/** * Determine the number of strips composing the polydata. */ getNumberOfStrips(): number;
/** * Determine the number of vertices composing the polydata. */ getNumberOfVerts(): number;
/** * Topological inquiry to get cells using point. * @paramptId */ getPointCells(ptId: any): void;
/** * Get the cell array defining polys. */ getPolys(): vtkCellArray;
/** * Get the cell array defining strips. */ getStrips(): vtkCellArray;
/** * Get the cell array defining vertices. * If there are no vertices, an empty array will be returned (convenience to * simplify traversal). */ getVerts(): vtkCellArray;
/** * Set the cell array defining lines. * @param {vtkCellArray} lines The cell array defining lines. */ setLines(lines: vtkCellArray): boolean;
/** * Set the cell array defining polys. * @param {vtkCellArray} polys The cell array defining polys. */ setPolys(polys: vtkCellArray): boolean;
/** * Set the cell array defining strips. * @param {vtkCellArray} strips The cell array defining strips. */ setStrips(strips: vtkCellArray): boolean;
/** * Set the cell array defining vertices. * @param {vtkCellArray} verts The cell array defining vertices. */ setVerts(verts: vtkCellArray): boolean; }
/** * Method used to decorate a given object (publicAPI+model) with vtkPolyData characteristics. * * @param publicAPI object on which methods will be bounds (public) * @param model object on which data structure will be bounds (protected) * @param {IPolyDataInitialValues} [initialValues] (default: {}) */ exportfunctionextend( publicAPI: object, model: object, initialValues?: IPolyDataInitialValues ): void;
/** * Method used to create a new instance of vtkPolyData. * @param {IPolyDataInitialValues} [initialValues] for pre-setting some of its content */ exportfunctionnewInstance( initialValues?: IPolyDataInitialValues ): vtkPolyData;
/** * vtkPolyData is a dataset that represents a geometric structure consisting of vertices, lines, polygons, and/or strips. */ export declare constvtkPolyData: { newInstance: typeof newInstance; extend: typeof extend; }; exportdefault vtkPolyData;
publicAPI.buildCells = () => { // here are the number of cells we have const nVerts = publicAPI.getNumberOfVerts(); const nLines = publicAPI.getNumberOfLines(); const nPolys = publicAPI.getNumberOfPolys(); const nStrips = publicAPI.getNumberOfStrips();
// pre-allocate the space we need const nCells = nVerts + nLines + nPolys + nStrips;
const types = newUint8Array(nCells); let pTypes = types; const locs = newUint32Array(nCells); let pLocs = locs;
// record locations and type of each cell. // verts if (nVerts) { let nextCellPts = 0; model.verts.getCellSizes().forEach((numCellPts, index) => { pLocs[index] = nextCellPts; pTypes[index] = numCellPts > 1 ? CellType.VTK_POLY_VERTEX : CellType.VTK_VERTEX; nextCellPts += numCellPts + 1; });
// lines if (nLines) { let nextCellPts = 0; model.lines.getCellSizes().forEach((numCellPts, index) => { pLocs[index] = nextCellPts; pTypes[index] = numCellPts > 2 ? CellType.VTK_POLY_LINE : CellType.VTK_LINE; if (numCellPts === 1) { vtkWarningMacro( 'Building VTK_LINE ', index, ' with only one point, but VTK_LINE needs at least two points. Check the input.' ); } nextCellPts += numCellPts + 1; });
/** * If you know the type of cell, you may provide it to improve performances. */ publicAPI.getCell = (cellId, cellHint = null) => { const cellInfo = publicAPI.getCellPoints(cellId); const cell = cellHint || CELL_FACTORY[cellInfo.cellType].newInstance(); cell.initialize(publicAPI.getPoints(), cellInfo.cellPointIds); return cell; }; }