IndexedPolyfaceVisitor Class
An IndexedPolyfaceVisitor is an iterator-like object that "visits" facets of a mesh.
- The visitor extends a
PolyfaceDataclass, so it can at any time hold all the data of a single facet.
Extends
Implements
Methods
| Name | Description | |
|---|---|---|
| constructor(needNormals: boolean = false, needParams: boolean = false, needColors: boolean = false, twoSided: boolean = false): IndexedPolyfaceVisitor | Constructor for facets. | |
| clearArrays(): void | clear the contents of all arrays. | |
| clientAuxIndex(i: number): number | Return the aux data index of vertex i within the currently loaded facet | |
| clientColorIndex(i: number): number | Return the color index of vertex i within the currently loaded facet | |
| clientNormalIndex(i: number): number | Return the normal index of vertex i within the currently loaded facet | |
| clientParamIndex(i: number): number | Return the param index of vertex i within the currently loaded facet | |
| clientPointIndex(i: number): number | Return the point index of vertex i within the currently loaded facet | |
| clientPolyface(): Polyface | Return the client polyface object. | |
| currentReadIndex(): number | Return the index (in the client polyface) of the current facet | |
| moveToNextFacet(): boolean | Advance the iterator to a the 'next' facet in the client polyface | |
| moveToReadIndex(facetIndex: number): boolean | Advance the iterator to a particular facet in the client polyface | |
| pushDataFrom(other: PolyfaceVisitor, index: number): void | transfer data from a specified index of the other visitor as new data in this visitor. | |
| pushInterpolatedDataFrom(other: PolyfaceVisitor, index0: number, fraction: number, index1: number): void | transfer interpolated data from the other visitor. | |
| reset(): void | Reset the iterator to start at the first facet of the polyface. | |
| setNumWrap(numWrap: number): void | Set the number of vertices duplicated (e.g. | |
| tryGetDistanceParameter(index: number, result?: Point2d): Point2d | undefined | Attempts to extract the distance parameter for the given vertex index on the current facet Returns the distance parameter as a point. |
|
| tryGetNormalizedParameter(index: number, result?: Point2d): Point2d | undefined | Attempts to extract the normalized parameter (0,1) for the given vertex index on the current facet. | |
| create(polyface: IndexedPolyface, numWrap: number): IndexedPolyfaceVisitor Static | Create a visitor for iterating the facets of polyface, with indicated number of points to be added to each facet to produce closed point arraysTypical wrap counts are: 0 -- leave the point arrays with "missing final edge" 1 -- add point 0 as closure point * 2 -- add points 0 and 1 as closure and wrap point. |
Inherited methods
| Name | Inherited from | Description |
|---|---|---|
| clone(): PolyfaceData | PolyfaceData | Return a depp clone. |
| compress(): void | PolyfaceData | * Search for duplication of coordinates within points, normals, and params. |
| copyNormalTo(i: number, dest: Vector3d): void | PolyfaceData | Copy the contents (not pointer) of normal[i] into dest. |
| copyParamTo(i: number, dest: Point2d): void | PolyfaceData | Copy the contents (not pointer) of param[i] into dest. |
| copyPointTo(i: number, dest: Point3d): void | PolyfaceData | Copy the contents (not pointer) of point[i] into dest. |
| gatherIndexedData(other: PolyfaceData, index0: number, index1: number, numWrap: number): void | PolyfaceData | * Copy data from other to this. |
| getColor(i: number): number | PolyfaceData | return indexed color |
| getEdgeVisible(i: number): boolean | PolyfaceData | return indexed visibility |
| getNormal(i: number): Vector3d | undefined | PolyfaceData | return indexed normal. |
| getParam(i: number): Point2d | undefined | PolyfaceData | return indexed param. |
| getPoint(i: number): Point3d | undefined | PolyfaceData | return indexed point. |
| isAlmostEqual(other: PolyfaceData): boolean | PolyfaceData | Test for equal indices and nearly equal coordinates |
| isAlmostEqualParamIndexUV(index: number, u: number, v: number): boolean | PolyfaceData | test if normal at a specified index matches uv |
| range(result?: Range3d, transform?: Transform): Range3d | PolyfaceData | Return the range of the point array (optionally transformed) |
| resizeAllDataArrays(length: number): void | PolyfaceData | Resize all data arrays to specified length |
| reverseIndices(facetStartIndex?: number[]): void | PolyfaceData | reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces. |
| reverseIndicesSingleFacet(facetId: number, facetStartIndex: number[]): void | PolyfaceData | reverse indices facet-by-facet, with the given facetStartIndex array delimiting faces. |
| reverseNormals(): void | PolyfaceData | Scale all the normals by -1 |
| trimAllIndexArrays(length: number): void | PolyfaceData | Trim all index arrays to stated length. |
| tryTransformInPlace(transform: Transform): boolean | PolyfaceData | Apply transform to point and normal arrays. |
| isValidFacetStartIndexArray(facetStartIndex: number[]): boolean Static | PolyfaceData | Test if facetStartIndex is (minimally!) valid: length must be nonzero (recall that for "no facets" the facetStartIndexArray still must contain a 0) Each entry must be strictly smaller than the one that follows. |
| reverseIndices<T>(facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean Static | PolyfaceData | Reverse data in entire facet indexing arrays. |
| reverseIndicesSingleFacet<T>(facetId: number, facetStartIndex: number[], indices: T[] | undefined, preserveStart: boolean): boolean Static | PolyfaceData | Reverse data in entire facet indexing arrays. |
Properties
| Name | Type | Description | |
|---|---|---|---|
| numEdgesThisFacet Accessor ReadOnly | number | Return the number of edges in the current facet. |
Inherited properties
| Name | Type | Inherited from | Description |
|---|---|---|---|
| auxData | PolyfaceAuxData | undefined | PolyfaceData | Auxiliary data |
| color | number[] | undefined | PolyfaceData | Color values. |
| colorCount Accessor ReadOnly | number | PolyfaceData | Get the color count |
| colorIndex | number[] | undefined | PolyfaceData | Indices of colors at facet vertices. |
| edgeVisible | boolean[] | PolyfaceData | booleans indicating visibility of corresponding edges |
| face | FacetFaceData[] | PolyfaceData | Face data will remain empty until a face is specified. |
| faceCount Accessor ReadOnly | number | PolyfaceData | Get the number of faces. Note that a "face" is not a facet. A "face" is a subset of facets grouped for application purposes. |
| indexCount Accessor ReadOnly | number | PolyfaceData | Get the index count. Note that there is one count, and all index arrays (point, normal, param, color) must match |
| normal | GrowableXYZArray | undefined | PolyfaceData | Coordinates of normal vectors, packed as numbers in a contiguous array |
| normalCount Accessor ReadOnly | number | PolyfaceData | Get the normal count |
| normalIndex | number[] | undefined | PolyfaceData | indices of normals at facet vertices. |
| param | undefined | GrowableXYArray | PolyfaceData | Coordinates of uv parameters, packed as numbers in a contiguous array. |
| paramCount Accessor ReadOnly | number | PolyfaceData | Get the param count |
| paramIndex | number[] | undefined | PolyfaceData | Indics of params at facet vertices. |
| point | GrowableXYZArray | PolyfaceData | Coordinate data for points in the facets, packed as numbers in a contiguous array. |
| pointCount Accessor ReadOnly | number | PolyfaceData | Get the point count |
| pointIndex | number[] | PolyfaceData | Indices of points at facet vertices. |
| requireNormals Accessor ReadOnly | boolean | PolyfaceData | Ask if normals are required in this mesh. |
| twoSided Accessor | boolean | PolyfaceData | boolean tag indicating if the facets are viewable from the back |
Defined in
Last Updated: 08 January, 2020